Skip to content

Commit

Permalink
fix: Use default region while creating storages without region id spe…
Browse files Browse the repository at this point in the history
…cified
  • Loading branch information
tcibinan committed Apr 3, 2019
1 parent 02f4527 commit 3ea1a8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pipe-cli/pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,9 @@ def storage():
@click.option('-c', '--on_cloud',
prompt='Do you want to create this storage on a cloud?',
help='Create bucket on a cloud', default=False, is_flag=True)
@click.option('-p', '--path', required=False, default='', help='The name of the new bucket.',
@click.option('-p', '--path', default='', help='The name of the new bucket.',
prompt='The name of the new bucket.')
@click.option('-r', '--region_id', required=False, type=int, help='Cloud region id where storage shall be created.',
@click.option('-r', '--region_id', default='default', help='Cloud region id where storage shall be created. ',
prompt='Cloud region id where storage shall be created.')
def create(name, description, short_term_storage, long_term_storage, versioning, backup_duration, type,
parent_folder, on_cloud, path, region_id):
Expand Down
8 changes: 8 additions & 0 deletions pipe-cli/src/utilities/datastorage_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ def save_data_storage(cls, name, description, sts_duration, lts_duration, versio
click.echo("Error: Directory with name '{}' not found! "
"Check if it exists and you have permission to read it".format(parent_folder), err=True)
sys.exit(1)
if region_id == 'default':
region_id = None
else:
try:
region_id = int(region_id)
except ValueError:
click.echo("Error: Given region id '{}' is not a number.".format(region_id))
sys.exit(1)
try:
DataStorage.save(name, path, description, sts_duration, lts_duration, versioning, backup_duration, type,
directory.id if directory else None, on_cloud, region_id)
Expand Down

0 comments on commit 3ea1a8c

Please sign in to comment.