Permalink
Browse files

TOOLS-57 add support for passing user-script path as -s argument.

  • Loading branch information...
1 parent f28fc92 commit 290666262937ca542404909182c3e42ab862104d @joshwilsdon joshwilsdon committed Jan 26, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 bin/sdc-createmachine
View
@@ -2,6 +2,7 @@
// -*- mode: js -*-
// Copyright 2011 Joyent, Inc. All rights reserved.
+var fs = require('fs');
var https = require('https');
var path = require('path');
var url = require('url');
@@ -22,6 +23,7 @@ var Options = {
"metadata": [String, Array],
"name": String,
"package": String,
+ "script": path,
"tag": [String, Array],
"url": url
};
@@ -37,6 +39,7 @@ var ShortOptions = {
"m": ["--metadata"],
"n": ["--name"],
"p": ["--package"],
+ "s": ["--script"],
"t": ["--tag"],
"u": ["--url"]
};
@@ -69,6 +72,10 @@ common.parseArguments(Options, ShortOptions, function(parsed) {
opts['metadata.' + tmp[0]] = tmp[1];
}
}
+ if (parsed.script) {
+ us = fs.readFileSync(parsed.script, 'utf-8');
+ opts['metadata.user-script'] = us.toString();
+ }
var client = common.newClient(parsed);
client.createMachine(opts, common.callback);

0 comments on commit 2906662

Please sign in to comment.