rename subdomains.update to subdomains.upsert

This commit is contained in:
Girish Ramakrishnan
2016-09-05 16:41:04 -07:00
parent 4fc6eb1876
commit ecc9d1bc02
6 changed files with 12 additions and 24 deletions

View File

@@ -3,7 +3,7 @@
exports = module.exports = {
add: add,
del: del,
update: update,
upsert: upsert,
getChangeStatus: getChangeStatus,
get: get
};
@@ -69,7 +69,7 @@ function get(dnsConfig, zoneName, subdomain, type, callback) {
});
}
function update(dnsConfig, zoneName, subdomain, type, values, callback) {
function upsert(dnsConfig, zoneName, subdomain, type, values, callback) {
assert.strictEqual(typeof dnsConfig, 'object');
assert.strictEqual(typeof zoneName, 'string');
assert.strictEqual(typeof subdomain, 'string');
@@ -77,13 +77,7 @@ function update(dnsConfig, zoneName, subdomain, type, values, callback) {
assert(util.isArray(values));
assert.strictEqual(typeof callback, 'function');
get(dnsConfig, zoneName, subdomain, type, function (error, result) {
if (error) return callback(error);
if (_.isEqual(values, result)) return callback();
add(dnsConfig, zoneName, subdomain, type, values, callback);
});
add(dnsConfig, zoneName, subdomain, type, values, callback);
}
function del(dnsConfig, zoneName, subdomain, type, values, callback) {