This commit is contained in:
Girish Ramakrishnan
2025-01-31 09:47:31 +01:00
parent 6cd97d2cb9
commit d1da77d6bc

View File

@@ -144,14 +144,14 @@ async function upsert(domainObject, subdomain, type, values) {
const result = await getZone(domainConfig, zoneName);
// Array to keep track of records that need to be inserted
let toInsert = [];
const toInsert = [];
for (let i = 0; i < values.length; i++) {
let curValue = values[i];
const curValue = values[i];
let wasUpdate = false;
for (let j = 0; j < result.length; j++) {
let curHost = result[j];
const curHost = result[j];
if (curHost.Type === type && curHost.Name === subdomain) {
// Updating an already existing host
@@ -167,7 +167,7 @@ async function upsert(domainObject, subdomain, type, values) {
// We don't have this host at all yet, let's push to toInsert array
if (!wasUpdate) {
let newRecord = {
const newRecord = {
RecordType: type,
HostName: subdomain,
Address: curValue
@@ -226,7 +226,7 @@ async function del(domainObject, subdomain, type, values) {
const originalLength = result.length;
for (let i = 0; i < values.length; i++) {
let curValue = values[i];
const curValue = values[i];
result = result.filter(curHost => curHost.Type !== type || curHost.Name !== subdomain || curHost.Address !== curValue);
}