From aabd6e639e81fdf56a4967098a8c0e0c0fe2fa50 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Tue, 13 Feb 2018 12:27:51 +0000 Subject: [PATCH] Catch APIException exceptions raised by Mistral In the change to keystone sessions and Mistral client 3.2.0 the exception raised when fetching an environment that doesn't exist changed. This adds the new exception but continues to catch the previous one. Closes-Bug: #1749186 Change-Id: I304547b9ecabe4e387339c8561bbae8651cd9db6 --- instack_undercloud/undercloud.py | 3 ++- .../notes/fix-mistral-error-handling-58010a43f53ded5e.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-mistral-error-handling-58010a43f53ded5e.yaml diff --git a/instack_undercloud/undercloud.py b/instack_undercloud/undercloud.py index 750fa4bc2..f533ded59 100644 --- a/instack_undercloud/undercloud.py +++ b/instack_undercloud/undercloud.py @@ -38,6 +38,7 @@ from keystoneauth1 import exceptions as ks_exceptions from keystoneclient import discover import keystoneauth1.identity.generic as ks_auth from mistralclient.api import client as mistralclient +from mistralclient.api import base as mistralclient_exc from novaclient import client as novaclient from novaclient import exceptions import os_client_config @@ -1763,7 +1764,7 @@ def _create_mistral_config_environment(instack_env, mistral): env_name = 'tripleo.undercloud-config' try: env_data = mistral.environments.get(env_name).variables - except ks_exceptions.NotFound: + except (ks_exceptions.NotFound, mistralclient_exc.APIException): # If the environment is not created, we need to # create it with the information in config_data mistral.environments.create( diff --git a/releasenotes/notes/fix-mistral-error-handling-58010a43f53ded5e.yaml b/releasenotes/notes/fix-mistral-error-handling-58010a43f53ded5e.yaml new file mode 100644 index 000000000..3e90c29a8 --- /dev/null +++ b/releasenotes/notes/fix-mistral-error-handling-58010a43f53ded5e.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed an incompatability with mistralclient 3.2.0, where a different + exception type was raised and thus not handled during the undercloud + install post config. See #1749186