From 007ce91c558d4f815ea2659c6d98c0caf35553a8 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Thu, 22 Jan 2015 12:29:06 +1300 Subject: [PATCH] Expose stack_user_project_id in stack-show stack_user_project_id is currently never exposed by heat, so the user has no way of discovering what it is. This has a couple of implications: - The user can't call the REST API create_software_deployment unless they know the stack_user_project_id of the stack that the server resource belongs to - user can't do manual cleanup of stack_user_project_id when necessary This change adds stack_user_project_id to the formatted output of the stack-show REST API call. Change-Id: I0a2d337401c164eb58dbce63e01f68f98f8d467e Closes-Bug: #1413398 --- heat/api/openstack/v1/views/stacks_view.py | 1 + heat/engine/api.py | 1 + heat/rpc/api.py | 4 ++-- heat/tests/test_engine_api_utils.py | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/heat/api/openstack/v1/views/stacks_view.py b/heat/api/openstack/v1/views/stacks_view.py index 1901723936..adc8cb358d 100644 --- a/heat/api/openstack/v1/views/stacks_view.py +++ b/heat/api/openstack/v1/views/stacks_view.py @@ -30,6 +30,7 @@ basic_keys = ( rpc_api.STACK_UPDATED_TIME, rpc_api.STACK_OWNER, rpc_api.STACK_PARENT, + rpc_api.STACK_USER_PROJECT_ID, ) diff --git a/heat/engine/api.py b/heat/engine/api.py index c59a3bf373..9a9b63b548 100644 --- a/heat/engine/api.py +++ b/heat/engine/api.py @@ -104,6 +104,7 @@ def format_stack(stack, preview=False): rpc_api.STACK_TIMEOUT: stack.timeout_mins, rpc_api.STACK_OWNER: stack.username, rpc_api.STACK_PARENT: stack.owner_id, + rpc_api.STACK_USER_PROJECT_ID: stack.stack_user_project_id, } if not preview: diff --git a/heat/rpc/api.py b/heat/rpc/api.py index 37a7a673d4..e69f1462a1 100644 --- a/heat/rpc/api.py +++ b/heat/rpc/api.py @@ -31,7 +31,7 @@ STACK_KEYS = ( STACK_PARAMETERS, STACK_OUTPUTS, STACK_ACTION, STACK_STATUS, STACK_STATUS_DATA, STACK_CAPABILITIES, STACK_DISABLE_ROLLBACK, STACK_TIMEOUT, STACK_OWNER, - STACK_PARENT + STACK_PARENT, STACK_USER_PROJECT_ID ) = ( 'stack_name', 'stack_identity', 'creation_time', 'updated_time', 'deletion_time', @@ -40,7 +40,7 @@ STACK_KEYS = ( 'parameters', 'outputs', 'stack_action', 'stack_status', 'stack_status_reason', 'capabilities', 'disable_rollback', 'timeout_mins', 'stack_owner', - 'parent' + 'parent', 'stack_user_project_id' ) STACK_OUTPUT_KEYS = ( diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py index 73c831c3a6..44ca3b07a9 100644 --- a/heat/tests/test_engine_api_utils.py +++ b/heat/tests/test_engine_api_utils.py @@ -289,6 +289,7 @@ class FormatTest(common.HeatTestCase): 'stack_owner': 'test_username', 'stack_status': 'IN_PROGRESS', 'stack_status_reason': '', + 'stack_user_project_id': None, 'template_description': 'No description', 'timeout_mins': None, 'parameters': {