Make IGNORE work with all providers#313
Conversation
the `differ.matchIgnored` function was comparing only with the `Name` field of `RecordConfig`. Most providers don't set `RecordConfig.Name`, only `RecordConfig.NameFQDN` and for those `IGNORE` doesn't work at all. This patch converts `IGNORE` to use `NameFQDN` instead since it seems all providers provides it.
|
Which providers don't set .Name? |
|
No Tom, that won't fix it. The problem is providers are inconsistent with how they store name/namefqdn when the create records from the api representations. Since diffing downstream has always relied on fqdn, thats the only field that has been strictly required. The validation phase won't help this, since it is the internal representation from the drivers, not the user input that is inconsistent. I think this pr is probably the easiest way to fix the issue. |
|
@tlimoncelli the quick look I had shows that those providers don't set
Most of them I think use an API that returns only FQDN, so they set the @captncraig, what would you think of computing That way all providers would fill |
|
I have to admit that I'm quite surprised. I looked at that list and said "That can't be true! I wrote some of those providers!" but, yes, you are absolutely correct. They don't set .Name. I don't understand how they could have been working all these years, other than to think that code just doesn't use the .Name field very often and our integration tests caught any problems. What I also don't understand is that when I add that validation step to the top of the Differ, it still works. That tells me that .Name is getting set somewhere. |
|
The thing that tricked me into using My coworker discovered the issue by using I think the reason your code doesn't panic is that you're testing the |
|
Yup, I agree with your analysis. Some day (maybe later this year) I want to unexport Name/NameFQDN and force everyone to use Setters/Gettings that do the right thing. However, that's going to be a big refactoring. In the meanwhile I'm going to add the Setters/Getters so that new code can use them. |
the `differ.matchIgnored` function was comparing only with the `Name` field of `RecordConfig`. Most providers don't set `RecordConfig.Name`, only `RecordConfig.NameFQDN` and for those `IGNORE` doesn't work at all. This patch converts `IGNORE` to use `NameFQDN` instead since it seems all providers provides it.
the
differ.matchIgnoredfunction was comparing only with theNamefield of
RecordConfig.Most providers don't set
RecordConfig.Name, onlyRecordConfig.NameFQDNand for those
IGNOREdoesn't work at all.This patch converts
IGNOREto useNameFQDNinstead since it seemsall providers provides it.