Skip to content

Commit 86a1981

Browse files
Merge pull request #1514 from getting2vinod/topic-v4.1.2-dev-failed-bots-view
Fixed multiple aws key issue
2 parents 7139c6f + 0e65f1e commit 86a1981

File tree

5 files changed

+84
-47
lines changed

5 files changed

+84
-47
lines changed

server/app/lib/utils/masterUtil.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2617,7 +2617,8 @@ var MasterUtil = function () {
26172617
});
26182618
};
26192619
this.getSensuCookbooks = function(){
2620-
var cookbooks = ['recipe[sensu-client]','recipe[sensu_check_load]','recipe[sensu_check_disk]','recipe[sensu_check_cpu]','recipe[sensu_check_memory]','recipe[consul-client-demo]'];
2620+
//var cookbooks = ['recipe[sensu-client]','recipe[sensu_check_load]','recipe[sensu_check_disk]','recipe[sensu_check_cpu]','recipe[sensu_check_memory]','recipe[consul-client-demo]'];
2621+
var cookbooks = ['recipe[sensu-client]','recipe[consul-client-demo]','recipe[cft-rlc-demo]'];
26212622
return cookbooks;
26222623
};
26232624

server/app/model/blueprint/blueprint-types/cloud-formation-blueprint/cloud-formation-blueprint.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,29 @@ CloudFormationBlueprintSchema.methods.launch = function (launchParams, callback)
785785
}
786786
if(launchParams.orgName)
787787
{
788-
launchParams.monitor.parameters.orgName = launchParams.orgName;
788+
var orgNameString = launchParams.orgName;
789+
if(Array.isArray(orgNameString))
790+
orgNameString = orgNameString[0];
791+
launchParams.monitor.parameters.orgName = orgNameString;
792+
//Adding to sensu-client cookbook attribute.
793+
jsonAttributes['sensu-client'] = {
794+
"check-tenant-id": orgNameString
795+
}
789796
}
790797
//jsonAttributes['sensu-client'] = masterUtil.getSensuCookbookAttributes(launchParams.monitor, instance.id);
791798
//Changed based on new sensu and consul server configurations.
792799
jsonAttributes['consul-client-demo'] = masterUtil.getSensuCookbookAttributes(launchParams.monitor, instance.id);
793800
}
801+
//Adding ipAddress to Attributes of all instances. Required only for the demo cookbook
802+
var ipAddresses = [];
803+
for (var x = 0; x < instances.length; x++) {
804+
ipAddresses.push(instances[x].PrivateIpAddress);
805+
}
806+
ipAddresses = ipAddresses.join(',');
807+
jsonAttributes['cft-rlc-demo'] = {
808+
"ipAddresses":ipAddresses
809+
}
810+
logger.debug('Attributes: ', JSON.stringify(jsonAttributes));
794811

795812
logger.debug("runlist: ", JSON.stringify(runlist));
796813
launchParams.infraManager.bootstrapInstance({

server/app/services/blueprintService.js

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -407,49 +407,52 @@ blueprintService.launch = function launch(blueprintId,reqBody, callback) {
407407
Array.isArray(instId) ? instanceXId = instId[0] : instanceXId=results.id
408408
var instancePollObject = setInterval(()=> {
409409
instancesDao.getInstanceById(instanceXId, (err, resultx)=> {
410-
if(err) cbx(err)
411-
else{
412-
var result = resultx[0]
413-
if(result.instanceState === 'running' && !jobDone)
414-
{
415-
logger.info('Blueprint succesfully launched and bootstrapped')
416-
jobDone = true
417-
clearInterval(instancePollObject)
418-
async.each(result.appUrls, (urlObj, cb)=> {
419-
var hcUrl = urlObj.url
420-
var hcMod = hcUrl.replace('$host',result.instanceIP)
421-
logger.info('HEALTH CHECK URL '+ hcMod)
422-
var intervalBusService = setInterval(()=> {
423-
commandCentre.createBusinessService(hcMod, result.chefNodeName, result.chefNodeName, result.chefNodeName, (error, res) => {
424-
425-
if(!error){
426-
clearInterval(intervalBusService)
427-
logger.info('Business service event in DBoard triggered successfully for '+ result.instanceIP)
428-
cb()
429-
}
430-
else{
431-
logger.info(JSON.stringify(error))
432-
}
433-
})
434-
}, 3000, 5)
435-
}, (err)=> {
436-
if(!err){
437-
logger.info('Business Services set created successfully')
438-
}
439-
else{
440-
logger.info('No response from Command Center. Giving Up')
441-
}
442-
})
443-
}
444-
else if (result.instanceState === 'failed'){
445-
jobDone = true
446-
logger.info('Blueprint launch failed')
447-
logger.info(result.body)
448-
clearInterval(instancePollObject)
449-
}
450-
}
451-
})
452-
}, 10000)
410+
if(err) cbx(err)
411+
else {
412+
var result = resultx[0];
413+
if(result){
414+
if (result.instanceState) {
415+
416+
if (result.instanceState === 'running' && !jobDone) {
417+
logger.info('Blueprint succesfully launched and bootstrapped')
418+
jobDone = true
419+
clearInterval(instancePollObject)
420+
async.each(result.appUrls, (urlObj, cb) => {
421+
var hcUrl = urlObj.url
422+
var hcMod = hcUrl.replace('$host', result.instanceIP)
423+
logger.info('HEALTH CHECK URL ' + hcMod)
424+
var intervalBusService = setInterval(() => {
425+
commandCentre.createBusinessService(hcMod, result.chefNodeName, result.chefNodeName, result.chefNodeName, (error, res) => {
426+
if (!error) {
427+
clearInterval(intervalBusService)
428+
logger.info('Business service event in DBoard triggered successfully for ' + result.instanceIP)
429+
cb()
430+
}
431+
else {
432+
logger.info(JSON.stringify(error))
433+
}
434+
})
435+
}, 3000, 5)
436+
}, (err) => {
437+
if (!err) {
438+
logger.info('Business Services set created successfully')
439+
}
440+
else {
441+
logger.info('No response from Command Center. Giving Up')
442+
}
443+
})
444+
}
445+
else if (result.instanceState === 'failed') {
446+
jobDone = true
447+
logger.info('Blueprint launch failed')
448+
logger.info(result.body)
449+
clearInterval(instancePollObject)
450+
}
451+
}
452+
}
453+
}
454+
})
455+
}, 10000)
453456
callback(null, results);
454457
return;
455458
}

server/app/services/schedulerService.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,17 @@ function startStopManagedInstance(instance,catUser,action,callback){
716716
callback(err);
717717
return;
718718
}
719-
callback(null, keyPair[0].region);
719+
//Fix for additional regions added for provider - Vinod
720+
var foundRegion = false;
721+
for(var p = 0; p < keyPair.length; p++){
722+
if(keyPair[p].region == instance.region){
723+
foundRegion = true;
724+
callback(null, keyPair[p].region);
725+
726+
}
727+
}
728+
if(!foundRegion) //to support old flow.
729+
callback(null, keyPair[0].region);
720730
});
721731
}
722732
}

server/install.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ function getDefaultsConfig() {
177177
regions: [{
178178
region_name: "US East (N. Virginia)",
179179
region: "us-east-1"
180+
},{
181+
region_name: "US East (Ohio)",
182+
region: "us-east-2"
180183
}, {
181184
region_name: "US West (Oregon)",
182185
region: "us-west-2"
@@ -249,7 +252,7 @@ function getDefaultsConfig() {
249252
NetworkOut: 'MB'
250253
},
251254
costData:{
252-
regions:['us-east-1','us-west-2','us-west-1','eu-west-1','eu-central-1','ap-southeast-1','ap-northeast-1','ap-southeast-2','sa-east-1'],
255+
regions:['us-east-1','us-east-2','us-west-2','us-west-1','eu-west-1','eu-central-1','ap-southeast-1','ap-northeast-1','ap-southeast-2','sa-east-1'],
253256
productName1:['Amazon Elastic Compute Cloud','Amazon RDS Service','Amazon Redshift','Amazon ElastiCache'],
254257
productName2:['Amazon CloudFront','Amazon Route 53','Amazon Simple Storage Service','Amazon Virtual Private Cloud']
255258
},
@@ -258,6 +261,9 @@ function getDefaultsConfig() {
258261
'us-east-1': {
259262
name: 'US East (N. Virginia)'
260263
},
264+
'us-east-2': {
265+
name: 'US East (Ohio)'
266+
},
261267
'us-west-1': {
262268
name: 'US West (N. California)'
263269
},

0 commit comments

Comments
 (0)