-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide compatibility for dns_zone module with openstack.cloud collection #105
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,13 +47,24 @@ | |
description: | ||
- Cache duration (in second) on a local DNS server | ||
type: int | ||
zone_type: | ||
type: | ||
description: | ||
- Zone Type, either public or private | ||
type: str | ||
choices: [public, private] | ||
default: public | ||
|
||
type: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. must be zone_type (as currently in openstack module) |
||
description: | ||
- Primary or secondary type. | ||
- This parameter is disabled, it only provides compatibility with openstack.cloud colection. | ||
choices: [primary, secondary] | ||
type: str | ||
masters: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you add "masters", but do not use it |
||
description: | ||
- Master nameservers (only applies if type is secondary). | ||
- This parameter is disabled, it only provides compatibility with openstack.cloud colection. | ||
type: list | ||
elements: str | ||
requirements: ["openstacksdk", "otcextensions"] | ||
''' | ||
|
||
|
@@ -95,8 +106,8 @@ | |
description: Cache duration (in second) on a local DNS server | ||
type: int | ||
sample: 300 | ||
zone_type: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think when we return result we need to explicitly rename zone_type to visibility |
||
description: Zone Type, either public or private | ||
type: | ||
description: Zone Type, either public or private. | ||
type: str | ||
sample: "private" | ||
''' | ||
|
@@ -107,7 +118,7 @@ | |
opentelekomcloud.cloud.dns_zone: | ||
name: "test.com." | ||
state: present | ||
zone_type: private | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
type: private | ||
router: 79c32783-e560-4e3a-95b1-5a0756441e12 | ||
description: test2 | ||
ttl: 5000 | ||
|
@@ -120,12 +131,14 @@ | |
class DNSZonesModule(OTCModule): | ||
argument_spec = dict( | ||
description=dict(required=False), | ||
type=dict(type='str', choices=['public', 'private'], default='public'), | ||
email=dict(required=False), | ||
name=dict(required=True), | ||
router=dict(required=False), | ||
state=dict(type='str', choices=['present', 'absent'], default='present'), | ||
ttl=dict(required=False, type='int'), | ||
zone_type=dict(type='str', choices=['public', 'private'], default='public') | ||
masters=dict(required=False, type='list', elements='str'), | ||
type=dict(required=False, choices=['primary', 'secondary'], type='str') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is "visibilty" |
||
) | ||
module_kwargs = dict( | ||
supports_check_mode=True | ||
|
@@ -135,7 +148,7 @@ def run(self): | |
changed = False | ||
attrs = {} | ||
query = { | ||
'type': self.params['zone_type'], | ||
'type': self.params['type'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
'name_or_id': self.params['name'] | ||
} | ||
|
||
|
@@ -170,7 +183,7 @@ def run(self): | |
self.exit_json(changed=True) | ||
if not needs_update: | ||
# Check if VPC exists | ||
if self.params['zone_type'] == 'private': | ||
if self.params['type'] == 'private': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. visibilty |
||
if not self.params['router']: | ||
self.exit( | ||
changed=False, | ||
|
@@ -192,8 +205,9 @@ def run(self): | |
message=('No Router found with name or id: %s' % | ||
self.params['router']) | ||
) | ||
if self.params['zone_type']: | ||
attrs['zone_type'] = self.params['zone_type'] | ||
|
||
if self.params['type']: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
attrs['type'] = self.params['type'] | ||
if self.params['description']: | ||
attrs['description'] = self.params['description'] | ||
if self.params['email']: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use "alias" for keeping it backward compatible (https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/plugins/modules/server.py#L498)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'type' means whether primary or secondary dns zone (line 56), did you mean alias 'type'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. Its actually a recordset that is in openstack has "recordset_type", and on our side "type". For that we should on our side rename "type" attribute into "recordset_type" and with
aliases: ['type']
provide backward compatibility.Later: Well, we actually need to drop recordset module completely and only provide routing to the openstack one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rename it not to type, but "visibility"