From 042f71db129f848306449fbb538a892d03f6b777 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 25 Jan 2024 14:05:56 +0100 Subject: [PATCH] configctl: with the support of our stream reader (https://github.com/opnsense/core/commit/42fd27df777ee85a0e42767a814bed5e93659f0c), we didn't collect the results when used as an event handler, in which case the action is silently dropped. let's wait for configd's result and add it to the log message as well. closes https://github.com/opnsense/core/issues/7164 --- src/opnsense/service/configd_ctl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/opnsense/service/configd_ctl.py b/src/opnsense/service/configd_ctl.py index e893ec93a..49d4e4003 100755 --- a/src/opnsense/service/configd_ctl.py +++ b/src/opnsense/service/configd_ctl.py @@ -133,8 +133,12 @@ if args.e: syslog_notice("event @ %.2f msg: %s" % (last_message_stamp, line)) # execute command(s) for exec_command in exec_commands: - syslog_notice("event @ %.2f exec: %s" % (last_message_stamp, exec_command)) - exec_config_cmd(exec_command=exec_command) + if args.d: + exec_command = '&' + exec_command + # we need to fetch the generator's response in order to execute the command, lets return it to the + # users as well. + cmd_outp = (' '.join(exec_config_cmd(exec_command=exec_command))).strip() + syslog_notice("event @ %.2f exec: %s response: %s" % (last_message_stamp, exec_command, cmd_outp)) stashed_lines = list() else: # normal execution mode