# #
###############################################################################
+ports_get_all() {
+ local port
+ for port in $(list_directory "${NETWORK_PORTS_DIR}"); do
+ if port_exists "${port}"; then
+ print "${port}"
+ fi
+ done
+}
+
+# XXX TO BE REMOVED
port_list() {
- list_directory "${NETWORK_PORTS_DIR}"
+ ports_get_all "$@"
}
port_list_in_use() {
settings_write "$(port_file "${port}")" ${args}
}
-ports_get_all() {
- port_list
-}
-
port_file() {
local port="${1}"
assert isset port
return ${EXIT_ERROR}
fi
- rm -rf "${NETWORK_PORTS_DIR}/${port}"
+ if ! rm -rf "${NETWORK_PORTS_DIR}/${port}"; then
+ log ERROR "Could not destroy port ${port}"
+ return ${EXIT_ERROR}
+ fi
+
+ log INFO "Destroyed port ${port}"
+ return ${EXIT_OK}
}
port_create() {
return ${EXIT_ERROR}
fi
- log INFO "Destroying zone ${zone}"
-
# Force the zone down.
zone_is_active "${zone}" && zone_stop "${zone}"
# Disable zone auto-start
zone_disable "${zone}"
- rm -rf "${NETWORK_ZONES_DIR}/${zone}"
+ if ! rm -rf "${NETWORK_ZONES_DIR}/${zone}"; then
+ log ERROR "Could not destroy zone ${zone}"
+ return ${EXIT_ERROR}
+ fi
+
+ log INFO "Destroyed zone ${zone}"
+ return ${EXIT_OK}
}
zone_up() {
# Read configuration values
zone_port_settings_read "${zone}" "${port}" ${HOOK_PORT_SETTINGS}
+ # Make sure that the port is up
+ port_up "${port}"
+
# Attach the port to the bridge
bridge_attach_device "${zone}" "${port}"
stp_port_set_priority "${zone}" "${port}" "${PRIORITY}"
fi
- # Make sure that the port is up
- port_up "${port}"
-
return ${EXIT_OK}
}
done
local zone
- for zone in $(zones_get --all); do
+ for zone in $(zones_get_all); do
zone_destroy "${zone}"
done
local port
- for port in $(ports_get --all); do
+ for port in $(ports_get_all); do
port_destroy "${port}"
done