summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-09-28 07:06:01 +0000
committerGerrit Code Review <review@openstack.org>2019-09-28 07:06:01 +0000
commitca645aba79c5da82d28f7064b5cdcbd66c798cb0 (patch)
tree9969fbb0c6023357196390da12d68a22a61ac552
parent0d564d933e600ee42844e8c9a93c379e91642d4a (diff)
parenta8fba21f238de0b5a62c97ef8571539aa0f536b5 (diff)
downloadheat-13.0.0.0rc1.tar.gz
Merge "Remove designate v1 support"13.0.0.0rc1
-rw-r--r--heat/engine/clients/os/designate.py71
-rw-r--r--heat/engine/resources/openstack/designate/domain.py108
-rw-r--r--heat/engine/resources/openstack/designate/record.py156
-rw-r--r--releasenotes/notes/change-default-designate-client-version-107de4784f8da2a6.yaml5
-rw-r--r--releasenotes/notes/remove-designate-v1-support-107de4784f8da2a6.yaml8
-rw-r--r--setup.cfg1
6 files changed, 18 insertions, 331 deletions
diff --git a/heat/engine/clients/os/designate.py b/heat/engine/clients/os/designate.py
index fc5a10b17..be0f81ee6 100644
--- a/heat/engine/clients/os/designate.py
+++ b/heat/engine/clients/os/designate.py
@@ -14,12 +14,6 @@
from designateclient import client
from designateclient import exceptions
-try:
- from designateclient.v1 import domains
- from designateclient.v1 import records
-except ImportError:
- pass
-
from heat.common import exception as heat_exception
from heat.engine.clients import client_plugin
from heat.engine import constraints
@@ -33,13 +27,9 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
service_types = [DNS] = ['dns']
- supported_versions = [V1, V2] = ['1', '2']
-
- default_version = V2
-
- def _create(self, version=default_version):
+ def _create(self):
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
- return client.Client(version=version,
+ return client.Client(version='2',
session=self.context.keystone_session,
endpoint_type=endpoint_type,
service_type=self.DNS,
@@ -48,18 +38,6 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
def is_not_found(self, ex):
return isinstance(ex, exceptions.NotFound)
- def get_domain_id(self, domain_id_or_name):
- try:
- domain_obj = self.client().domains.get(domain_id_or_name)
- return domain_obj.id
- except exceptions.NotFound:
- for domain in self.client().domains.list():
- if domain.name == domain_id_or_name:
- return domain.id
-
- raise heat_exception.EntityNotFound(entity='Designate Domain',
- name=domain_id_or_name)
-
def get_zone_id(self, zone_id_or_name):
client = self.client(version=self.V2)
try:
@@ -73,51 +51,6 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
raise heat_exception.EntityNotFound(entity='Designate Zone',
name=zone_id_or_name)
- def domain_create(self, **kwargs):
- domain = domains.Domain(**kwargs)
- return self.client().domains.create(domain)
-
- def domain_update(self, **kwargs):
- # Designate mandates to pass the Domain object with updated properties
- domain = self.client().domains.get(kwargs['id'])
- for key in kwargs.keys():
- setattr(domain, key, kwargs[key])
-
- return self.client().domains.update(domain)
-
- def record_create(self, **kwargs):
- domain_id = self.get_domain_id(kwargs.pop('domain'))
- record = records.Record(**kwargs)
- return self.client().records.create(domain_id, record)
-
- def record_update(self, **kwargs):
- # Designate mandates to pass the Record object with updated properties
- domain_id = self.get_domain_id(kwargs.pop('domain'))
- record = self.client().records.get(domain_id, kwargs['id'])
-
- for key in kwargs.keys():
- setattr(record, key, kwargs[key])
-
- return self.client().records.update(record.domain_id, record)
-
- def record_delete(self, **kwargs):
- try:
- domain_id = self.get_domain_id(kwargs.pop('domain'))
- except heat_exception.EntityNotFound:
- return
- return self.client().records.delete(domain_id,
- kwargs.pop('id'))
-
- def record_show(self, **kwargs):
- domain_id = self.get_domain_id(kwargs.pop('domain'))
- return self.client().records.get(domain_id,
- kwargs.pop('id'))
-
-
-class DesignateDomainConstraint(constraints.BaseCustomConstraint):
- resource_client_name = CLIENT_NAME
- resource_getter_name = 'get_domain_id'
-
class DesignateZoneConstraint(constraints.BaseCustomConstraint):
resource_client_name = CLIENT_NAME
diff --git a/heat/engine/resources/openstack/designate/domain.py b/heat/engine/resources/openstack/designate/domain.py
index d2d88bbf6..f12045362 100644
--- a/heat/engine/resources/openstack/designate/domain.py
+++ b/heat/engine/resources/openstack/designate/domain.py
@@ -10,128 +10,28 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-import six
from heat.common.i18n import _
-from heat.engine import attributes
-from heat.engine import constraints
-from heat.engine import properties
-from heat.engine import resource
+from heat.engine.resources.openstack.heat import none_resource
from heat.engine import support
-class DesignateDomain(resource.Resource):
+class DesignateDomain(none_resource.NoneResource):
"""Heat Template Resource for Designate Domain.
Designate provides DNS-as-a-Service services for OpenStack. So, domain
is a realm with an identification string, unique in DNS.
"""
-
support_status = support.SupportStatus(
status=support.HIDDEN,
version='10.0.0',
- message=_('Use OS::Designate::Zone instead.'),
+ message=_('This resource has been removed, use '
+ 'OS::Designate::Zone instead.'),
previous_status=support.SupportStatus(
status=support.DEPRECATED,
version='8.0.0',
previous_status=support.SupportStatus(version='5.0.0')))
- entity = 'domains'
-
- default_client_name = 'designate'
-
- PROPERTIES = (
- NAME, TTL, DESCRIPTION, EMAIL
- ) = (
- 'name', 'ttl', 'description', 'email'
- )
-
- ATTRIBUTES = (
- SERIAL,
- ) = (
- 'serial',
- )
-
- properties_schema = {
- # Based on RFC 1035, length of name is set to max of 255
- NAME: properties.Schema(
- properties.Schema.STRING,
- _('Domain name.'),
- required=True,
- constraints=[constraints.Length(max=255)]
- ),
- # Based on RFC 1035, range for ttl is set to 1 to signed 32 bit number
- TTL: properties.Schema(
- properties.Schema.INTEGER,
- _('Time To Live (Seconds).'),
- update_allowed=True,
- constraints=[constraints.Range(min=1,
- max=2147483647)]
- ),
- # designate mandates to the max length of 160 for description
- DESCRIPTION: properties.Schema(
- properties.Schema.STRING,
- _('Description of domain.'),
- update_allowed=True,
- constraints=[constraints.Length(max=160)]
- ),
- EMAIL: properties.Schema(
- properties.Schema.STRING,
- _('Domain email.'),
- update_allowed=True,
- required=True
- )
- }
-
- attributes_schema = {
- SERIAL: attributes.Schema(
- _("DNS domain serial."),
- type=attributes.Schema.STRING
- ),
- }
-
- def handle_create(self):
- args = dict((k, v) for k, v in six.iteritems(self.properties) if v)
- domain = self.client_plugin().domain_create(**args)
-
- self.resource_id_set(domain.id)
-
- def handle_update(self, json_snippet, tmpl_diff, prop_diff):
- args = dict()
-
- if prop_diff.get(self.EMAIL):
- args['email'] = prop_diff.get(self.EMAIL)
-
- if prop_diff.get(self.TTL):
- args['ttl'] = prop_diff.get(self.TTL)
-
- if prop_diff.get(self.DESCRIPTION):
- args['description'] = prop_diff.get(self.DESCRIPTION)
-
- if len(args.keys()) > 0:
- args['id'] = self.resource_id
- self.client_plugin().domain_update(**args)
-
- def _resolve_attribute(self, name):
- if self.resource_id is None:
- return
- if name == self.SERIAL:
- domain = self.client().domains.get(self.resource_id)
- return domain.serial
-
- # FIXME(kanagaraj-manickam) Remove this method once designate defect
- # 1485552 is fixed.
- def _show_resource(self):
- return dict(self.client().domains.get(self.resource_id).items())
-
- def parse_live_resource_data(self, resource_properties, resource_data):
- domain_reality = {}
-
- for key in self.PROPERTIES:
- domain_reality.update({key: resource_data.get(key)})
-
- return domain_reality
-
def resource_mapping():
return {
diff --git a/heat/engine/resources/openstack/designate/record.py b/heat/engine/resources/openstack/designate/record.py
index 675e03810..4bf8f2096 100644
--- a/heat/engine/resources/openstack/designate/record.py
+++ b/heat/engine/resources/openstack/designate/record.py
@@ -11,16 +11,12 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from heat.common.i18n import _
-from heat.engine import constraints
-from heat.engine import properties
-from heat.engine import resource
+from heat.engine.resources.openstack.heat import none_resource
from heat.engine import support
-class DesignateRecord(resource.Resource):
+class DesignateRecord(none_resource.NoneResource):
"""Heat Template Resource for Designate Record.
Designate provides DNS-as-a-Service services for OpenStack. Record is
@@ -31,157 +27,13 @@ class DesignateRecord(resource.Resource):
support_status = support.SupportStatus(
status=support.HIDDEN,
version='10.0.0',
- message=_('Use OS::Designate::RecordSet instead.'),
+ message=_('This resource has been removed, use '
+ 'OS::Designate::RecordSet instead.'),
previous_status=support.SupportStatus(
status=support.DEPRECATED,
version='8.0.0',
previous_status=support.SupportStatus(version='5.0.0')))
- entity = 'records'
-
- default_client_name = 'designate'
-
- PROPERTIES = (
- NAME, TTL, DESCRIPTION, TYPE, DATA, PRIORITY, DOMAIN
- ) = (
- 'name', 'ttl', 'description', 'type', 'data', 'priority', 'domain'
- )
-
- _ALLOWED_TYPES = (
- A, AAAA, CNAME, MX, SRV, TXT, SPF,
- NS, PTR, SSHFP, SOA
- ) = (
- 'A', 'AAAA', 'CNAME', 'MX', 'SRV', 'TXT', 'SPF',
- 'NS', 'PTR', 'SSHFP', 'SOA'
- )
-
- properties_schema = {
- # Based on RFC 1035, length of name is set to max of 255
- NAME: properties.Schema(
- properties.Schema.STRING,
- _('Record name.'),
- required=True,
- constraints=[constraints.Length(max=255)]
- ),
- # Based on RFC 1035, range for ttl is set to 1 to signed 32 bit number
- TTL: properties.Schema(
- properties.Schema.INTEGER,
- _('Time To Live (Seconds).'),
- update_allowed=True,
- constraints=[constraints.Range(min=1,
- max=2147483647)]
- ),
- # designate mandates to the max length of 160 for description
- DESCRIPTION: properties.Schema(
- properties.Schema.STRING,
- _('Description of record.'),
- update_allowed=True,
- constraints=[constraints.Length(max=160)]
- ),
- TYPE: properties.Schema(
- properties.Schema.STRING,
- _('DNS Record type.'),
- update_allowed=True,
- required=True,
- constraints=[constraints.AllowedValues(
- _ALLOWED_TYPES
- )]
- ),
- DATA: properties.Schema(
- properties.Schema.STRING,
- _('DNS record data, varies based on the type of record. For more '
- 'details, please refer rfc 1035.'),
- update_allowed=True,
- required=True
- ),
- # Based on RFC 1035, range for priority is set to 0 to signed 16 bit
- # number
- PRIORITY: properties.Schema(
- properties.Schema.INTEGER,
- _('DNS record priority. It is considered only for MX and SRV '
- 'types, otherwise, it is ignored.'),
- update_allowed=True,
- constraints=[constraints.Range(min=0,
- max=65536)]
- ),
- DOMAIN: properties.Schema(
- properties.Schema.STRING,
- _('DNS Domain id or name.'),
- required=True,
- constraints=[constraints.CustomConstraint('designate.domain')]
- ),
- }
-
- def handle_create(self):
- args = dict(
- name=self.properties[self.NAME],
- type=self.properties[self.TYPE],
- description=self.properties[self.DESCRIPTION],
- ttl=self.properties[self.TTL],
- data=self.properties[self.DATA],
- # priority is considered only for MX and SRV record.
- priority=(self.properties[self.PRIORITY]
- if self.properties[self.TYPE] in (self.MX, self.SRV)
- else None),
- domain=self.properties[self.DOMAIN]
- )
-
- domain = self.client_plugin().record_create(**args)
-
- self.resource_id_set(domain.id)
-
- def handle_update(self, json_snippet, tmpl_diff, prop_diff):
- args = dict()
-
- if prop_diff.get(self.TTL):
- args['ttl'] = prop_diff.get(self.TTL)
-
- if prop_diff.get(self.DESCRIPTION):
- args['description'] = prop_diff.get(self.DESCRIPTION)
-
- if prop_diff.get(self.TYPE):
- args['type'] = prop_diff.get(self.TYPE)
-
- # priority is considered only for MX and SRV record.
- if prop_diff.get(self.PRIORITY):
- args['priority'] = (prop_diff.get(self.PRIORITY)
- if (prop_diff.get(self.TYPE) or
- self.properties[self.TYPE]) in
- (self.MX, self.SRV)
- else None)
-
- if prop_diff.get(self.DATA):
- args['data'] = prop_diff.get(self.DATA)
-
- if len(args.keys()) > 0:
- args['id'] = self.resource_id
- args['domain'] = self.properties[self.DOMAIN]
- self.client_plugin().record_update(**args)
-
- def handle_delete(self):
- if self.resource_id is not None:
- with self.client_plugin().ignore_not_found:
- self.client_plugin().record_delete(
- id=self.resource_id,
- domain=self.properties[self.DOMAIN]
- )
-
- # FIXME(kanagaraj-manickam) Remove this method once designate defect
- # 1485552 is fixed.
- def _show_resource(self):
- kwargs = dict(domain=self.properties[self.DOMAIN],
- id=self.resource_id)
- return dict(six.iteritems(self.client_plugin().record_show(**kwargs)))
-
- def parse_live_resource_data(self, resource_properties, resource_data):
- record_reality = {}
-
- properties_keys = list(set(self.PROPERTIES) - {self.NAME, self.DOMAIN})
- for key in properties_keys:
- record_reality.update({key: resource_data.get(key)})
-
- return record_reality
-
def resource_mapping():
return {
diff --git a/releasenotes/notes/change-default-designate-client-version-107de4784f8da2a6.yaml b/releasenotes/notes/change-default-designate-client-version-107de4784f8da2a6.yaml
deleted file mode 100644
index e9c5bfea3..000000000
--- a/releasenotes/notes/change-default-designate-client-version-107de4784f8da2a6.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-upgrade:
- - |
- Designate client already removed support for designate V1. We now switch
- default version for designate client plugin from V1 to V2. \ No newline at end of file
diff --git a/releasenotes/notes/remove-designate-v1-support-107de4784f8da2a6.yaml b/releasenotes/notes/remove-designate-v1-support-107de4784f8da2a6.yaml
new file mode 100644
index 000000000..07a06aa85
--- /dev/null
+++ b/releasenotes/notes/remove-designate-v1-support-107de4784f8da2a6.yaml
@@ -0,0 +1,8 @@
+---
+upgrade:
+ - |
+ Designate project had removed v1 api support since stable/queens.
+ Heat has now removed support for v1 resources ``OS::Designate::Domain``
+ and ``OS::Designate::Record`` completely and replaced them with
+ placeholders for existing templates with those resources. The
+ ``designate.domain`` custom constraint has also been removed.
diff --git a/setup.cfg b/setup.cfg
index 0568c8e62..319e8d16c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -113,7 +113,6 @@ heat.constraints =
cinder.snapshot = heat.engine.clients.os.cinder:VolumeSnapshotConstraint
cinder.volume = heat.engine.clients.os.cinder:VolumeConstraint
cinder.vtype = heat.engine.clients.os.cinder:VolumeTypeConstraint
- designate.domain = heat.engine.clients.os.designate:DesignateDomainConstraint
designate.zone = heat.engine.clients.os.designate:DesignateZoneConstraint
glance.image = heat.engine.clients.os.glance:ImageConstraint
keystone.domain = heat.engine.clients.os.keystone.keystone_constraints:KeystoneDomainConstraint