-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
FreeIPA: Add SRV and MX record types to ipa_dnsrecord #42482
Conversation
@synical Thanks for the contribution. I will test and let you know the review. |
@synical I tested code and it works fine. Could you please add example of SRV record in EXAMPLE section as SRV requires 'Priority Weight Port Target' as a value |
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.
see in-line comments
@Akasurde thanks, I've pushed up a commit with the requested changes |
@synical Thanks. MX record is also easy I guess. |
@Akasurde yeah I would imagine so. Want that on this PR and a rename or in a separate PR? |
@synical I would prefer in this same PR and renaming title. |
This comment has been minimized.
This comment has been minimized.
@Akasurde added the change for MX records. Same idea as before. I did notice that if I use the develop version of this file with these changes the record_ttl is mandatory (IPA complains it's not an int if missing) and that "state: present" results in an error if the record already exists. I don't think I got those on the 2.6 version of code with these changes. Would you be able to test? |
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.
I just tested this patch too; SRV records seem to work as expected.
However, I'm getting an error with your MX example but I haven't dug into exactly why yet:
fatal: [vagrant-cms-freeipa-01]: FAILED! => {"changed": false, "msg": "response dnsrecord_add: no modifications to be performed"}
Additionally, I'm seeing your TTL issue as well. We added that in recently: #41768
(note: the MX error occurs when the record already exists, so that leads me to believe something is off with the diff) |
@fxfitz yeah I hit this too. Was wondering how "state: present" works as I figured that option should handle this? Unless you hit this issue the first time you create the record? |
@fxfitz @Akasurde apologies for the delay. Managed to get this working with the changes in the latest commit. As per the links @jamescassell shared, looks like when searching for the @ record dnsrecord_find won't be able to find the record. I added a method for dnsrecord_show and call it only when the record name is equal to "@" to handle this case. This might not be the best approach, but interested to see if this works for others when testing. I managed to add a new MX record, modify it and delete it using this code. |
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.
Looks good. Thanks for adding this feature!
@@ -161,6 +161,9 @@ def __init__(self, module, host, port, protocol): | |||
def dnsrecord_find(self, zone_name, record_name): | |||
return self._post_json(method='dnsrecord_find', name=zone_name, item={'idnsname': record_name, 'all': 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.
could you alternatively use a ternary operation to change the method to dnsrecord_find within the local dnsrecord_find() function only if record_name=="@"? Presumably this would be wanted for any attempt to access the '@' record... But I'll defer to those with more experience in this project and python.
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.
Any chance of getting movement on this one? |
@jamescassell I'm happy to make any changes required RE my last comment, not sure who is best to make the decision there? |
Can you add it to the core meeting agenda and show up to discuss it? ansible/community#450 I'd love to see this merged in time for 2.8; freeze is a few weeks away. |
@synical Could you please update PR as per @jamescassell's suggestion and let me know? Thanks. |
Thanks @Akasurde @jamescassell I pushed a commit. Is this what you were thinking of? |
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
The test
|
Looks great! That way the workaround is inherited for all three uses of the function. |
* Add dnsrecord_show method for supporting base domain record * Replace dnsrecord_show with conditional in dnsrecord_find * Added changelog entry for MX and SRV Signed-off-by: synical <sjohnsondot@gmail.com>
10ea47d
to
38bf018
Compare
@synical Thanks for the contribution and patients. @fxfitz @jamescassell @achinthagunasekara Thanks for the reviews. |
SUMMARY
Found myself having to template shell scripts to add SRV records, figured would try to add to the ipa_dnsrecord module to make first class. Seems it was pretty straight forward, tested it out and worked as expected. Unclear if there are any other changes required that I am missing?
ISSUE TYPE
COMPONENT NAME
ipa_dnsrecord
ANSIBLE VERSION
ADDITIONAL INFORMATION