mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Merge pull request #262 from sohorx/arg/lockfile
replace lockfile global by a common argument
This commit is contained in:
@ -241,6 +241,10 @@ class Parse:
|
||||
''' general parsing rules '''
|
||||
|
||||
argparser.add_argument('-V', '--version', action=VersionAction, nargs=0)
|
||||
argparser.add_argument(
|
||||
'-L', '--lock', default='/run/network/.lock', dest='lockfile',
|
||||
help='use lock file instead of default /run/network/.lock'
|
||||
)
|
||||
argparser.add_argument(
|
||||
"--nldebug",
|
||||
dest="nldebug",
|
||||
|
@ -35,7 +35,6 @@ except (ImportError, ModuleNotFoundError):
|
||||
|
||||
log = logging.getLogger()
|
||||
configmap_g = None
|
||||
lockfile = "/run/network/.lock"
|
||||
|
||||
|
||||
class Ifupdown2:
|
||||
@ -70,7 +69,7 @@ class Ifupdown2:
|
||||
self.read_config()
|
||||
self.init(stdin_buffer)
|
||||
|
||||
if self.op != 'query' and not utils.lockFile(lockfile):
|
||||
if self.op != 'query' and not utils.lockFile(self.args.lockfile):
|
||||
log.error("Another instance of this program is already running.")
|
||||
return Status.Client.STATUS_ALREADY_RUNNING
|
||||
|
||||
|
Reference in New Issue
Block a user