From 054dfa11009c992ab1f29f3ba94a0ff1872123f4 Mon Sep 17 00:00:00 2001 From: "OTSUKA, Yuanying" Date: Fri, 5 Feb 2016 14:36:41 +0900 Subject: [PATCH] Change Bay#status type to wtypes.Enum Bay status is Enum value not types.Text. This patch fixes this. Change-Id: Ice418d0d5075ade01ad173fac629763f78871f7b Closes-Bug: #1542162 --- magnum/api/controllers/v1/bay.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/magnum/api/controllers/v1/bay.py b/magnum/api/controllers/v1/bay.py index 7a40e36454..2e2211120c 100644 --- a/magnum/api/controllers/v1/bay.py +++ b/magnum/api/controllers/v1/bay.py @@ -29,6 +29,7 @@ from magnum.api import utils as api_utils from magnum.common import exception from magnum.common import policy from magnum import objects +from magnum.objects import fields class BayPatchType(types.JsonPatchType): @@ -96,13 +97,8 @@ class Bay(base.APIBase): stack_id = wsme.wsattr(wtypes.text, readonly=True) """Stack id of the heat stack""" - status = wtypes.text - """Status of the bay from the heat stack - - Possible status is one of: - 'CREATE_IN_PROGRESS', 'CREATE_FAILED', 'CREATE_COMPLETE', - 'UPDATE_IN_PROGRESS', 'UPDATE_FAILED', 'UPDATE_COMPLETE', - 'DELETE_IN_PROGRESS', 'DELETE_FAILED', 'DELETE_COMPLETE' """ + status = wtypes.Enum(str, *fields.BayStatus.ALL) + """Status of the bay from the heat stack""" status_reason = wtypes.text """Status reason of the bay from the heat stack""" @@ -159,7 +155,7 @@ class Bay(base.APIBase): master_count=1, bay_create_timeout=15, stack_id='49dc23f5-ffc9-40c3-9d34-7be7f9e34d63', - status="CREATE_COMPLETE", + status=fields.BayStatus.CREATE_COMPLETE, status_reason="CREATE completed successfully", api_address='172.24.4.3', node_addresses=['172.24.4.4', '172.24.4.5'],