From e50780e531a263ffa7d0e68cb01bf0e7e3398051 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 11 Jul 2024 10:31:20 +0200 Subject: [PATCH] backend: add default argument to configctl PR: https://forum.opnsense.org/index.php?topic=41501.0 --- src/opnsense/service/configd_ctl.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/opnsense/service/configd_ctl.py b/src/opnsense/service/configd_ctl.py index 28d7fdd2a..840db9162 100755 --- a/src/opnsense/service/configd_ctl.py +++ b/src/opnsense/service/configd_ctl.py @@ -88,7 +88,7 @@ parser.add_argument( help="threshold between events, wait this interval before executing commands, combine input into single events", type=float ) -parser.add_argument("command", help="command(s) to execute", nargs="+") +parser.add_argument("command", help="command(s) to execute", nargs="*") args = parser.parse_args() syslog.openlog(os.path.basename(sys.argv[0])) @@ -110,9 +110,17 @@ if not os.path.exists(configd_socket_name): # command(s) to execute if args.m: + # select list command when not otherwise specified + if not args.command: + args.command = ['configd actions'] + # execute multiple commands at once ( -m "action1 param .." "action2 param .." ) exec_commands=args.command else: + # select list command when not otherwise specified + if not args.command: + args.command = ['configd', 'actions'] + # execute single command sequence exec_commands=[' '.join(args.command)]