diff --git a/client/htmls/private/ajax/Settings/CreateBitbucketConfig.html b/client/htmls/private/ajax/Settings/CreateBitbucketConfig.html
new file mode 100644
index 000000000..dc82a147d
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/CreateBitbucketConfig.html
@@ -0,0 +1,161 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/CreateFunctionalTestConfig.html b/client/htmls/private/ajax/Settings/CreateFunctionalTestConfig.html
new file mode 100644
index 000000000..456c3136d
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/CreateFunctionalTestConfig.html
@@ -0,0 +1,161 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/CreateJiraConfig.html b/client/htmls/private/ajax/Settings/CreateJiraConfig.html
new file mode 100644
index 000000000..fc73c523c
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/CreateJiraConfig.html
@@ -0,0 +1,162 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/CreateOctopusConfig.html b/client/htmls/private/ajax/Settings/CreateOctopusConfig.html
new file mode 100644
index 000000000..f6ba4fc35
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/CreateOctopusConfig.html
@@ -0,0 +1,167 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/bitBucketConfigList.html b/client/htmls/private/ajax/Settings/bitBucketConfigList.html
new file mode 100644
index 000000000..cc75f11dd
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/bitBucketConfigList.html
@@ -0,0 +1,120 @@
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/functionalTestConfigList.html b/client/htmls/private/ajax/Settings/functionalTestConfigList.html
new file mode 100644
index 000000000..e1d77175c
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/functionalTestConfigList.html
@@ -0,0 +1,120 @@
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/jiraConfigList.html b/client/htmls/private/ajax/Settings/jiraConfigList.html
new file mode 100644
index 000000000..e8d2e4d06
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/jiraConfigList.html
@@ -0,0 +1,117 @@
+
\ No newline at end of file
diff --git a/client/htmls/private/ajax/Settings/octopusConfigList.html b/client/htmls/private/ajax/Settings/octopusConfigList.html
new file mode 100644
index 000000000..a38cfcade
--- /dev/null
+++ b/client/htmls/private/ajax/Settings/octopusConfigList.html
@@ -0,0 +1,120 @@
+
\ No newline at end of file
diff --git a/client/htmls/private/index.html b/client/htmls/private/index.html
index 5e9d9d7be..34d7193c8 100644
--- a/client/htmls/private/index.html
+++ b/client/htmls/private/index.html
@@ -1137,6 +1137,34 @@
},{
"name": "organizations",
+ "text": "Bitbucket",
+ "borderColor": "#000",
+ "href": "#ajax/Settings/bitBucketConfigList.html",
+ "selectable": true,
+ "icon": "fa fa-lg fa-fw fa-bitbucket"
+
+ },{
+ "name": "organizations",
+ "text": "Octopus",
+ "borderColor": "#000",
+ "href": "#ajax/Settings/octopusConfigList.html",
+ "selectable": true,
+ "icon": "fa fa-lg fa-fw fa-code"
+ },{
+ "name": "organizations",
+ "text": "Jira",
+ "borderColor": "#000",
+ "href": "#ajax/Settings/jiraConfigList.html",
+ "selectable": true,
+ "icon": "fa fa-lg fa-fw fa-ticket"
+ },{
+ "name": "organizations",
+ "text": "QA Portal",
+ "borderColor": "#000",
+ "href": "#ajax/Settings/functionalTestConfigList.html",
+ "selectable": true,
+ "icon": "fa fa-lg fa-fw fa-check"
+ },{
"text": "Github",
"borderColor": "#000",
"href": "#ajax/Settings/githubList.html",
diff --git a/server/app/lib/utils/masterUtil.js b/server/app/lib/utils/masterUtil.js
index ca10e8105..404385801 100755
--- a/server/app/lib/utils/masterUtil.js
+++ b/server/app/lib/utils/masterUtil.js
@@ -515,6 +515,138 @@ var MasterUtil = function () {
});
}
+ // Return all Bitbucket
+ this.getBitbucket = function(orgList, callback) {
+ var bitbucketList = [];
+ var rowIds = [];
+ for (var x = 0; x < orgList.length; x++) {
+ rowIds.push(orgList[x].rowid);
+ }
+ logger.debug("org rowids: ", rowIds);
+ d4dModelNew.d4dModelBitbucketConfig.find({
+ orgname_rowid: {
+ $in: rowIds
+ }
+ }, function(err, bitbucket) {
+ if (bitbucket) {
+ configmgmtDao.getRowids(function(err, rowidlist) {
+ for (var i = 0; i < bitbucket.length; i++) {
+ if (bitbucket[i].id === '27') {
+ names = configmgmtDao.convertRowIDToValue(bitbucket[i].orgname_rowid, rowidlist)
+ bitbucket[i].orgname = names;
+ bitbucketList.push(bitbucket[i]);
+ }
+ }
+ callback(null, bitbucketList);
+ return;
+ });
+ } else {
+ callback(err, null);
+ return;
+ }
+
+ });
+ }
+
+ this.getOctopus = function(orgList, callback) {
+ var octopusList = [];
+ var rowIds = [];
+ for (var x = 0; x < orgList.length; x++) {
+ rowIds.push(orgList[x].rowid);
+ }
+ logger.debug("org rowids: ", rowIds);
+ d4dModelNew.d4dModelOctopusConfig.find({
+ orgname_rowid: {
+ $in: rowIds
+ }
+ }, function(err, octopus) {
+ if (octopus) {
+ configmgmtDao.getRowids(function(err, rowidlist) {
+ for (var i = 0; i < octopus.length; i++) {
+ if (octopus[i].id === '28') {
+ names = configmgmtDao.convertRowIDToValue(octopus[i].orgname_rowid, rowidlist)
+ octopus[i].orgname = names;
+ octopusList.push(octopus[i]);
+ }
+ }
+ callback(null, octopusList);
+ return;
+ });
+ } else {
+ callback(err, null);
+ return;
+ }
+
+ });
+ }
+
+ this.getFunctionalTest = function(orgList, callback) {
+ var functionaltestList = [];
+ var rowIds = [];
+ for (var x = 0; x < orgList.length; x++) {
+ rowIds.push(orgList[x].rowid);
+ }
+ logger.debug("org rowids: ", rowIds);
+ d4dModelNew.d4dModelFunctionalTestConfig.find({
+ orgname_rowid: {
+ $in: rowIds
+ }
+ }, function(err, functionaltest) {
+ if (functionaltest) {
+ configmgmtDao.getRowids(function(err, rowidlist) {
+ for (var i = 0; i < functionaltest.length; i++) {
+ if (functionaltest[i].id === '29') {
+ names = configmgmtDao.convertRowIDToValue(functionaltest[i].orgname_rowid, rowidlist)
+ functionaltest[i].orgname = names;
+ functionaltestList.push(functionaltest[i]);
+ }
+ }
+ callback(null, functionaltestList);
+ return;
+ });
+ } else {
+ callback(err, null);
+ return;
+ }
+
+ });
+ }
+
+ this.getJira = function(orgList, callback) {
+ var jiraList = [];
+ var rowIds = [];
+ for (var x = 0; x < orgList.length; x++) {
+ rowIds.push(orgList[x].rowid);
+ }
+ logger.debug("org rowids: ", rowIds);
+ d4dModelNew.d4dModelMastersJira.find({
+ orgname_rowid: {
+ $in: rowIds
+ }
+ }, function(err, jira) {
+ if (jira) {
+
+ configmgmtDao.getRowids(function(err, rowidlist) {
+ for (var i = 0; i < jira.length; i++) {
+ logger.debug(jira[i].id);
+ if (jira[i].id === '23') {
+
+ names = configmgmtDao.convertRowIDToValue(jira[i].orgname_rowid, rowidlist)
+ jira[i].orgname = names;
+ jiraList.push(jira[i]);
+ }
+ }
+ callback(null, jiraList);
+ return;
+ });
+ } else {
+ callback(err, null);
+ return;
+ }
+
+ });
+ }
+
// Return All Orgs specific to User
this.getActiveOrgs = function (loggedInUser, callback) {
var orgList = [];
@@ -795,12 +927,12 @@ var MasterUtil = function () {
});
}
- this.getOrgById = function (orgId, callback) {
+ this.getOrgById = function(orgId, callback) {
var orgList = [];
logger.debug("Incomming orgid: ", orgId);
d4dModelNew.d4dModelMastersOrg.find({
_id: new ObjectId(orgId)
- }, function (err, orgs) {
+ }, function(err, orgs) {
if (orgs) {
for (var i = 0; i < orgs.length; i++) {
if (orgs[i].id === '1') {
diff --git a/server/app/model/d4dmasters/configmgmt.js b/server/app/model/d4dmasters/configmgmt.js
index 2ae034284..f37afa8bc 100755
--- a/server/app/model/d4dmasters/configmgmt.js
+++ b/server/app/model/d4dmasters/configmgmt.js
@@ -109,6 +109,18 @@ function Configmgmt() {
logger.log('Exting getDBModelFromID ' + id.toString());
callback(null, 'd4dModelMastersNexusServer');
break;
+ case "27":
+ logger.log('Exting getDBModelFromID ' + id.toString());
+ callback(null, 'd4dModelBitbucketConfig');
+ break;
+ case "28":
+ logger.log('Exting getDBModelFromID ' + id.toString());
+ callback(null, 'd4dModelOctopusConfig');
+ break;
+ case "29":
+ logger.log('Exting getDBModelFromID ' + id.toString());
+ callback(null, 'd4dModelFunctionalTestConfig');
+ break;
}
};
@@ -183,6 +195,18 @@ function Configmgmt() {
logger.log('Exting getDBModelFromID ' + id.toString());
return ('nexusserver');
break;
+ case "27":
+ logger.log('Exting getDBModelFromID ' + id.toString());
+ return ('bitbucketserver');
+ break;
+ case "28":
+ logger.log('Exting getDBModelFromID ' + id.toString());
+ return ('octopusserver');
+ break;
+ case "29":
+ logger.log('Exting getDBModelFromID ' + id.toString());
+ return ('fuctionaltestserver');
+ break;
};
};
diff --git a/server/app/model/d4dmasters/d4dmastersmodelnew.js b/server/app/model/d4dmasters/d4dmastersmodelnew.js
index bcbc4899b..e5ab08d66 100755
--- a/server/app/model/d4dmasters/d4dmastersmodelnew.js
+++ b/server/app/model/d4dmasters/d4dmastersmodelnew.js
@@ -965,6 +965,163 @@ var d4dMastersJenkinsConfig = new mongoose.Schema({
});
var d4dModelJenkinsConfig = mongoose.model('d4dModelJenkinsConfig', d4dMastersJenkinsConfig, 'd4dmastersnew');
+var d4dMastersBitbucketConfig = new mongoose.Schema({
+ id: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ bitbucketname: {
+ type: String,
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ bitbucketurl: {
+ type: String,
+ required: false,
+ trim: true
+ },
+ bitbucketusername: {
+ type: String,
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ bitbucketpassword: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ orgname: {
+ type: [String],
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ orgname_rowid: {
+ type: [String],
+ trim: true
+ },
+ active: {
+ type: Boolean,
+ trim: true,
+ default: true
+ },
+ rowid: {
+ type: String,
+ required: true,
+ trim: true
+ }
+}, {
+ collection: 'd4dmastersnew'
+});
+var d4dModelBitbucketConfig = mongoose.model('d4dModelBitbucketConfig', d4dMastersBitbucketConfig, 'd4dmastersnew');
+
+var d4dMastersFunctionalTestConfig = new mongoose.Schema({
+ id: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ functionaltestname: {
+ type: String,
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ functionaltesturl: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ functionaltestdays: {
+ type: String,
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ orgname: {
+ type: [String],
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ orgname_rowid: {
+ type: [String],
+ trim: true
+ },
+ active: {
+ type: Boolean,
+ trim: true,
+ default: true
+ },
+ rowid: {
+ type: String,
+ required: true,
+ trim: true
+ }
+}, {
+ collection: 'd4dmastersnew'
+});
+var d4dModelFunctionalTestConfig = mongoose.model('d4dModelFunctionalTestConfig', d4dMastersFunctionalTestConfig, 'd4dmastersnew');
+
+
+var d4dMastersOctopusConfig = new mongoose.Schema({
+ id: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ octopusname: {
+ type: String,
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ octopusurl: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ octopuskey: {
+ type: String,
+ required: true,
+ trim: true
+
+ },
+ octopusenvs: {
+ type: String,
+ required: false,
+ trim: true
+
+ },
+
+ orgname: {
+ type: [String],
+ required: true,
+ trim: true,
+ validate: nameValidator
+ },
+ orgname_rowid: {
+ type: [String],
+ trim: true
+ },
+ active: {
+ type: Boolean,
+ trim: true,
+ default: true
+ },
+ rowid: {
+ type: String,
+ required: true,
+ trim: true
+ }
+}, {
+ collection: 'd4dmastersnew'
+});
+var d4dModelOctopusConfig = mongoose.model('d4dModelOctopusConfig', d4dMastersOctopusConfig, 'd4dmastersnew');
+
var d4dMastersProviders = new mongoose.Schema({
id: {
type: String,
@@ -1358,3 +1515,6 @@ module.exports.d4dModelMastersImages = d4dModelMastersImages;
module.exports.d4dModelMastersJira = d4dModelMastersJira;
module.exports.d4dModelMastersPuppetServer = d4dModelMastersPuppetServer;
module.exports.d4dModelMastersNexusServer = d4dModelMastersNexusServer;
+module.exports.d4dModelBitbucketConfig = d4dModelBitbucketConfig;
+module.exports.d4dModelOctopusConfig = d4dModelOctopusConfig;
+module.exports.d4dModelFunctionalTestConfig = d4dModelFunctionalTestConfig;
diff --git a/server/app/routes/v1.0/routes_d4dMastersCICD.js b/server/app/routes/v1.0/routes_d4dMastersCICD.js
new file mode 100644
index 000000000..54a244dc6
--- /dev/null
+++ b/server/app/routes/v1.0/routes_d4dMastersCICD.js
@@ -0,0 +1,524 @@
+/*
+Copyright [2016] [Relevance Lab]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+
+// This file act as a Controller which contains Settings related all end points.
+
+var d4dModel = require('_pr/model/d4dmasters/d4dmastersmodel.js');
+var d4dModelNew = require('_pr/model/d4dmasters/d4dmastersmodelnew.js');
+var usersDao = require('_pr/model/users.js');
+var fileIo = require('_pr/lib/utils/fileio');
+var uuid = require('node-uuid');
+var configmgmtDao = require('_pr/model/d4dmasters/configmgmt.js');
+var Chef = require('_pr/lib/chef');
+var Curl = require('_pr/lib/utils/curl.js');
+var appConfig = require('_pr/config');
+var logger = require('_pr/logger')(module);
+var childProcess = require('child_process');
+var exec = childProcess.exec;
+var masterUtil = require('_pr/lib/utils/masterUtil.js');
+var blueprintsDao = require('_pr/model/dao/blueprints');
+var errorResponses = require('./error_responses.js');
+var bcrypt = require('bcryptjs');
+var authUtil = require('_pr/lib/utils/authUtil.js');
+var Cryptography = require('_pr/lib/utils/cryptography');
+var Client = require('node-rest-client').Client;
+var cryptoConfig = appConfig.cryptoSettings;
+var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password);
+var waitForPort = require('wait-for-port');
+var parser = require('xml2json');
+var util = require('util');
+var Task = require('_pr/model/classes/tasks/tasks.js');
+var async = require('async');
+var appDeployPipelineService = require('_pr/services/appDeployPipelineService');
+
+
+module.exports.setRoutes = function(app) {
+
+ //app.all('/d4dMasters/*', sessionVerification);
+
+
+
+ app.get('/d4dMastersCICD/readmasterjsonnew/:id', function(req, res) {
+ logger.debug("Enter get() for /d4dMastersCICD/readmasterjsonnew/%s", req.params.id);
+// logger.debug("Logged in user: ", );
+ logger.debug("incomming id: ", req.params.id);
+ var loggedInUser = 'superadmin';
+ masterUtil.getLoggedInUser(loggedInUser, function(err, anUser) {
+ if (err) {
+ res.status(500).send("Failed to fetch User.");
+ return;
+ }
+ if (!anUser) {
+ res.status(500).send("Invalid User.");
+ return;
+ }
+ if (anUser.orgname_rowid[0] === "") {
+ // For Org
+ masterUtil.getAllActiveOrg(function(err, orgList) {
+ logger.debug("got org list ==>", JSON.stringify(orgList));
+ if (err) {
+ res.status(500).send('Not able to fetch Orgs.');
+ return;
+ }
+ if (orgList.length === 0 && req.params.id === '21') {
+ d4dModelNew.d4dModelMastersTeams.find({
+ id: "21"
+ }, function(err, data) {
+ if (err) {
+ logger.error("Failed to fetch Team.");
+ }
+ res.send(data);
+ });
+ } else if (req.params.id === '1') {
+ res.send(orgList);
+ return;
+ } else if (req.params.id === '2') {
+ // For BusinessGroup
+ masterUtil.getBusinessGroups(orgList, function(err, bgList) {
+ if (err) {
+ res.status(500).send('Not able to fetch BG.');
+ }
+ res.send(bgList);
+ return;
+ });
+ } else if (req.params.id === '3') {
+ // For Environment
+ masterUtil.getEnvironments(orgList, function(err, envList) {
+ if (err) {
+ res.status(500).send('Not able to fetch ENV.');
+ }
+ res.send(envList);
+ return;
+ });
+ } else if (req.params.id === '4') {
+ // For Projects
+ masterUtil.getProjects(orgList, function(err, projectList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Project.');
+ }
+ res.send(projectList);
+ return;
+ })
+ } else if (req.params.id === '10') {
+ // For ConfigManagement
+ masterUtil.getCongifMgmts(orgList, function(err, configMgmtList) {
+ if (err) {
+ res.status(500).send('Not able to fetch ConfigManagement.');
+ }
+ res.send(configMgmtList);
+ return;
+ });
+
+ } else if (req.params.id === '18') {
+ // For Docker
+ logger.debug("Id for docker: ", req.params.id);
+ masterUtil.getDockers(orgList, function(err, dockerList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Dockers.');
+ }
+ res.send(dockerList);
+ return;
+ });
+
+ } else if (req.params.id === '17') {
+ // For Template
+ logger.debug("Id for template: ", req.params.id);
+ masterUtil.getTemplates(orgList, function(err, templateList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Template.');
+ }
+ res.send(templateList);
+ return;
+ });
+
+ } else if (req.params.id === '16') {
+ // For Template
+ logger.debug("Id for templateType: ", req.params.id);
+ masterUtil.getTemplateTypes(orgList, function(err, templateList) {
+ if (err) {
+ res.status(500).send('Not able to fetch TemplateType.');
+ }
+ res.send(JSON.stringify(templateList));
+ return;
+ });
+ } else if (req.params.id === '19') {
+ // For ServiceCommand
+ masterUtil.getServiceCommands(orgList, function(err, serviceCommandList) {
+ if (err) {
+ res.status(500).send('Not able to fetch ServiceCommand.');
+ }
+ res.send(serviceCommandList);
+ return;
+ });
+
+ } else if (req.params.id === '20') {
+ // For Jenkins
+ masterUtil.getJenkins(orgList, function(err, jenkinList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Jenkins.');
+ }
+ //res.send(jenkinList);
+ var hygProp = '';
+ if(jenkinList[0]){
+ hygProp += 'jenkins.servers[0]=' + jenkinList[0].jenkinsurl + '\n';
+ hygProp += 'jenkins.username=' + jenkinList[0].jenkinsusername + '\n';
+ hygProp += 'jenkins.apiKey=' + jenkinList[0].jenkinspassword + '\n';
+ }
+ res.send(hygProp);
+ return;
+ });
+
+ } else if (req.params.id === '27') {
+ // For Jenkins
+ masterUtil.getBitbucket(orgList, function(err, bitbucketList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Bitbucket.');
+ }
+ //res.send("test\ntest");
+ var hygProp = '';
+ if(bitbucketList[0]){
+ hygProp += 'git.username=' + bitbucketList[0].bitbucketusername + '\n';
+ hygProp += 'git.password=' + bitbucketList[0].bitbucketpassword + '\n';
+ }
+ res.send(hygProp);
+ //res.send(bitbucketList);
+ return;
+ });
+
+ } else if (req.params.id === '28') {
+ // For Octopus
+ masterUtil.getOctopus(orgList, function(err, octopusList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Octopus.');
+ }
+ var hygProp = '';
+ // if(octopusList[0]){
+ // hygProp += 'octopus.url=' + octopusList[0].octopusurl + '\n';
+ // hygProp += 'octopus.apiKey=' + octopusList[0].octopuskey + '\n';
+ // }
+ if(octopusList){
+ for(var oi = 0; oi < octopusList.length;oi++){
+ hygProp += 'octopus.url[' + oi + ']=' + octopusList[oi].octopusurl + '\n';
+ hygProp += 'octopus.apiKey[' + oi + ']=' + octopusList[oi].octopuskey + '\n';
+ hygProp += 'octopus.environments[' + oi + ']=' + octopusList[oi].octopusenvs + '\n';
+ }
+ }
+ res.send(hygProp);
+ //res.send(octopusList);
+ return;
+ });
+
+ } else if (req.params.id === '29') {
+ // For Functional Test
+ logger.debug('Yippeee....');
+ masterUtil.getFunctionalTest(orgList, function(err, functionaltestList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Functional Test.');
+ }
+ logger.debug(functionaltestList);
+ var functionalProp = '';
+ if(functionaltestList[0]){
+ functionalProp += 'sbux.url=' + functionaltestList[0].functionaltesturl + '\n';
+ functionalProp += 'sbux.days=' + functionaltestList[0].functionaltestdays + '\n';
+ }
+ res.send(functionalProp);
+ //res.send(octopusList);
+ return;
+ });
+
+ }
+ else if (req.params.id === '23') {
+ // For Jira
+ logger.debug("Entering getJira");
+ masterUtil.getJira(orgList, function(err, jiraList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Jira.');
+ }
+ var hygProp = '';
+ if(jiraList[0]){
+ hygProp += 'feature.jiraBaseUrl=' + jiraList[0].jiraurl + '\n';
+ hygProp += 'feature.jiraCredentials=' + jiraList[0].jirakey + '\n';
+ }
+ res.send(hygProp);
+ return;
+ });
+
+ }
+ else if (req.params.id === '6') {
+ // For User Role
+ masterUtil.getUserRoles(function(err, userRoleList) {
+ if (err) {
+ res.status(500).send('Not able to fetch UserRole.');
+ }
+ res.send(userRoleList);
+ return;
+ });
+
+ } else if (req.params.id === '7') {
+ // For User
+ masterUtil.getUsersForOrgOrAll(orgList, function(err, userList) {
+ if (err) {
+ res.status(500).send('Not able to fetch User.');
+ }
+ res.send(userList);
+ return;
+ });
+
+ } else if (req.params.id === '21') {
+ // For Team
+ masterUtil.getTeams(orgList, function(err, teamList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Team.');
+ }
+ res.send(teamList);
+ return;
+ });
+ } else if (req.params.id === '25') {
+ // For Puppet Server
+ masterUtil.getPuppetServers(orgList, function(err, pList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Puppet Server.');
+ }
+ res.send(pList);
+ return;
+ });
+
+ } else if (req.params.id === '26') {
+ // For Puppet Server
+ masterUtil.getNexusServers(orgList, function(err, pList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Nexus Server.');
+ }
+ res.send(pList);
+ return;
+ });
+ } else {
+ logger.debug('nothin here');
+ res.send([]);
+ }
+ });
+
+ // For non-catalystadmin
+ } else {
+ logger.debug("incomming id: ", req.params.id);
+ // For Org
+ masterUtil.getOrgs(loggedInUser, function(err, orgList) {
+ logger.debug("got org list: ", JSON.stringify(orgList));
+ if (err) {
+ res.status(500).send('Not able to fetch Orgs.');
+ return;
+ } else if (req.params.id === '1') {
+ res.send(orgList);
+ return;
+ } else if (req.params.id === '2') {
+ // For BusinessGroup
+ masterUtil.getBusinessGroups(orgList, function(err, bgList) {
+ if (err) {
+ res.status(500).send('Not able to fetch BG.');
+ }
+ res.send(bgList);
+ return;
+ });
+ } else if (req.params.id === '3') {
+ // For Environment
+ masterUtil.getEnvironments(orgList, function(err, envList) {
+ if (err) {
+ res.status(500).send('Not able to fetch ENV.');
+ }
+ res.send(envList);
+ return;
+ });
+ } else if (req.params.id === '4') {
+ // For Projects
+ masterUtil.getProjects(orgList, function(err, projectList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Project.');
+ }
+ res.send(projectList);
+ return;
+ })
+ } else if (req.params.id === '10') {
+ // For ConfigManagement
+ masterUtil.getCongifMgmts(orgList, function(err, configMgmtList) {
+ if (err) {
+ res.status(500).send('Not able to fetch ConfigManagement.');
+ }
+ res.send(configMgmtList);
+ return;
+ });
+
+ } else if (req.params.id === '18') {
+ // For Docker
+ logger.debug("Id for docker: ", req.params.id);
+ masterUtil.getDockers(orgList, function(err, dockerList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Dockers.');
+ }
+ res.send(dockerList);
+ return;
+ });
+
+ } else if (req.params.id === '17') {
+ // For Template
+ logger.debug("Id for template: ", req.params.id);
+ masterUtil.getTemplates(orgList, function(err, templateList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Template.');
+ }
+ res.send(templateList);
+ return;
+ });
+
+ } else if (req.params.id === '16') {
+ // For Template
+ logger.debug("Id for templateType: ", req.params.id);
+ masterUtil.getTemplateTypes(orgList, function(err, templateList) {
+ if (err) {
+ res.status(500).send('Not able to fetch TemplateType.');
+ }
+ res.send(JSON.stringify(templateList));
+ return;
+ });
+
+ } else if (req.params.id === '19') {
+ // For ServiceCommand
+ masterUtil.getServiceCommands(orgList, function(err, serviceCommandList) {
+ if (err) {
+ res.status(500).send('Not able to fetch ServiceCommand.');
+ }
+ res.send(serviceCommandList);
+ return;
+ });
+
+ } else if (req.params.id === '20') {
+ // For Jenkins
+ masterUtil.getJenkins(orgList, function(err, jenkinList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Jenkins.');
+ }
+ res.send(jenkinList);
+ return;
+ });
+
+ } else if (req.params.id === '27') {
+ // For Bitbucket
+ masterUtil.getBitbucket(orgList, function(err, bitbucketList) {
+ if (err) {
+ res.status(500).send('Not able to fetch bitbucket.');
+ }
+ res.send(bitbucketList);
+ return;
+ });
+
+ }else if (req.params.id === '28') {
+ // For Octopus
+ masterUtil.getOctopus(orgList, function(err, octopusList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Octopus.');
+ }
+ res.send(octopusList);
+ return;
+ });
+
+ }else if (req.params.id === '29') {
+ // For Functional Test
+ masterUtil.getFunctionalTest(orgList, function(err, functionaltestList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Functional Test.');
+ }
+ var functionalProp = '';
+ if(functionaltestList[0]){
+ functionalProp += 'sbux.url=' + functionaltestList[0].functionaltesturl + '\n';
+ functionalProp += 'sbux.days=' + functionaltestList[0].functionaltestdays + '\n';
+ }
+ res.send(functionalProp);
+ //res.send(octopusList);
+ return;
+ });
+
+ }
+ else if (req.params.id === '23') {
+ // For Jira
+ masterUtil.getJira(orgList, function(err, jiraList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Jira.');
+ }
+ res.send(jiraList);
+ return;
+ });
+
+ }else if (req.params.id === '6') {
+ // For User Role
+ masterUtil.getUserRoles(function(err, userRoleList) {
+ if (err) {
+ res.status(500).send('Not able to fetch UserRole.');
+ }
+ res.send(userRoleList);
+ return;
+ });
+
+ } else if (req.params.id === '7') {
+ // For User
+ masterUtil.getUsersForOrg(orgList, function(err, userList) {
+ if (err) {
+ res.status(500).send('Not able to fetch User.');
+ }
+ res.send(userList);
+ return;
+ });
+
+ } else if (req.params.id === '21') {
+ // For Team
+ masterUtil.getTeams(orgList, function(err, teamList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Team.');
+ }
+ res.send(teamList);
+ return;
+ });
+ } else if (req.params.id === '25') {
+ // For Puppet Server
+ masterUtil.getPuppetServers(orgList, function(err, pList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Puppet Server.');
+ }
+ res.send(pList);
+ return;
+ });
+ } else if (req.params.id === '26') {
+ // For Puppet Server
+ masterUtil.getNexusServers(orgList, function(err, pList) {
+ if (err) {
+ res.status(500).send('Not able to fetch Nexus Server.');
+ }
+ res.send(pList);
+ return;
+ });
+ } else {
+ logger.debug('nothin here');
+ res.send([]);
+ }
+ });
+ }
+ });
+
+ });
+
+
+
+}
+