dev: Improve error checking for config check functions

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
This commit is contained in:
Mark Goddard 2023-05-24 14:44:55 +01:00
parent d80189611a
commit 89fc4fa279
1 changed files with 8 additions and 8 deletions

View File

@ -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 {
@ -854,11 +859,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