Skip to content

Commit

Permalink
configd: T6608: add missing env vars, obscured by uncaught exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jestabro committed Jul 30, 2024
1 parent cebffa1 commit cb14f8b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/services/vyos-configd
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ def initialization(socket):
sudo_user_string = socket.recv().decode("utf-8", "ignore")
resp = "sudo_user"
socket.send(resp.encode())
temp_config_dir_string = socket.recv().decode("utf-8", "ignore")
resp = "temp_config_dir"
socket.send(resp.encode())
changes_only_dir_string = socket.recv().decode("utf-8", "ignore")
resp = "changes_only_dir"
socket.send(resp.encode())

logger.debug(f"config session pid is {pid_string}")
logger.debug(f"config session sudo_user is {sudo_user_string}")
Expand All @@ -200,6 +206,10 @@ def initialization(socket):
session_mode = 'a'

os.environ['SUDO_USER'] = sudo_user_string
if temp_config_dir_string:
os.environ['VYATTA_TEMP_CONFIG_DIR'] = temp_config_dir_string
if changes_only_dir_string:
os.environ['VYATTA_CHANGES_ONLY_DIR'] = changes_only_dir_string

try:
configsource = ConfigSourceString(running_config_text=active_string,
Expand Down
24 changes: 24 additions & 0 deletions src/shim/vyshim.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ int initialization(void* Requester)
}
debug_print("sudo_user is %s\n", sudo_user);

char *temp_config_dir = getenv("VYATTA_TEMP_CONFIG_DIR");
if (!temp_config_dir) {
char none[] = "";
temp_config_dir = none;
}
debug_print("temp_config_dir is %s\n", temp_config_dir);

char *changes_only_dir = getenv("VYATTA_CHANGES_ONLY_DIR");
if (!changes_only_dir) {
char none[] = "";
changes_only_dir = none;
}
debug_print("changes_only_dir is %s\n", changes_only_dir);

debug_print("Sending init announcement\n");
char *init_announce = mkjson(MKJSON_OBJ, 1,
MKJSON_STRING, "type", "init");
Expand Down Expand Up @@ -252,6 +266,16 @@ int initialization(void* Requester)
zmq_recv(Requester, buffer, 16, 0);
debug_print("Received sudo_user receipt\n");

debug_print("Sending config session temp_config_dir\n");
zmq_send(Requester, temp_config_dir, strlen(temp_config_dir), 0);
zmq_recv(Requester, buffer, 16, 0);
debug_print("Received temp_config_dir receipt\n");

debug_print("Sending config session changes_only_dir\n");
zmq_send(Requester, changes_only_dir, strlen(changes_only_dir), 0);
zmq_recv(Requester, buffer, 16, 0);
debug_print("Received changes_only_dir receipt\n");

return 0;
}

Expand Down

0 comments on commit cb14f8b

Please sign in to comment.