Let kubespray install the correct docker versions
[icn.git] / env / metal3 / 02_configure.sh
index 3117027..20077d2 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,11 +11,12 @@ if [[ $EUID -ne 0 ]]; then
     exit 1
 fi
 
-function check_inteface_ip {
+function check_interface_ip {
     local interface=$1
     local ipaddr=$2
 
-    if [ ! $(ip addr show dev $interface) ]; then
+    ip addr show dev $interface
+    if [ $? -ne 0 ]; then
         exit 1
     fi
 
@@ -24,13 +26,6 @@ function check_inteface_ip {
     fi
 }
 
-function configure_dhcp_bridge {
-    brctl addbr dhcp0
-    ip link set dhcp0 up
-    brctl addif dhcp0 $BS_DHCP_INTERFACE
-    ip addr add dev dhcp0 $BS_DHCP_INTERFACE_IP
-}
-
 function configure_ironic_bridge {
     brctl addbr provisioning
     ip link set provisioning up
@@ -62,13 +57,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
@@ -158,14 +153,14 @@ function configure {
     #configure_kubeadm $1
     #configure_kubelet
     configure_ironic $1
-    configure_dhcp_bridge
     configure_ironic_bridge
     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