diff --git a/maxctrl/lib/common.js b/maxctrl/lib/common.js index 238afdd5b..89627f9fc 100644 --- a/maxctrl/lib/common.js +++ b/maxctrl/lib/common.js @@ -369,7 +369,12 @@ module.exports = function() { args.auth = {user: argv.u, pass: argv.p} args.json = true args.timeout = this.argv.timeout - setTlsCerts(args) + + try { + setTlsCerts(args) + } catch (err) { + return error('Failed to set TLS certificates: ' + JSON.stringify(err, null, 4)) + } return request(args) .then(function(res) { diff --git a/maxctrl/lib/core.js b/maxctrl/lib/core.js index d08d94482..d6ba6c958 100644 --- a/maxctrl/lib/core.js +++ b/maxctrl/lib/core.js @@ -56,7 +56,7 @@ program }) .option('q', { alias: 'quiet', - describe: 'Silence all output', + describe: 'Silence all output. This option is not used in the interactive mode.', default: false, type: 'boolean' }) @@ -123,7 +123,19 @@ program base_opts = ['--user=' + argv.user, '--password=' + argv.password, '--hosts=' + argv.hosts, - '--timeout=' + argv.timeout] + '--timeout=' + argv.timeout, + '--tsv=' + argv.tsv, + '--secure=' + argv.secure, + '--tls-verify-server-cert=' + argv['tls-verify-server-cert']] + + // Only set the string options if they are defined, otherwise we'll end up with the value as + // the string 'undefined' + for (i of ['tls-key', 'tls-cert', 'tls-passphrase', 'tls-ca-cert']) { + if (argv[i]) { + base_opts.push('--' + i + '=' + argv[i]) + } + } + return askQuestion() } else { maxctrl(argv, function() {