Upgrade baremetal-operator
[icn.git] / env / metal3 / 02_configure.sh
index 3117027..085a162 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
-set -xe
+set -eux -o pipefail
+
 LIBDIR="$(dirname "$PWD")"
 
 source $LIBDIR/lib/logging.sh
@@ -10,7 +11,7 @@ if [[ $EUID -ne 0 ]]; then
     exit 1
 fi
 
-function check_inteface_ip {
+function check_interface_ip {
     local interface=$1
     local ipaddr=$2
 
@@ -62,13 +63,13 @@ function configure_ironic_interfaces {
     #Todo later to change the CNI networking for podman networking
     # Add firewall rules to ensure the IPA ramdisk can reach httpd, Ironic and the Inspector API on the host
     if [ "$IRONIC_PROVISIONING_INTERFACE" ]; then
-        check_inteface_ip $IRONIC_PROVISIONING_INTERFACE $IRONIC_PROVISIONING_INTERFACE_IP
+        check_interface_ip $IRONIC_PROVISIONING_INTERFACE $IRONIC_PROVISIONING_INTERFACE_IP
     else
         exit 1
     fi
 
     if [ "$IRONIC_IPMI_INTERFACE" ]; then
-        check_inteface_ip $IRONIC_IPMI_INTERFACE $IRONIC_IPMI_INTERFACE_IP
+        check_interface_ip $IRONIC_IPMI_INTERFACE $IRONIC_IPMI_INTERFACE_IP
     else
         exit 1
     fi
@@ -163,9 +164,10 @@ function configure {
     configure_ironic_interfaces
 }
 
-if [ "$1" == "-o" ]; then
+if [ "$#" -eq 0 ]; then
+    configure online
+elif [ "$1" == "-o" ]; then
     configure offline
-    exit 0
+else
+    exit 1
 fi
-
-configure