Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow overriding the volumes #498

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 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,17 @@ 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