-
Notifications
You must be signed in to change notification settings - Fork 22
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
DNS Record Support for Bloxone Ansible v2 #46
base: v2
Are you sure you want to change the base?
Conversation
… and dns_record_info modules
Co-authored-by: Ujjwal Nasra <[email protected]>
… into dns_records
plugins/modules/dns_record.py
Outdated
description: | ||
- "The DNS resource record type-specific non-protocol options." | ||
- "Valid value for I(A) (Address) and I(AAAA) (IPv6 Address) records:" | ||
- "Option | Description -----------|----------------------------------------- create_ptr | A boolean flag which can be set to I(true) for POST operation to automatically create the corresponding PTR record. check_rmz | A boolean flag which can be set to I(true) for POST operation to check the existence of reverse zone for creating the corresponding PTR record. Only applicable if the I(create_ptr) option is set to I(true)." |
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.
Anstibull Docs need to be evaluated here to see how these dashes are presented in the docs.
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.
LGTM |
plugins/modules/dns_record.py
Outdated
else: | ||
update_body = self.validate_readonly_on_update(self.existing, update_body, ["type", "zone"]) |
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.
is this to handle some case for the default view?
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.
Fixed
plugins/modules/dns_record.py
Outdated
raise e | ||
else: | ||
if self.params["zone"] is not None: | ||
filter = f"zone=='{self.params['zone']}' and type=='{self.params['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.
this should also contain name_in_zone
. Ideally this should contain view
and rdata
but I understand that there is an issue in the API backend that doesn't allow filtering on those. That can be filtered manually after we get the results.
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.
Modified
plugins/modules/dns_record.py
Outdated
if self.params["name_in_zone"] is not None: | ||
filter = f"zone=='{self.params['zone']}' and type=='{self.params['type']}' and name_in_zone=='{self.params['name_in_zone']}'" | ||
else: | ||
filter = f"zone=='{self.params['zone']}' and type=='{self.params['type']}'" | ||
|
||
elif self.params["absolute_name_spec"] is not None: |
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.
as commented in the JIRA ticket, we can keep the zone,name_in_zone as the required combination. We can therefore remove absolute_name_spec and view checks from the find
function. zone
will have to be marked as required
plugins/modules/dns_record.py
Outdated
@@ -590,6 +585,9 @@ def main(): | |||
argument_spec=module_args, | |||
supports_check_mode=True, | |||
required_if=[("state", "present", ["rdata", "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.
you can add zone
here, and remove the next three criteria. absolute_name_spec effectively becomes read only, since the API will give an error, but we don't have to mark it as read only in the module for now.
No description provided.