-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.js
31 lines (24 loc) · 965 Bytes
/
function.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
exports.handler = function(contextEntity, publish, query, subscribe) {
console.log("entered into the user-defined fog function");
var entityID = contextEntity.entityId.id;
if (contextEntity == null) {
return;
}
if (contextEntity.attributes == null) {
return;
}
var FogflowIP = contextEntity.attributes.fogflowIP.value;
FogflowIP = FogflowIP.toString();
console.log('FogflowIP: ',FogflowIP);
var NGBIP = contextEntity.attributes.ngbIP.value;
NGBIP = NGBIP.toString();
console.log('NGBIP: ',NGBIP);
var command = "../transformer-config.sh " + FogflowIP + " " + NGBIP;
console.log(command);
const shell = require('shelljs');
shell.exec(command);
// command = "../transformer-config.sh " + FogflowIP + " " + NGBIP;
// console.log(command);
// const shell = require('shelljs');
// shell.exec(command);
};