summaryrefslogtreecommitdiff
path: root/src/services/vyos-configd
diff options
context:
space:
mode:
authorBrandon Stepler <brandon@stepler.net>2021-07-29 14:30:00 -0400
committerJohn Estabrook <jestabro@vyos.io>2021-09-02 14:26:18 -0500
commit4a8bf1ee1e1e5b6fee1850b5cb82085c0edd75ab (patch)
tree5cc2b2bc0b796ce7c64b2b78cfa49118a323e525 /src/services/vyos-configd
parent6e5923da90897c2cbfa553a28347acddce174771 (diff)
downloadvyos-1x-4a8bf1ee1e1e5b6fee1850b5cb82085c0edd75ab.tar.gz
vyos-1x-4a8bf1ee1e1e5b6fee1850b5cb82085c0edd75ab.zip
configd: T3694: always set script.argv
Several scripts imported by vyos-configd (including src/conf_mode/protocols_static.py) rely on argv for operating on VRFs. Always setting script.argv in src/services/vyos-configd ensures those scripts will operate on the default VRF when called with no arguments. Otherwise, a stale argv might cause those scripts to operate on the last modified VRF instead of the default VRF. (cherry picked from commit 3341c591ad1190f39ff3ffd475eddf5d95aef763)
Diffstat (limited to 'src/services/vyos-configd')
-rwxr-xr-xsrc/services/vyos-configd7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/services/vyos-configd b/src/services/vyos-configd
index 6f770b696..670b6e66a 100755
--- a/src/services/vyos-configd
+++ b/src/services/vyos-configd
@@ -133,8 +133,7 @@ def explicit_print(path, mode, msg):
logger.critical("error explicit_print")
def run_script(script, config, args) -> int:
- if args:
- script.argv = args
+ script.argv = args
config.set_level([])
try:
c = script.get_config(config)
@@ -208,7 +207,7 @@ def process_node_data(config, data) -> int:
return R_ERROR_DAEMON
script_name = None
- args = None
+ args = []
res = re.match(r'^(VYOS_TAGNODE_VALUE=[^/]+)?.*\/([^/]+).py(.*)', data)
if res.group(1):
@@ -221,7 +220,7 @@ def process_node_data(config, data) -> int:
return R_ERROR_DAEMON
if res.group(3):
args = res.group(3).split()
- args.insert(0, f'{script_name}.py')
+ args.insert(0, f'{script_name}.py')
if script_name not in include_set:
return R_PASS