mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-25 06:55:46 +01:00
we dont need an error_exit twice when validating netconf
This commit is contained in:
@@ -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')"
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -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}."
|
||||
|
||||
@@ -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}\""
|
||||
|
||||
Reference in New Issue
Block a user