From 818c1d478e637b68218647b0f7bab2dbf85e8614 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Sat, 20 Feb 2010 20:09:17 +0000 Subject: Options.py: Add configurable lockfile option (Resolves Ticket #850) Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5734 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sbin') 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='', 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) -- cgit v1.2.3-1-g7c22