Skip to content

Commit

Permalink
dev: Improve error checking for config check functions
Browse files Browse the repository at this point in the history
Various functions in the development/testing scripts rely on 'kayobe
configuration dump' to extract the value of flags. If this command fails
for any reason, we should exit the script. Currently, some places we
continue and return 1, since we check the output against the string
'true'.

The to_bool helper function handles failure by checking for a valid
boolean output, so let's use that everywhere.

Change-Id: I3a5a43fef9c3d68d0db02be12b9f892c437e513d
(cherry picked from commit 89fc4fa)
  • Loading branch information
markgoddard committed Nov 10, 2023
1 parent 49ca368 commit 89994fe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dev/functions
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,22 @@ function upgrade_kayobe_venv {

function is_deploy_image_built_locally {
ipa_build_images=$(kayobe configuration dump --host controllers[0] --var-name ipa_build_images)
[[ $ipa_build_images =~ ^true$ ]]
to_bool "$ipa_build_images"
}

function is_ironic_enabled {
ironic_enabled=$(kayobe configuration dump --host controllers[0] --var-name kolla_enable_ironic)
[[ $ironic_enabled =~ ^true$ ]]
to_bool "$ironic_enabled"
}

function is_overcloud_host_image_built_by_dib {
overcloud_dib_build_host_images=$(kayobe configuration dump --host controllers[0] --var-name overcloud_dib_build_host_images)
[[ $overcloud_dib_build_host_images =~ ^true$ ]]
to_bool "$overcloud_dib_build_host_images"
}

function is_cinder_enabled {
flag="$(run_kayobe configuration dump --host controllers[0] --var-name kolla_enable_cinder)"
to_bool "$flag"
}

function environment_setup {
Expand Down Expand Up @@ -856,11 +861,6 @@ function to_bool {
fi
}

function is_cinder_enabled {
flag="$(run_kayobe configuration dump --host controllers[0] --var-name kolla_enable_cinder)"
to_bool "$flag"
}

function configure_iptables {
# NOTE(wszumski): adapted from the ironic devstack plugin, see:
# https://github.com/openstack/ironic/blob/36e87dc5b472d79470b783fbba9ce396e3cbb96e/devstack/lib/ironic#L2132
Expand Down

0 comments on commit 89994fe

Please sign in to comment.