mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-20 17:32:16 +00:00
fix(misc): replace generic return 1 with specific exit codes in remaining .func files
Replace 80 generic 'return 1' error returns with specific exit codes across alpine-tools.func, build.func, core.func, cloud-init.func, and vm-core.func, matching the EXIT_CODES.md schema. alpine-tools.func (51 replaced): - check_for_gh_release, fetch_and_deploy_gh: API/DNS/download errors - setup_yq, setup_adminer, setup_uv, setup_java, setup_go, setup_composer - need_tool, download_with_progress build.func (13 replaced): - install_ssh_keys_into_ct: file operation errors (252) - choose_and_set_storage_for_file: parameter/service errors (65/150) - _find_default_vars, default_var_settings: file not found (252) - destroy_lxc, resolve_storage_preselect, select_storage: param errors (65) - validate_storage_space: hardware/space errors (236) core.func (9 replaced): - get_header: download failed (250) - prompt_select: no options (65) - check_or_create_swap: dd/mkswap/swapon failures (150), invalid size (65) - get_current_ip, get_lxc_ip: IP detection failed (6) cloud-init.func (6 replaced): - setup_cloud_init: invalid IP/gateway format (65) - configure_cloud_init_interactive: whiptail missing (127) - get_vm_ip, wait_for_cloud_init: timeout/connection errors (7/150) vm-core.func (1 replaced): - get_header: download failed (250) Boolean returns (validate_*, is_*, prompt_*, 'no update') kept as return 1.
This commit is contained in:
@@ -319,11 +319,11 @@ function setup_cloud_init() {
|
||||
if [ "$network_mode" = "static" ]; then
|
||||
if [ -n "$static_ip" ] && ! validate_ip_cidr "$static_ip"; then
|
||||
_ci_msg_error "Invalid static IP format: $static_ip (expected: x.x.x.x/xx)"
|
||||
return 1
|
||||
return 65
|
||||
fi
|
||||
if [ -n "$gateway" ] && ! validate_ip "$gateway"; then
|
||||
_ci_msg_error "Invalid gateway IP format: $gateway"
|
||||
return 1
|
||||
return 65
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -433,7 +433,7 @@ function configure_cloud_init_interactive() {
|
||||
if ! command -v whiptail >/dev/null 2>&1; then
|
||||
echo "Warning: whiptail not available, skipping interactive configuration"
|
||||
export CLOUDINIT_ENABLE="no"
|
||||
return 1
|
||||
return 127
|
||||
fi
|
||||
|
||||
# Ask if user wants to enable Cloud-Init
|
||||
@@ -603,7 +603,7 @@ function get_vm_ip() {
|
||||
elapsed=$((elapsed + 2))
|
||||
done
|
||||
|
||||
return 1
|
||||
return 7
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -621,7 +621,7 @@ function wait_for_cloud_init() {
|
||||
|
||||
if [ -z "$vm_ip" ]; then
|
||||
_ci_msg_warn "Unable to determine VM IP address"
|
||||
return 1
|
||||
return 7
|
||||
fi
|
||||
|
||||
_ci_msg_info "Waiting for Cloud-Init to complete on ${vm_ip}"
|
||||
@@ -638,7 +638,7 @@ function wait_for_cloud_init() {
|
||||
done
|
||||
|
||||
_ci_msg_warn "Cloud-Init did not complete within ${timeout}s"
|
||||
return 1
|
||||
return 150
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user