we dont need an error_exit twice when validating netconf

This commit is contained in:
tschettervictor
2025-04-26 15:01:56 -06:00
parent 209d800cbb
commit fa4ffa340f
4 changed files with 6 additions and 6 deletions

View File

@@ -150,7 +150,7 @@ update_jailconf() {
fi
if grep -qw "vnet;" "${JAIL_CONFIG}"; then
validate_netconf || error_exit "[ERROR]: Failed to validate Bastille network configuration."
validate_netconf
update_jailconf_vnet
else
_ip4="$(bastille config ${TARGET} get ip4.addr | sed 's/,/ /g')"

View File

@@ -419,7 +419,7 @@ EOF
validate_netconf() {
if [ -n "${bastille_network_loopback}" ] && [ -n "${bastille_network_shared}" ]; then
error_exit "Invalid network configuration."
error_exit "[ERROR]: 'bastille_network_loopback' and 'bastille_network_shared' cannot both be set."
fi
if [ "${bastille_network_vnet_type}" != "if_bridge" ] && [ "${bastille_network_vnet_type}" != "netgraph" ]; then
error_exit "[ERROR]: 'bastille_network_vnet_type' not set properly: ${bastille_network_vnet_type}"

View File

@@ -957,18 +957,18 @@ if [ -z "${EMPTY_JAIL}" ]; then
## check if interface is valid
if [ -n "${INTERFACE}" ]; then
validate_netif
validate_netconf || error_exit "[ERROR]: Failed to validate Bastille network configuration."
validate_netconf
elif [ -n "${VNET_JAIL}" ]; then
if [ -z "${INTERFACE}" ]; then
if [ -z "${bastille_network_shared}" ]; then
# User must specify interface on vnet jails.
error_exit "Error: Network interface not defined."
else
validate_netconf || error_exit "[ERROR]: Failed to validate Bastille network configuration."
validate_netconf
fi
fi
else
validate_netconf || error_exit "[ERROR]: Failed to validate Bastille network configuration."
validate_netconf
fi
else
info "Creating empty jail: ${NAME}."

View File

@@ -560,7 +560,7 @@ add_vlan() {
case "${ACTION}" in
add)
validate_netconf || error_exit "[ERROR]: Failed to validate Bastille network configuration."
validate_netconf
validate_netif "${INTERFACE}"
if check_interface_added "${TARGET}" "${INTERFACE}" && [ -z "${VLAN_ID}" ]; then
error_exit "Interface is already added: \"${INTERFACE}\""