Skip to content

Commit 041090d

Browse files
authored
Merge pull request #734 from RLOpenCatalyst/dev
moving dev to stage 3.4.1
2 parents 24682d7 + c6df8ec commit 041090d

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

server/app/routes/v1.0/routes_serviceStatus.js

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,55 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// The file contains all the end points for Tracks
18-
1917
var logger = require('_pr/logger')(module);
20-
var request = require("request");
18+
var https = require("https");
2119
var errorResponses = require('./error_responses');
20+
var appConfig = require('_pr/config');
2221

2322

2423
module.exports.setRoutes = function(app, sessionVerificationFunc) {
2524
app.all('/serviceAction/*', sessionVerificationFunc);
2625

2726
// Check for Service stop
2827
app.post('/serviceAction', function(req, res) {
29-
30-
console.log(req.body);
3128
var post_data = {
3229
"cmd": req.body.cmd,
3330
"type": req.body.type,
3431
"hosts": req.body.hosts
3532
};
3633

37-
request({
38-
url: 'https://52.8.208.191/api/v1/webhooks/remotecmd?st2-api-key=YTU0M2RlNmMwMjdhMzFlNzVmMTExZDA4YWExMWY5MmFjOTUyYzc2Nzk5YjMzYmM4ZjAwNWJiYjc2NjFmZjY1MA',
39-
body: post_data,
40-
method: 'post',
41-
json: true,
42-
}, function(err, httpResponse, body) {
43-
if (err) {
44-
res.status(500).send(err);
45-
return;
34+
post_data = JSON.stringify(post_data);
35+
36+
37+
var post_options = {
38+
host: appConfig.serverControllerUrl,
39+
port: 443,
40+
path: '/api/v1/webhooks/remotecmd?st2-api-key='+appConfig.serviceControllerKey,
41+
method: 'POST',
42+
headers: {
43+
'Content-Type': 'application/x-www-form-urlencoded',
44+
'Content-Length': Buffer.byteLength(post_data)
4645
}
47-
res.status(200).send(body);
46+
};
47+
48+
49+
var post_req = https.request(post_options, function(httpsRes) {
50+
httpsRes.setEncoding('utf8');
51+
var data = '';
52+
httpsRes.on('data', function(chunk) {
53+
data = data + chunk
54+
console.log('Response: ' + chunk);
55+
});
56+
httpsRes.on('end', function(chunk) {
57+
res.status(200).send(data);
58+
});
59+
httpsRes.on('error', function(err) {
60+
res.status(500).send(err);
61+
});
4862
});
4963

64+
post_req.write(post_data);
65+
post_req.end();
66+
5067
});
5168
};

server/install.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ function getDefaultsConfig() {
6767
return config.catalystHome + this.cookbooksDirName + "/";
6868
}
6969
},
70+
serviceControllerKey:'ZDQ2YWM3ZTUyZDhhZjhhOWRkMWQ2ZTc3NDhhNjk1OWEyYzgxZGJkMWVjYjA3ZThiZjY0NTBjYjBjMTM5YzA0Yg',
71+
serverControllerUrl:'stackstorm.rlcatalyst.com',
7072
constantData: {
7173
common_field: ['envId', 'providerId', 'orgId', 'bgId','organizationId','businessGroupId', 'projectId','templateType','blueprintConfig.cloudProviderType','cloudProviderType'],
7274
sort_field: ['name', 'description'],

0 commit comments

Comments
 (0)