argument validation and fixing of copy ssl at creation time feature
This commit is contained in:
Родитель
ed97a4f5b7
Коммит
e2764afcab
|
@ -77,6 +77,14 @@ verbs['create'] = function(args) {
|
|||
.describe('t', 'Instance type, dictates VM speed and cost. i.e. t1.micro or m1.large (see http://aws.amazon.com/ec2/instance-types/)')
|
||||
.describe('p', 'public SSL key (installed automatically when provided)')
|
||||
.describe('s', 'secret SSL key (installed automatically when provided)')
|
||||
.check(function(argv) {
|
||||
// p and s are all or nothing
|
||||
if (argv.s ? !argv.p : argv.p) throw "-p and -s are both required";
|
||||
if (argv.s) {
|
||||
if (!path.existsSync(argv.s)) throw "file '" + argv.s + "' doesn't exist";
|
||||
if (!path.existsSync(argv.p)) throw "file '" + argv.p + "' doesn't exist";
|
||||
}
|
||||
})
|
||||
.default('t', 't1.micro')
|
||||
|
||||
var opts = parser.argv;
|
||||
|
|
|
@ -26,10 +26,10 @@ exports.copyUpConfig = function(host, config, cb) {
|
|||
};
|
||||
|
||||
exports.copySSL = function(host, pub, priv, cb) {
|
||||
var cmd = 'scp -o "StrictHostKeyChecking no" ' + pub + ' proxy@' + host + ":.";
|
||||
var cmd = 'scp -o "StrictHostKeyChecking no" ' + pub + ' proxy@' + host + ":cert.pem";
|
||||
child_process.exec(cmd, function(err, r) {
|
||||
if (err) return cb(err);
|
||||
var cmd = 'scp -o "StrictHostKeyChecking no" ' + priv + ' proxy@' + host + ":.";
|
||||
var cmd = 'scp -o "StrictHostKeyChecking no" ' + priv + ' proxy@' + host + ":key.pem";
|
||||
child_process.exec(cmd, function(err, r) {
|
||||
var cmd = 'ssh -o "StrictHostKeyChecking no" proxy@' + host + " 'forever restartall'";
|
||||
child_process.exec(cmd, cb);
|
||||
|
|
Загрузка…
Ссылка в новой задаче