1
0
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:
Julien Fortin
2023-06-12 15:18:57 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@ -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",

View File

@ -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