Skip to content

Commit

Permalink
TOOLS-57 add support for passing user-script path as -s argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwilsdon committed Jan 26, 2012
1 parent f28fc92 commit 2906662
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/sdc-createmachine
Expand Up @@ -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');
Expand All @@ -22,6 +23,7 @@ var Options = {
"metadata": [String, Array],
"name": String,
"package": String,
"script": path,
"tag": [String, Array],
"url": url
};
Expand All @@ -37,6 +39,7 @@ var ShortOptions = {
"m": ["--metadata"],
"n": ["--name"],
"p": ["--package"],
"s": ["--script"],
"t": ["--tag"],
"u": ["--url"]
};
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2906662

Please sign in to comment.