diff --git a/openstack/orchestration/v1/stack_template.py b/openstack/orchestration/v1/stack_template.py index 35b2db4cb..7dace49a5 100644 --- a/openstack/orchestration/v1/stack_template.py +++ b/openstack/orchestration/v1/stack_template.py @@ -42,3 +42,14 @@ class StackTemplate(resource.Resource): #: Key and value pairs that contain definition of resources in the #: template resources = resource.Body('resources', type=dict) + # List parameters grouped. + parameter_groups = resource.Body('parameter_groups', type=list) + # Restrict conditions. + conditions = resource.Body('conditions', type=dict) + + def to_dict(self): + mapping = super(StackTemplate, self).to_dict() + mapping.pop('location') + mapping.pop('id') + mapping.pop('name') + return mapping diff --git a/openstack/tests/unit/orchestration/v1/test_stack_template.py b/openstack/tests/unit/orchestration/v1/test_stack_template.py index 592d644ee..7f927081e 100644 --- a/openstack/tests/unit/orchestration/v1/test_stack_template.py +++ b/openstack/tests/unit/orchestration/v1/test_stack_template.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import copy import testtools from openstack.orchestration.v1 import stack_template @@ -53,3 +54,13 @@ class TestStackTemplate(testtools.TestCase): self.assertEqual(FAKE['outputs'], sot.outputs) self.assertEqual(FAKE['parameters'], sot.parameters) self.assertEqual(FAKE['resources'], sot.resources) + + def test_to_dict(self): + fake_sot = copy.deepcopy(FAKE) + fake_sot['parameter_groups'] = [{ + "description": "server parameters", + "parameters": ["key_name", "image_id"], + "label": "server_parameters"}] + fake_sot['conditions'] = {"cd1": True} + sot = stack_template.StackTemplate(**fake_sot) + self.assertEqual(fake_sot, sot.to_dict())