diff --git a/bin/controller.keys.js b/bin/controller.keys.js index bf6276c3..30b22189 100755 --- a/bin/controller.keys.js +++ b/bin/controller.keys.js @@ -112,10 +112,12 @@ module.exports.updateKeys = function updateKeys(options, taskCallback) { singleItem.Labels = _.get(singleItem, 'metadata.labels'); - singleItem.Labels['ci.rabbit.name'] = singleItem.Labels['name']; - - singleItem.Labels['ci.rabbit.ssh.user'] = singleItem.Labels['ci.rabbit.ssh.user'] || null; - return singleItem; + // Prevents the application from being added to the list if it does not have the required labels + if ( _.get(singleItem.Labels, 'name', false) && _.get(singleItem.Labels, 'ci.rabbit.ssh.user', false) ) { + singleItem.Labels['ci.rabbit.name'] = singleItem.Labels['name']; + singleItem.Labels['ci.rabbit.ssh.user'] = singleItem.Labels['ci.rabbit.ssh.user'] || null; + return singleItem; + } }); diff --git a/bin/server.js b/bin/server.js index c65925c8..bab04a9b 100644 --- a/bin/server.js +++ b/bin/server.js @@ -51,8 +51,8 @@ setInterval(function() { var _containers = body = _.map(body.items, function(singleItem) { singleItem.Labels = _.get(singleItem, 'metadata.labels'); - singleItem.Labels['ci.rabbit.name'] = singleItem.Labels['name']; - singleItem.Labels['ci.rabbit.ssh.user'] = singleItem.Labels['ci.rabbit.ssh.user'] || null; + singleItem.Labels['ci.rabbit.name'] = _.get(singleItem.Labels,'name', null); + singleItem.Labels['ci.rabbit.ssh.user'] = _.get(singleItem.Labels,'ci.rabbit.ssh.user', null); return singleItem; });