From ef1c9e9a780d4eb41beddccd50b99123c5ca2e0c 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 16fc5a9f12..4cc7fbfdfd 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 = ( engine_api.STACK_UPDATED_TIME, engine_api.STACK_OWNER, engine_api.STACK_PARENT, + engine_api.STACK_USER_PROJECT_ID, ) diff --git a/heat/engine/api.py b/heat/engine/api.py index 1ad332acce..7e6364980e 100644 --- a/heat/engine/api.py +++ b/heat/engine/api.py @@ -102,6 +102,7 @@ def format_stack(stack, preview=False): api.STACK_TIMEOUT: stack.timeout_mins, api.STACK_OWNER: stack.username, api.STACK_PARENT: stack.owner_id, + 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 8157f0042c..6167b8d41c 100644 --- a/heat/rpc/api.py +++ b/heat/rpc/api.py @@ -32,7 +32,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', @@ -41,7 +41,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 0f69ccfc60..9468406b90 100644 --- a/heat/tests/test_engine_api_utils.py +++ b/heat/tests/test_engine_api_utils.py @@ -238,6 +238,7 @@ class FormatTest(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': {