Created
July 1, 2014 20:28
-
-
Save mattburch/b424a27a9e9ca811d763 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var portServiceToColor = function(portnum, product, color) { | |
// Changes the status of provided port to provided color by Array of hosts | |
// for lair-blue, lair-orange, lair-red; Host status is updated to COLOR also | |
// | |
// Created by: Matt Burch | |
// Usage: portServiceToColor(47001, 'Microsoft HTTPAPI httpd 2.0', 'lair-green'); | |
// Supported Colors: console.log(STATUS_MAP) | |
// | |
// Requires client-side updates: false | |
var PROJECT_ID = Session.get('projectId'); | |
var MODIFIED_BY = Meteor.user().emails[0].address; | |
var COUNT = 0; | |
if (STATUS_MAP.indexOf(color) === -1) { | |
console.log("Lair Supported colors: " + STATUS_MAP); | |
throw {name : "Wrong Color", message : "Provided COLOR: \"" + color + "\" is not Lair compliant"}; | |
} | |
var ports = Ports.find({project_id : PROJECT_ID, 'port' : portnum, 'product' : product}).fetch(); | |
ports.forEach( function(port) { | |
Meteor.call("setPortStatus", PROJECT_ID, port._id, color) | |
COUNT ++; | |
}); | |
console.log(COUNT + " port(s) updated"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment