mecano
Version:
Common functions for system deployment.
33 lines (32 loc) • 950 B
JavaScript
// Generated by CoffeeScript 1.11.1
module.exports = function(options) {
var status;
options.log({
message: "Entering assert",
level: 'DEBUG',
module: 'mecano/lib/assert'
});
status = this.status();
this.call({
"if": (options.status != null) && status !== options.status,
handler: function() {
var message;
message = "Invalid status: expected " + (JSON.stringify(options.status)) + ", got " + (JSON.stringify(status));
throw Error(message);
}
});
if (options.host && !options.port) {
throw Error("Required option port if host");
}
if (options.port && !options.host) {
throw Error("Required option host if port");
}
return this.execute({
"if": options.host,
cmd: "bash -c 'echo > /dev/tcp/" + options.host + "/" + options.port + "'"
}, function(err) {
if (err) {
throw Error("Closed Connection to '" + options.host + ":" + options.port + "'");
}
});
};