Skip to content

Commit

Permalink
allow overriding the volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
cancan101 committed Feb 6, 2015
1 parent b4d1ad4 commit f625328
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions starcluster/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from starcluster import completion
from starcluster.templates import user_msgs
from starcluster.logger import log
from starcluster.utils import AttributeDict

from completers import ClusterCompleter

Expand Down Expand Up @@ -180,6 +181,9 @@ def addopts(self, parser):
parser.add_option("-N", "--subnet-id", dest="subnet_id",
action="store", type="string",
help=("Launch cluster into a VPC subnet"))
parser.add_option("--volumes", dest="volumes",
action="append", default=None,
help="Specify the volumes to use with cluster")

def execute(self, args):
if len(args) != 1:
Expand Down Expand Up @@ -223,6 +227,15 @@ def execute(self, args):
raise e
log.info("Using default cluster template: %s" % template)
scluster = self.cm.get_cluster_template(template, tag)

if self.opts.volumes is not None:
volumes_orig = [x for x in (y.strip() for y in self.opts.volumes) if x]
self.opts.volumes = AttributeDict()
for key in volumes_orig:
self.opts.volumes[key] = vol = self.cfg.vols.get(key).copy()
del vol['__name__']
self.opts.volumes = scluster.load_volumes(self.opts.volumes)

scluster.update(self.specified_options_dict)
if self.opts.keyname and not self.opts.key_location:
key = self.cfg.get_key(self.opts.keyname)
Expand Down

0 comments on commit f625328

Please sign in to comment.