UNPKG

mecano

Version:

Common functions for system deployment.

26 lines (23 loc) 718 B
// Generated by CoffeeScript 1.9.1 var execute; module.exports = function(options, callback) { if (!options.name) { return callback(new Error("Missing required option 'name'")); } return this.execute({ cmd: "service " + options.name + " status", code_skipped: [3, 1], shy: true }, function(err, started) { if (err) { return callback(err); } return options.db["mecano.service." + options.name + ".status"] = started ? 'started' : 'stopped'; }).execute({ cmd: "service " + options.name + " start", not_if: function() { return options.db["mecano.service." + options.name + ".status"] === 'started'; } }).then(callback); }; execute = require('./execute');