libdns / namecheap

MIT License
5 stars 2 forks source link

SetRecords appears to delete existing records #1

Closed anderspitman closed 3 years ago

anderspitman commented 3 years ago

Hey, thanks for implementing a Namecheap integration!

When trying it out, I noticed that any existing records that aren't included when calling SetRecords appear to be deleted. I'm not very familiar with libdns, but is that expected behavior? The Cloudflare integration doesn't seem to work this way. And my understanding of this:

https://github.com/libdns/libdns/blob/75d1f505ee7f0faee2fd02953faadf69d5eaf870/libdns.go#L64

Is that existing records should be preserved.

Thanks again!

nrfox commented 3 years ago

Thanks for kicking the tires!

I believe you're right and the implementation should be updated to match the spec you linked. SetRecords should be a "create or update" operation whereas I had initially interpreted it to be a "replace" operation. Maybe @mholt can confirm? And then I'm happy to work on a patch or review one if you'd like to submit one.

mholt commented 3 years ago

Yeah, so it's like a "create or update" in that when the function returns, the inputs are now present in the zone, even if that means replacing existing records with the same name so that they match the inputs. It shouldn't, however, obliterate any other records that aren't described in the input. It should only affect records that are present in the input.

nrfox commented 3 years ago

@anderspitman This patch should fix the issue if you would like to test it out: https://github.com/libdns/namecheap/pull/2

anderspitman commented 3 years ago

@nrfox sorry this one slipped through the cracks. Unfortunately I pivoted slightly and am no longer currently focused on using libdns. I'll will probably need it later though so thanks for the fix!