From 23c5f832354d124e9ab0417bea72dfea894916c0 Mon Sep 17 00:00:00 2001 From: Tee Ngo Date: Fri, 23 Nov 2018 17:06:51 -0500 Subject: [PATCH] Properly check if OpenStack is installed Now that sysinv-armada integration is already in place, switch to the proper way to check if OpenStack application is installed. Tests conducted: - Verify that the check fails if the app does not exist or not in 'applied' state, succeeds otherwise. Story: 2003910 Task: 27852 Change-Id: I04b287ae6c507d100cf40de61d0ed4eca762f8e3 Signed-off-by: Tee Ngo --- sysinv/sysinv/sysinv/sysinv/common/utils.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/common/utils.py b/sysinv/sysinv/sysinv/sysinv/common/utils.py index 605afffc4c..fff105a6fa 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/common/utils.py @@ -57,7 +57,6 @@ from oslo_config import cfg from sysinv.common import exception from sysinv.common import constants -from sysinv.helm import common as helm_common from sysinv.openstack.common import log as logging from sysinv.openstack.common.gettextutils import _ from oslo_concurrency import lockutils @@ -1810,12 +1809,11 @@ def extract_tarfile(target_dir, tarfile): def is_openstack_installed(dbapi): """ Checks whether the OpenStack application is installed. """ - # TODO(Bart): When the sysinv/armada integration is complete, this will - # be updated to check the status of the openstack application. - controller_0 = dbapi.ihost_get_by_hostname(constants.CONTROLLER_0_HOSTNAME) - labels = dbapi.label_get_all(hostid=controller_0.id) - for label in labels: - if label.label_key == helm_common.LABEL_CONTROLLER and \ - label.label_value == helm_common.LABEL_VALUE_ENABLED: + try: + openstack_app = dbapi.kube_app_get(constants.HELM_APP_OPENSTACK) + if openstack_app.status == constants.APP_APPLY_SUCCESS: return True - return False + else: + return False + except exception.KubeAppNotFound: + return False