]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
When updating the metadata load the stack with the stored context
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 5 Mar 2013 22:45:56 +0000 (09:45 +1100)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 5 Mar 2013 22:45:56 +0000 (09:45 +1100)
bug 1144996
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Change-Id: I2b0547f4867f19f8319e2c4b79ac325ae8cd6bd8

heat/engine/service.py

index 451f26878f90817ed4cda09a7bd052d41d247f39..d84ca1750655b7992bebdcd48afe04318becae30 100644 (file)
@@ -481,11 +481,19 @@ class EngineService(service.Service):
         resource = stack[resource_name]
         resource.metadata_update(new_metadata=metadata)
 
+        # This is not "nice" converting to the stored context here,
+        # but this happens because the keystone user associated with the
+        # WaitCondition doesn't have permission to read the secret key of
+        # the user associated with the cfn-credentials file
+        user_creds = db_api.user_creds_get(s.user_creds_id)
+        stack_context = context.RequestContext.from_dict(user_creds)
+        refresh_stack = parser.Stack.load(stack_context, stack=s)
+
         # Refresh the metadata for all other resources, since we expect
         # resource_name to be a WaitCondition resource, and other
         # resources may refer to WaitCondition Fn::GetAtt Data, which
         # is updated here.
-        for res in stack:
+        for res in refresh_stack:
             if res.name != resource_name:
                 res.metadata_update()