From 3384534cf1d032330737d317e5c3dfb33d80dbcc Mon Sep 17 00:00:00 2001 From: DAMON CIARELLI Date: Tue, 12 Apr 2022 18:55:35 -0700 Subject: [PATCH] prompt for cloudprovider --- nucypher_ops/cli/nodes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nucypher_ops/cli/nodes.py b/nucypher_ops/cli/nodes.py index f908a76..fe414a0 100644 --- a/nucypher_ops/cli/nodes.py +++ b/nucypher_ops/cli/nodes.py @@ -14,7 +14,7 @@ def cli(): @cli.command('create') @click.option('--region', help="provider specific region name (like us-east-1 or SFO3", default=None) @click.option('--instance-type', help="provider specific instance size like `s-1vcpu-2gb` or `t3.small`", default=None) -@click.option('--cloudprovider', help="aws or digitalocean", default='aws') +@click.option('--cloudprovider', help="aws or digitalocean", default=None) @click.option('--count', help="Create this many nodes.", type=click.INT, default=1) @click.option('--namespace', help="Namespace for these operations. Used to address hosts and data locally and name hosts on cloud platforms.", type=click.STRING, default=DEFAULT_NAMESPACE) @click.option('--nickname', help="A nickname by which to remember the created hosts", type=click.STRING, required=False) @@ -22,6 +22,17 @@ def cli(): def create(region, instance_type, cloudprovider, count, nickname, namespace, network): """Creates the required number of workers to be staked later under a namespace""" + + available_providers = ['aws', 'digitalocean'] + choice_list = '\n\t'.join(available_providers) + + if not cloudprovider: + cloudprovider = emitter.prompt( + f"Please choose a Cloud Service Provider from these options: \n\t{choice_list}\n", + type=emitter.Choice(available_providers), + show_choices=False + ) + if cloudprovider == 'aws': try: import boto3