implement postcreate hook, stub out specification of SSL keys via command line params, template bump to support single top level .hook key
This commit is contained in:
Родитель
d803fafb3f
Коммит
cc635b5c41
|
@ -75,6 +75,8 @@ verbs['create'] = function(args) {
|
|||
if (argv.u) argv.u = urlparse(argv.u).validate().originOnly().toString();
|
||||
})
|
||||
.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)')
|
||||
.default('t', 't1.micro')
|
||||
|
||||
var opts = parser.argv;
|
||||
|
@ -135,7 +137,11 @@ verbs['create'] = function(args) {
|
|||
}
|
||||
ssh.installPackages(deets.ipAddress, awsboxJson.packages, function(err, r) {
|
||||
checkErr(err);
|
||||
printInstructions(name, deets);
|
||||
var postcreate = (awsboxJson.hooks && awsboxJson.hooks.postcreate) || null;
|
||||
ssh.runScript(deets.ipAddress, postcreate, function(err, r) {
|
||||
checkErr(err);
|
||||
printInstructions(name, deets);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -54,6 +54,14 @@ exports.installPackages = function(host, packages, cb) {
|
|||
}
|
||||
};
|
||||
|
||||
exports.runScript = function(host, script, cb) {
|
||||
if (!script) return cb(null);
|
||||
var cmd = 'ssh -o "StrictHostKeyChecking no" ec2-user@' + host + " < " + script;
|
||||
child_process.exec(cmd, function(err, r) {
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
exports.addSSHPubKey = function(host, pubkey, cb) {
|
||||
var cmd = 'ssh -o "StrictHostKeyChecking no" ec2-user@' + host + " 'echo \'" + pubkey + "\' >> .ssh/authorized_keys'";
|
||||
child_process.exec(cmd, cb);
|
||||
|
|
|
@ -4,7 +4,7 @@ jsel = require('JSONSelect'),
|
|||
key = require('./key.js'),
|
||||
sec = require('./sec.js');
|
||||
|
||||
const TEMPLATE_IMAGE_ID = 'ami-b68021df';
|
||||
const TEMPLATE_IMAGE_ID = 'ami-10852479';
|
||||
|
||||
function extractInstanceDeets(horribleBlob) {
|
||||
var instance = {};
|
||||
|
@ -143,7 +143,7 @@ exports.makeAMIPublic = function(imageId, progress, cb) {
|
|||
setTimeout(function() {
|
||||
if (typeof progress === 'function') progress(e || "unknown");
|
||||
attempt();
|
||||
}, 10000);
|
||||
}, 15000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче