summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-15 16:34:24 +0000
committerGerrit Code Review <review@openstack.org>2017-06-15 16:34:24 +0000
commitdc1a93cbae43998aef915dec3c109a31fdb33c12 (patch)
tree3923138f207acb501e42b01e54fc5739af61a9df
parentdd284c4a3161efaad3062100ba967316ce06baad (diff)
parenta474c6d843d6fa458aa1e5053f91562be60429f2 (diff)
Merge "Clean up last mentions of Mistral environments"
-rw-r--r--releasenotes/notes/stop-using-mistral-env-779df7d21b7b3a55.yaml7
-rw-r--r--tripleoclient/v1/overcloud_deploy.py39
-rw-r--r--tripleoclient/workflows/plan_management.py18
3 files changed, 11 insertions, 53 deletions
diff --git a/releasenotes/notes/stop-using-mistral-env-779df7d21b7b3a55.yaml b/releasenotes/notes/stop-using-mistral-env-779df7d21b7b3a55.yaml
new file mode 100644
index 0000000..1757a7e
--- /dev/null
+++ b/releasenotes/notes/stop-using-mistral-env-779df7d21b7b3a55.yaml
@@ -0,0 +1,7 @@
1---
2upgrade:
3 - |
4 The environment configuration for deployments is now stored in a
5 file called ``plan-environment.yaml`` and stored in Swift with the
6 templates; Mistral is no longer used to store this data. Migration
7 of the existing plans is handled automatically.
diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py
index 164ef01..5f2fa8d 100644
--- a/tripleoclient/v1/overcloud_deploy.py
+++ b/tripleoclient/v1/overcloud_deploy.py
@@ -28,8 +28,6 @@ import yaml
28 28
29from heatclient.common import template_utils 29from heatclient.common import template_utils
30from heatclient import exc as hc_exc 30from heatclient import exc as hc_exc
31from keystoneauth1 import exceptions as keystoneauth_exc
32from mistralclient.api import base as mistralclient_base
33from osc_lib.command import command 31from osc_lib.command import command
34from osc_lib import exceptions as oscexc 32from osc_lib import exceptions as oscexc
35from osc_lib.i18n import _ 33from osc_lib.i18n import _
@@ -275,7 +273,7 @@ class DeployOvercloud(command.Command):
275 env['resource_registry'][name] = path 273 env['resource_registry'][name] = path
276 274
277 # Parameters are removed from the environment and sent to the update 275 # Parameters are removed from the environment and sent to the update
278 # parameters action, this stores them in the Mistral environment and 276 # parameters action, this stores them in the plan environment and
279 # means the UI can find them. 277 # means the UI can find them.
280 if 'parameter_defaults' in env: 278 if 'parameter_defaults' in env:
281 params = env.pop('parameter_defaults') 279 params = env.pop('parameter_defaults')
@@ -289,49 +287,20 @@ class DeployOvercloud(command.Command):
289 # we need to manually add an environment in swift and for users 287 # we need to manually add an environment in swift and for users
290 # custom environments passed to the deploy command. 288 # custom environments passed to the deploy command.
291 # See bug: https://bugs.launchpad.net/tripleo/+bug/1623431 289 # See bug: https://bugs.launchpad.net/tripleo/+bug/1623431
292 # Update plan env while taking care to migrate it from Mistral to 290 # Update plan env.
293 # Swift.
294 swift_path = "user-environment.yaml" 291 swift_path = "user-environment.yaml"
295 self.object_client.put_object(container_name, swift_path, contents) 292 self.object_client.put_object(container_name, swift_path, contents)
296 293
297 env_missing = env_changed = False 294 env = yaml.safe_load(self.object_client.get_object(
298 try: 295 container_name, constants.PLAN_ENVIRONMENT)[1])
299 env = yaml.safe_load(self.object_client.get_object(
300 container_name, constants.PLAN_ENVIRONMENT)[1])
301 except ClientException:
302 env_missing = True
303 env = self.workflow_client.environments.get(
304 container_name).variables
305 # TODO(akrivoka): delete env from Mistral once tripleo-common
306 # change merges (https://review.openstack.org/#/c/452291/)
307 else:
308 # If the plan environment exists, the Mistral environment
309 # is superseded and should be cleaned up.
310 try:
311 self.workflow_client.environments.delete(container_name)
312 except (mistralclient_base.APIException,
313 keystoneauth_exc.http.NotFound):
314 pass
315 296
316 user_env = {'path': swift_path} 297 user_env = {'path': swift_path}
317 if user_env not in env['environments']: 298 if user_env not in env['environments']:
318 env_changed = True
319 env['environments'].append(user_env) 299 env['environments'].append(user_env)
320
321 if env_missing or env_changed:
322 yaml_string = yaml.safe_dump(env, default_flow_style=False) 300 yaml_string = yaml.safe_dump(env, default_flow_style=False)
323 self.object_client.put_object( 301 self.object_client.put_object(
324 container_name, constants.PLAN_ENVIRONMENT, yaml_string) 302 container_name, constants.PLAN_ENVIRONMENT, yaml_string)
325 303
326 # TODO(akrivoka): don't update env in Mistral once the
327 # tripleo-common change merges
328 # (https://review.openstack.org/#/c/452291/)
329 if env_missing:
330 self.workflow_client.environments.update(
331 name=container_name,
332 variables=env
333 )
334
335 def _upload_missing_files(self, container_name, files_dict, tht_root): 304 def _upload_missing_files(self, container_name, files_dict, tht_root):
336 """Find the files referenced in custom environments and upload them 305 """Find the files referenced in custom environments and upload them
337 306
diff --git a/tripleoclient/workflows/plan_management.py b/tripleoclient/workflows/plan_management.py
index 6d2d1bf..672df48 100644
--- a/tripleoclient/workflows/plan_management.py
+++ b/tripleoclient/workflows/plan_management.py
@@ -14,8 +14,6 @@ import tempfile
14import uuid 14import uuid
15import yaml 15import yaml
16 16
17from keystoneauth1 import exceptions as keystoneauth_exc
18from mistralclient.api import base as mistralclient_base
19from swiftclient import exceptions as swift_exc 17from swiftclient import exceptions as swift_exc
20from tripleo_common.utils import swift as swiftutils 18from tripleo_common.utils import swift as swiftutils
21from tripleo_common.utils import tarball 19from tripleo_common.utils import tarball
@@ -196,22 +194,6 @@ def update_plan_from_templates(clients, name, tht_root, roles_file=None,
196 # when updating the templates. Once LP#1623431 is resolved we may 194 # when updating the templates. Once LP#1623431 is resolved we may
197 # need to special-case plan-environment.yaml to avoid this. 195 # need to special-case plan-environment.yaml to avoid this.
198 196
199 # TODO(jpichon): Remove all these references to Mistral once
200 # https://review.openstack.org/#/c/452291/ merges.
201 mistral = clients.workflow_engine
202 try:
203 mistral_env = mistral.environments.get(name)
204 except (mistralclient_base.APIException, keystoneauth_exc.http.NotFound):
205 # Plan was fully migrated, we can ignore.
206 pass
207 else:
208 mistral_env.variables['environments'] = []
209 mistral_env.variables['parameter_defaults'] = {}
210 mistral.environments.update(
211 name=name,
212 variables=mistral_env.variables
213 )
214
215 print("Uploading new plan files") 197 print("Uploading new plan files")
216 _upload_templates(swift_client, name, tht_root, roles_file) 198 _upload_templates(swift_client, name, tht_root, roles_file)
217 _update_passwords(swift_client, name, passwords) 199 _update_passwords(swift_client, name, passwords)