FEATURE REQUEST: Override NO_PURGE with ENSURE_ABSENT()
NO_PURGE is used to "share" a zone with someone else by not deleting any records that are not recognized. Currently if you really want to delete something you have to manually remove it. It would be nice to have a way to delete something despite the use of NO_PURGE.
Proposed syntax:
D("example.com", REG_FOO,
NO_PURGE,
ENSURE_ABSENT(A("myname", "1.2.3.4"))
)
- When
PURGEis activated, theENSURE_ABSENT()record is ignored, as if it is commented out. - When
NO_PURGEis activated, theENSURE_ABSENT()record is deleted.
Other notes:
- The TTL is not considered when comparing records.
- For providers that don't support this, a warning should be emitted.
Tom
@tlimoncelli Does this allow deleting all A records for a specific name, or does each A record and the relevant target IP need to be specified?
Each has to be listed. I was going to match the rec.GetLabel(), rec.Type, and rec.GetTargetField(); but not TTL or other fields like the MX priority.
I personally don't have any need for this functionality, but allowing to match only on getLabel and rec.Type might make this feature more useful.
Yeah, I can see that. Right now the use case is that if you had an existing record in dnsconfig.js, you can just wrap ENSURE_ABSENT( old_record ) around it and be assured it is deleted. Adding the functionality you describe later won't be too difficult
Of course, right now I'm in a situation where I don't know enough Javascript to get the syntax working. It works as:
A(x, y, ENSURE_ABSENT_REC())
But I can't figure out how to have it as a wrapper:
ENSURE_ABSENT(A(x, y))
(I hope you agree the 2nd one is a lot nicer!)