Show proper error message if Heat is not present

Change-Id: I0cd5662aec4ad80d413782ad9830a9825c5abc64
This commit is contained in:
Ilya Shakhat 2017-08-09 13:42:37 +02:00
parent e84b617c53
commit fe2c09482e
2 changed files with 12 additions and 0 deletions

View File

@ -29,6 +29,7 @@ from shaker.engine import messaging
from shaker.engine import quorum as quorum_pkg
from shaker.engine import report
from shaker.engine import utils
from shaker.openstack.clients import openstack as openstack_clients
LOG = logging.getLogger(__name__)
@ -160,9 +161,13 @@ def play_scenario(message_queue, scenario):
openstack_params, cfg.CONF.flavor_name,
cfg.CONF.image_name, cfg.CONF.external_net,
cfg.CONF.dns_nameservers)
except openstack_clients.OpenStackClientException:
raise
except Exception as e:
LOG.warning('Failed to connect to OpenStack: %s. Please '
'verify parameters: %s', e, openstack_params)
# try to proceed even if OpenStack connection fails
# (in case scenario does not need it)
base_dir = os.path.dirname(scenario['file_name'])
scenario_deployment = scenario.get('deployment', {})

View File

@ -20,6 +20,10 @@ from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class OpenStackClientException(Exception):
pass
class OpenStackClient(object):
def __init__(self, openstack_params):
LOG.debug('Establishing connection to OpenStack')
@ -36,6 +40,9 @@ class OpenStackClient(object):
# heat client wants endpoint to be always set
endpoint = cloud_config.get_session_endpoint('orchestration')
if not endpoint:
raise OpenStackClientException(
'Endpoint for orchestration service is not found')
self.heat = cloud_config.get_legacy_client('orchestration',
endpoint=endpoint)