summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-02-20 20:09:17 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-02-20 20:09:17 +0000
commit818c1d478e637b68218647b0f7bab2dbf85e8614 (patch)
tree8f21c417cc44e8e1ab7508d941f9a29f7aac817f /src/sbin
parentde160a5a2bcd1b2e769165f80052ad38122999c0 (diff)
downloadbcfg2-818c1d478e637b68218647b0f7bab2dbf85e8614.tar.gz
bcfg2-818c1d478e637b68218647b0f7bab2dbf85e8614.tar.bz2
bcfg2-818c1d478e637b68218647b0f7bab2dbf85e8614.zip
Options.py: Add configurable lockfile option (Resolves Ticket #850)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5734 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg26
1 files changed, 3 insertions, 3 deletions
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)