Skip to content

Commit

Permalink
configuration and event stuff for wsman microservices
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Phelps authored and Dan Phelps committed Oct 12, 2016
1 parent 6e57712 commit 61c6531
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ function constantsFactory (path) {
Configuration: {
Files: {
Global: process.env.MONORAIL_CONFIG || '/opt/monorail/config.json',
OnRack: '/opt/onrack/etc/monorail.json'
OnRack: '/opt/onrack/etc/monorail.json',
Dell: '/opt/dell/wsmanConfig.json'
}
},
WorkItems: {
Expand Down
21 changes: 20 additions & 1 deletion lib/protocol/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function eventsProtocolFactory (
);
};


EventsProtocol.prototype.subscribeHttpResponse = function (nodeId, callback) {
assert.isMongoId(nodeId);
assert.func(callback);
Expand All @@ -94,6 +93,26 @@ function eventsProtocolFactory (
);
};

EventsProtocol.prototype.publishHttpResponseUuid = function (id, data) {
assert.string(id);
assert.object(data);
return messenger.publish(
Constants.Protocol.Exchanges.Events.Name,
'http.response' + '.' + id,
data
);
};

EventsProtocol.prototype.subscribeHttpResponseUuid = function (id, callback) {
assert.uuid(id);
assert.func(callback);
return messenger.subscribe(
Constants.Protocol.Exchanges.Events.Name,
'http.response' + '.' + id,
callback
);
};

EventsProtocol.prototype.publishDhcpBoundLease = function (nodeId, data) {
assert.string(nodeId);
assert.object(data);
Expand Down
6 changes: 6 additions & 0 deletions lib/services/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ function configurationServiceFactory(
console.error('Failed to load configuration file:',
Constants.Configuration.Files.Global);
}
if (fs.existsSync(Constants.Configuration.Files.Dell)) {
nconf.file('dell', Constants.Configuration.Files.Dell);
} else {
console.error('Failed to load configuration file:',
Constants.Configuration.Files.Dell);
}

var baseDirectory = path.resolve(__dirname + '/../..');

Expand Down

0 comments on commit 61c6531

Please sign in to comment.