diff options
-rw-r--r-- | doc/bcfg2.conf-options.txt | 19 | ||||
-rw-r--r-- | doc/contents.txt | 1 | ||||
-rw-r--r-- | src/lib/Options.py | 4 | ||||
-rwxr-xr-x | src/sbin/bcfg2 | 6 |
4 files changed, 27 insertions, 3 deletions
diff --git a/doc/bcfg2.conf-options.txt b/doc/bcfg2.conf-options.txt new file mode 100644 index 000000000..85bc0190f --- /dev/null +++ b/doc/bcfg2.conf-options.txt @@ -0,0 +1,19 @@ +.. -*- mode: rst -*- + +.. _bcfg2.conf-options: + +========== +bcfg2.conf +========== + +This page documents the various options available in bcfg2.conf. The +various sections correspond to the sections in the file itself. + +components +========== + +logging +------- + +Specify an alternate path for the lockfile used by the bcfg2 client. +Default value is ``/var/lock/bcfg2.run`` diff --git a/doc/contents.txt b/doc/contents.txt index 1509cdd3a..80c4a9072 100644 --- a/doc/contents.txt +++ b/doc/contents.txt @@ -17,6 +17,7 @@ Welcome to Bcfg2's documentation! server/index client/index gettinghelp + bcfg2.conf-options development/index unsorted/index diff --git a/src/lib/Options.py b/src/lib/Options.py index c67fde910..c2e265b87 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -172,6 +172,10 @@ def colon_split(c_string): CFILE = Option('Specify configuration file', DEFAULT_CONFIG_LOCATION, cmd='-C', odesc='<conffile>') +LOCKFILE = Option('Specify lockfile', + "/var/lock/bcfg2.run", + cf=('components', 'lockfile'), + odesc='<Path to lockfile>') HELP = Option('Print this usage message', False, cmd='-h') DEBUG = Option("Enable debugging output", False, cmd='-d') VERBOSE = Option("Enable verbose output", False, cmd='-v') diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 293f88e9f..13ecf1886 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -28,7 +28,6 @@ def cb_sigint_handler(signum, frame): DECISION_LIST = Bcfg2.Options.Option('Decision List', default=False, cmd="--decision-list", odesc='<file>', long_arg=True) -LOCKFILE = "/var/lock/bcfg2.run" class Client: @@ -45,6 +44,7 @@ class Client: 'extra': Bcfg2.Options.CLIENT_EXTRA_DISPLAY, 'quick': Bcfg2.Options.CLIENT_QUICK, 'debug': Bcfg2.Options.DEBUG, + 'lockfile': Bcfg2.Options.LOCKFILE, 'drivers': Bcfg2.Options.CLIENT_DRIVERS, 'dryrun': Bcfg2.Options.CLIENT_DRYRUN, 'paranoid': Bcfg2.Options.CLIENT_PARANOID, @@ -259,7 +259,7 @@ class Client: if not self.setup['omit-lock-check']: #check lock here try: - lockfile = open(LOCKFILE, 'w') + lockfile = open(self.setup['lockfile'], 'w') try: fcntl.lockf(lockfile.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: @@ -277,7 +277,7 @@ class Client: if lockfile: try: fcntl.lockf(lockfile.fileno(), fcntl.LOCK_UN) - os.remove(LOCKFILE) + os.remove(self.setup['lockfile']) except OSError: self.logger.error("Failed to unlock lockfile %s" % lockfile.name) |