UNPKG

mecano

Version:

Common functions for system deployment.

49 lines (46 loc) 1.16 kB
// Generated by CoffeeScript 1.11.1 var docker; module.exports = function(options) { var cmd; options.log({ message: "Entering Docker volume_create", level: 'DEBUG', module: 'mecano/lib/docker/volume_create' }); if (typeof options.label === 'string') { options.label = [options.label]; } if (typeof options.opt === 'string') { options.opt = [options.opt]; } cmd = ["volume create"]; if (options.driver) { cmd.push("--driver " + options.driver); } if (options.label) { cmd.push("--label " + (options.label.join(','))); } if (options.name) { cmd.push("--name " + options.name); } if (options.opt) { cmd.push("--opt " + (options.opt.join(','))); } cmd = cmd.join(' '); this.execute({ "if": options.name, cmd: docker.wrap(options, "volume inspect " + options.name), code: 1, code_skipped: 0, shy: true }); return this.execute({ "if": function() { return !options.name || this.status(-1); }, cmd: docker.wrap(options, cmd) }, function(err, status, stdout) { return console.log('STDOUT: ' + stdout); }); }; docker = require('../misc/docker');