diff --git a/labs/lib/functions.guest b/labs/lib/functions.guest index c3bd25a3..cf6b7bd8 100644 --- a/labs/lib/functions.guest +++ b/labs/lib/functions.guest @@ -5,6 +5,13 @@ source "$LIB_DIR/functions" source "$LIB_DIR/functions-common-devstack" +# Make devstack's operating system identification work with nounset +function init_os_ident { + if [[ -z "${os_PACKAGE:-""}" ]]; then + GetOSVersion + fi +} + function source_deploy { if [ -n "${VM_SHELL_USER:-}" ]; then # Already sourced @@ -281,6 +288,7 @@ function _config_interfaces_hostonly { function config_nat { local if_num=$1 + init_os_ident if is_fedora; then echo _config_sysconfig_nat "$if_num" _config_sysconfig_nat "$if_num" @@ -294,6 +302,7 @@ function config_hostonly { local if_num=$1 local ip_address=$2 + init_os_ident if is_fedora; then echo _config_sysconfig_hostonly "$if_num" "$ip_address" _config_sysconfig_hostonly "$if_num" "$ip_address" @@ -317,6 +326,7 @@ function hostname_to_ip { } function config_network { + init_os_ident if is_ubuntu; then # Configuration functions will append to this file sudo cp -v "$TEMPLATE_DIR/template-ubuntu-interfaces-loopback" \ diff --git a/labs/scripts/apt_init.sh b/labs/scripts/apt_init.sh index 0b416eb0..b9e2570c 100755 --- a/labs/scripts/apt_init.sh +++ b/labs/scripts/apt_init.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/openstack" diff --git a/labs/scripts/apt_install_mysql.sh b/labs/scripts/apt_install_mysql.sh index 7853a952..2b8ecea4 100755 --- a/labs/scripts/apt_install_mysql.sh +++ b/labs/scripts/apt_install_mysql.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/apt_pre-download.sh b/labs/scripts/apt_pre-download.sh index 1b5b1a33..66be02bf 100755 --- a/labs/scripts/apt_pre-download.sh +++ b/labs/scripts/apt_pre-download.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/openstack" diff --git a/labs/scripts/apt_upgrade.sh b/labs/scripts/apt_upgrade.sh index eb1c3a9c..917d3fe8 100755 --- a/labs/scripts/apt_upgrade.sh +++ b/labs/scripts/apt_upgrade.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/openstack" @@ -16,6 +17,7 @@ sudo apt-get -y dist-upgrade # XXX Not a great location for Vagrant specific code if [[ $VM_SHELL_USER = vagrant ]]; then + init_os_ident if is_ubuntu; then sudo apt-get -y install virtualbox-guest-dkms fi diff --git a/labs/scripts/config_demo_user.sh b/labs/scripts/config_demo_user.sh index 3633467c..ce1683a8 100755 --- a/labs/scripts/config_demo_user.sh +++ b/labs/scripts/config_demo_user.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/config_external_network.sh b/labs/scripts/config_external_network.sh index 5ecab7a0..cfe87165 100755 --- a/labs/scripts/config_external_network.sh +++ b/labs/scripts/config_external_network.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/config_tenant_network.sh b/labs/scripts/config_tenant_network.sh index c638d4ca..e1c23735 100755 --- a/labs/scripts/config_tenant_network.sh +++ b/labs/scripts/config_tenant_network.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/etc_hosts.sh b/labs/scripts/etc_hosts.sh index 13402f0c..fa1fdc39 100755 --- a/labs/scripts/etc_hosts.sh +++ b/labs/scripts/etc_hosts.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$LIB_DIR/functions.guest" diff --git a/labs/scripts/install_rabbitmq.sh b/labs/scripts/install_rabbitmq.sh index 2ccb41a7..c38f567f 100755 --- a/labs/scripts/install_rabbitmq.sh +++ b/labs/scripts/install_rabbitmq.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/osbash/activate_autostart.sh b/labs/scripts/osbash/activate_autostart.sh index df333abc..f5bb8ebf 100755 --- a/labs/scripts/osbash/activate_autostart.sh +++ b/labs/scripts/osbash/activate_autostart.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset # This script is the first to run and the only one to run as root. # XXX The name activate_autostart.sh is hard-coded in ks.cfg and preseed.cfg. @@ -52,6 +53,9 @@ sed -e " chmod 755 "/etc/init.d/$RCAUTOSTART" +# Make devstack's is_fedora work with nounset +init_os_ident + if is_fedora; then cat << SERVICE > /etc/systemd/system/$RCAUTOSTART.service [Unit] diff --git a/labs/scripts/osbash/base_fixups.sh b/labs/scripts/osbash/base_fixups.sh index f6b89a66..84ff7437 100755 --- a/labs/scripts/osbash/base_fixups.sh +++ b/labs/scripts/osbash/base_fixups.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$LIB_DIR/functions.guest" diff --git a/labs/scripts/osbash/enable_vagrant_ssh_keys.sh b/labs/scripts/osbash/enable_vagrant_ssh_keys.sh index e17cdbc3..7be3a77c 100755 --- a/labs/scripts/osbash/enable_vagrant_ssh_keys.sh +++ b/labs/scripts/osbash/enable_vagrant_ssh_keys.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset # This script installs the unsecure Vagrant ssh keys. This allows users to # log into the VMs using these keys instead of a password. diff --git a/labs/scripts/osbash/init_xxx_node.sh b/labs/scripts/osbash/init_xxx_node.sh index b77c3207..684cf2a5 100755 --- a/labs/scripts/osbash/init_xxx_node.sh +++ b/labs/scripts/osbash/init_xxx_node.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset # This scripts configures hostname and networking for all nodes. The filename # determines the node name. diff --git a/labs/scripts/osbash/wait_debug.sh b/labs/scripts/osbash/wait_debug.sh index 2bb41fe3..d426b688 100755 --- a/labs/scripts/osbash/wait_debug.sh +++ b/labs/scripts/osbash/wait_debug.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$LIB_DIR/functions.guest" diff --git a/labs/scripts/setup_cinder_controller.sh b/labs/scripts/setup_cinder_controller.sh index ce10bce3..44e76000 100755 --- a/labs/scripts/setup_cinder_controller.sh +++ b/labs/scripts/setup_cinder_controller.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_cinder_volumes.sh b/labs/scripts/setup_cinder_volumes.sh index ff6d0a85..7c1c20c0 100755 --- a/labs/scripts/setup_cinder_volumes.sh +++ b/labs/scripts/setup_cinder_volumes.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_glance.sh b/labs/scripts/setup_glance.sh index af67bdc8..d5210e63 100755 --- a/labs/scripts/setup_glance.sh +++ b/labs/scripts/setup_glance.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_horizon.sh b/labs/scripts/setup_horizon.sh index 2f093022..80b55d51 100755 --- a/labs/scripts/setup_horizon.sh +++ b/labs/scripts/setup_horizon.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$LIB_DIR/functions.guest" diff --git a/labs/scripts/setup_keystone.sh b/labs/scripts/setup_keystone.sh index e179183f..b756063a 100755 --- a/labs/scripts/setup_keystone.sh +++ b/labs/scripts/setup_keystone.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_neutron_compute.sh b/labs/scripts/setup_neutron_compute.sh index 7013c037..6d6ab1d2 100755 --- a/labs/scripts/setup_neutron_compute.sh +++ b/labs/scripts/setup_neutron_compute.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_neutron_controller.sh b/labs/scripts/setup_neutron_controller.sh index 9c0464bc..9fc70b2f 100755 --- a/labs/scripts/setup_neutron_controller.sh +++ b/labs/scripts/setup_neutron_controller.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_neutron_network.sh b/labs/scripts/setup_neutron_network.sh index 0a5ec3d6..4c1fa869 100755 --- a/labs/scripts/setup_neutron_network.sh +++ b/labs/scripts/setup_neutron_network.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" @@ -91,7 +92,9 @@ log-queries # Verbose logging for DHCP log-dhcp DNSMASQ -sudo killall dnsmasq + +# Catch and ignore error status if no dnsmasq process is found (the default) +sudo killall dnsmasq||rc=$? echo "Configuring the metadata agent" conf=/etc/neutron/metadata_agent.ini diff --git a/labs/scripts/setup_nova_compute.sh b/labs/scripts/setup_nova_compute.sh index 2a2493ec..38de73c0 100755 --- a/labs/scripts/setup_nova_compute.sh +++ b/labs/scripts/setup_nova_compute.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/setup_nova_controller.sh b/labs/scripts/setup_nova_controller.sh index 35bb0217..434a49d9 100755 --- a/labs/scripts/setup_nova_controller.sh +++ b/labs/scripts/setup_nova_controller.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/credentials" diff --git a/labs/scripts/shutdown.sh b/labs/scripts/shutdown.sh index fd51ab82..ea959a2e 100755 --- a/labs/scripts/shutdown.sh +++ b/labs/scripts/shutdown.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$LIB_DIR/functions.guest" diff --git a/labs/scripts/yum_init.sh b/labs/scripts/yum_init.sh index 95c761cb..3fc78d39 100755 --- a/labs/scripts/yum_init.sh +++ b/labs/scripts/yum_init.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/openstack" diff --git a/labs/scripts/yum_update.sh b/labs/scripts/yum_update.sh index 6cb13e34..5825459d 100755 --- a/labs/scripts/yum_update.sh +++ b/labs/scripts/yum_update.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$CONFIG_DIR/openstack" diff --git a/labs/scripts/zero_empty.sh b/labs/scripts/zero_empty.sh index bfff5fd5..dceab9e1 100755 --- a/labs/scripts/zero_empty.sh +++ b/labs/scripts/zero_empty.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -o errexit -o nounset TOP_DIR=$(cd $(dirname "$0")/.. && pwd) source "$TOP_DIR/config/paths" source "$LIB_DIR/functions.guest"