Name
sn_cmp.AzureV1DiscoUpgradeUtil
Description
No description available
Script
var AzureV1DiscoUpgradeUtil = Class.create();
AzureV1DiscoUpgradeUtil.prototype = Object.extendsObject(CloudV1DiscoUpgradeUtil, {
initialize: function() {
CloudV1DiscoUpgradeUtil.prototype.initialize.call(this);
this.accountType = 'azure_subscription';
this.accountIdField = 'id';
this.regionType = 'azure_region';
this.instanceType = 'cmdb_ci_azure_vm';
this.ldcType = 'cmdb_ci_azure_datacenter';
},
upgrade: function() {
CloudV1DiscoUpgradeUtil.prototype.upgrade.call(this);
// Azure also has NICs that extends the base NIC table being reused
this.updateTable('cmdb_ci_azure_nic', 'cmdb_ci_nic');
},
getAccountId: function(gr) {
return '' + gr.subscription.id;
},
getV1Account: function(accountId) {
var sub = new GlideRecord('azure_subscription');
if (sub.get('id', accountId))
return sub;
gs.info('ERROR: Account ID not found in aws_account_admin: ' + accountId);
return null;
},
getCred: function(oldAcct) {
var gr = new GlideRecord('cloud_web_svc_acct_to_cred');
gr.addQuery('account.sys_id', '' + oldAcct.sys_id);
gr.query();
if (gr.next())
return '' + gr.credential.sys_id;
gs.info('No credentials found for account with sys_id: ' + oldAcct.sys_id);
return '';
},
type: 'AzureV1DiscoUpgradeUtil'
});
Sys ID
ab2d45d79fb13200ef3c1f80a57fcfe9