godaddy: do not remove all the records of type

This commit is contained in:
Girish Ramakrishnan
2022-04-28 17:43:10 -07:00
parent 765f6d1b12
commit e097b79f65
2 changed files with 9 additions and 7 deletions
+7
View File
@@ -126,6 +126,13 @@ async function del(domainObject, location, type, values) {
debug(`del: ${name} in zone ${zoneName} of type ${type} with values ${JSON.stringify(values)}`);
const result = await get(domainObject, location, type);
if (result.length === 0) return;
const tmp = result.filter(r => !values.includes(r));
if (tmp.length) return await upsert(domainObject, location, type, tmp); // only remove 'values'
const [error, response] = await safe(superagent.del(`${GODADDY_API}/${zoneName}/records/${type}/${name}`)
.set('Authorization', `sso-key ${domainConfig.apiKey}:${domainConfig.apiSecret}`)
.timeout(30 * 1000)