tripleo-quickstart-extras/roles/validate-undercloud/templates/undercloud-sanity-check.sh.j2
Wes Hayutin 42d71884f9 create subunit test results for the undercloud sanity check
In OpenStack health all the tests are marked as failures
because by default we create a failing subunit result
for all jobs.  We need to create results for the undercloud.

Related-Bug: #1729686
Change-Id: I4850eaadc09035577cb48a367c5f482ed07b7a32
2017-11-06 22:13:32 -05:00

69 lines
1.9 KiB
Django/Jinja

### --start_docs
## Validate the undercloud installation
## ====================================
script_return_value=0
## * Install deps for subunit results
sudo yum install -y python-os-testr
## * Set the uri of TripleO UI based on SSL usage
## ::
{% set ui_uri = "https://%s" % undercloud_network_cidr|nthhost(2) if undercloud_generate_service_certificate|bool else "http://%s:3000" % undercloud_network_cidr|nthhost(1) %}
## * Specify the function to test UI
## ::
function ui_sanity_check {
if [ -f "/etc/httpd/conf.d/25-tripleo-ui.conf" ]; then
if ! curl {{ ui_uri }} 2>/dev/null | grep -q 'TripleO'; then
echo "ERROR: TripleO UI front page is not loading."
generate-subunit $(date +%s) 10 fail tripleo_ui_test >> {{ working_dir }}/undercloud_sanity.subunit
script_return_value=1
fi
generate-subunit $(date +%s) 10 success tripleo_ui_test >> {{ working_dir }}/undercloud_sanity.subunit
fi
}
# * Specify the function to test CLI
## ::
function citest {
test_name=`sed 's/ /_/g' <<< "$@"`
"$@"
local status=$?
if [ $status -ne 0 ]; then
echo "error with $1" >&2
generate-subunit $(date +%s) 10 fail $test_name >> {{ working_dir }}/undercloud_sanity.subunit
script_return_value=1
else
generate-subunit $(date +%s) 10 success $test_name >> {{ working_dir }}/undercloud_sanity.subunit
fi
return $status
}
## * Check the answers from each undercloud service
## ::
set -x
rm -f {{ working_dir }}/undercloud_sanity.subunit.gz
rm -f {{ working_dir }}/undercloud_sanity.subunit
source {{ working_dir}}/stackrc
citest openstack user list
citest openstack catalog list
citest nova service-list
citest glance image-list
citest neutron subnet-list
citest neutron net-list
citest neutron agent-list
citest ironic node-list
citest openstack stack list
ui_sanity_check
exit $script_return_value
set +x
### --stop_docs