fix(api): improve error handling and quoting in agent scripts
- Updated `evofw-firewall.sh` to correctly handle exit codes from the `curl_policy` function, ensuring proper script termination based on policy retrieval status. - Enhanced `install.sh` to always use single quotes for configuration values, improving safety for names with spaces, and refined the logic for updating the `KERNEL_BACKEND` in the configuration file. - Updated documentation to reflect the changes in quoting and exit behavior during installation and synchronization processes.
This commit is contained in:
@@ -43,9 +43,13 @@ curl_policy() {
|
||||
return 0
|
||||
}
|
||||
|
||||
if ! curl_policy "$POLICY_FILE"; then
|
||||
rc=$?
|
||||
[[ "$rc" == "2" ]] && exit 0
|
||||
# Do not use `if ! cmd; rc=$?` — after `!`, $? is 0, not the real status.
|
||||
policy_rc=0
|
||||
curl_policy "$POLICY_FILE" || policy_rc=$?
|
||||
if [[ "$policy_rc" -eq 2 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$policy_rc" -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user