Skip to content

Commit fdda107

Browse files
fix: broken forced remove-module (#799)
Avoid premature step termination for sys.exit(2) invoked by agent.assert_exp(). The forced exit happens before the code that ignores the error.
1 parent f7b9163 commit fdda107

File tree

1 file changed

+6
-4
lines changed
  • core/imageroot/var/lib/nethserver/cluster/actions/remove-module

1 file changed

+6
-4
lines changed

core/imageroot/var/lib/nethserver/cluster/actions/remove-module/50update

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ try:
6363
},
6464
endpoint="redis://cluster-leader",
6565
)
66-
agent.assert_exp(destroy_module_result['exit_code'] == 0)
66+
if destroy_module_result['exit_code'] != 0:
67+
raise Exception(f"non-zero exit-code from subtask")
6768
except Exception as ex:
6869
if forced_removal:
69-
print(agent.SD_WARNING + "Destroy module failed:", ex, file=sys.stderr)
70+
print(agent.SD_WARNING + f"module/{module_id}/destroy-module failed:", ex, file=sys.stderr)
7071
else:
7172
raise ex
7273

@@ -80,10 +81,11 @@ try:
8081
},
8182
endpoint="redis://cluster-leader",
8283
)
83-
agent.assert_exp(remove_module_result['exit_code'] == 0) # The node remove-module action must succeed
84+
if remove_module_result['exit_code'] != 0: # The node remove-module action must succeed
85+
raise Exception(f"non-zero exit-code from subtask")
8486
except Exception as ex:
8587
if forced_removal:
86-
print(agent.SD_WARNING + "Remove module from node has failed:", ex, file=sys.stderr)
88+
print(agent.SD_WARNING + f"node/{node_id}/remove-module failed:", ex, file=sys.stderr)
8789
else:
8890
raise ex
8991

0 commit comments

Comments
 (0)