From 042bed8044207bfbbcbd43cc6da8423d1952547b Mon Sep 17 00:00:00 2001 From: rabi Date: Wed, 27 Nov 2024 13:25:48 +0530 Subject: [PATCH] Add `attributes` property to OS::Designate::Zone Task: 51416 Change-Id: Ica6626a84222057b5076c73363857831e9426e50 Signed-off-by: rabi --- heat/engine/resources/openstack/designate/zone.py | 14 ++++++++++++-- heat/tests/openstack/designate/test_zone.py | 6 +++++- .../add_attributes_property-64fafdcba5aadec7.yaml | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/add_attributes_property-64fafdcba5aadec7.yaml diff --git a/heat/engine/resources/openstack/designate/zone.py b/heat/engine/resources/openstack/designate/zone.py index fd11e925b5..3331441c1e 100644 --- a/heat/engine/resources/openstack/designate/zone.py +++ b/heat/engine/resources/openstack/designate/zone.py @@ -32,9 +32,11 @@ class DesignateZone(resource.Resource): version='8.0.0') PROPERTIES = ( - NAME, TTL, DESCRIPTION, EMAIL, TYPE, PRIMARIES, MASTERS + NAME, TTL, DESCRIPTION, EMAIL, TYPE, PRIMARIES, + MASTERS, ATTRS, ) = ( - 'name', 'ttl', 'description', 'email', 'type', 'primaries', 'masters' + 'name', 'ttl', 'description', 'email', 'type', 'primaries', + 'masters', 'attributes', ) ATTRIBUTES = ( @@ -103,6 +105,14 @@ class DesignateZone(resource.Resource): 'Mandatory for zone type SECONDARY, otherwise ignored.'), update_allowed=True ), + ATTRS: properties.Schema( + properties.Schema.MAP, + _('Key:Value pairs of information about this zone, ' + 'and the pool the user would like to place the zone in. ' + 'This information can be used by the scheduler to place ' + 'zones on the correct pool.'), + support_status=support.SupportStatus(version='24.0.0') + ), } attributes_schema = { diff --git a/heat/tests/openstack/designate/test_zone.py b/heat/tests/openstack/designate/test_zone.py index 725ceedff2..7c548aeb92 100644 --- a/heat/tests/openstack/designate/test_zone.py +++ b/heat/tests/openstack/designate/test_zone.py @@ -32,6 +32,9 @@ sample_template = { 'name': 'test-zone.com', 'description': 'Test zone', 'ttl': 3600, + 'attributes': { + 'tier': 'gold', 'ha': 'true' + }, 'email': 'abc@test-zone.com', 'type': 'PRIMARY', 'masters': [] @@ -108,7 +111,8 @@ class DesignateZoneTest(common.HeatTestCase): description='Test zone', ttl=3600, email='abc@test-zone.com', - type_='PRIMARY' + type_='PRIMARY', + attributes=dict(tier='gold', ha='true') ) mock_zone_create.assert_called_once_with(**args) diff --git a/releasenotes/notes/add_attributes_property-64fafdcba5aadec7.yaml b/releasenotes/notes/add_attributes_property-64fafdcba5aadec7.yaml new file mode 100644 index 0000000000..31dcd0bc31 --- /dev/null +++ b/releasenotes/notes/add_attributes_property-64fafdcba5aadec7.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Added ``attributes`` property to resource type + ``OS::Designate::Zone``. It can be any key:value + pairs of information about this zone including the + pool where the user wants to place the zone used + by scheduler.