Skip to content

Commit 773f4d5

Browse files
author
Fernando
committed
Remove block/file interval option for replica volume.
1 parent 4694601 commit 773f4d5

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

SoftLayer/CLI/block/replication/order.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import SoftLayer
66
from SoftLayer.CLI import environment
77
from SoftLayer.CLI import exceptions
8+
from SoftLayer.CLI import helpers
9+
from SoftLayer import utils
810

911

1012
CONTEXT_SETTINGS = {'token_normalize_func': lambda x: x.upper()}
@@ -14,9 +16,9 @@
1416
@click.argument('volume_id')
1517
@click.option('--snapshot-schedule', '-s',
1618
help='Snapshot schedule to use for replication, '
17-
'(INTERVAL | HOURLY | DAILY | WEEKLY)',
19+
'(HOURLY | DAILY | WEEKLY)',
1820
required=True,
19-
type=click.Choice(['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']))
21+
type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY']))
2022
@click.option('--location', '-l',
2123
help='Short name of the data center for the replicant '
2224
'(e.g.: dal09)',
@@ -40,13 +42,14 @@
4042
def cli(env, volume_id, snapshot_schedule, location, tier, os_type):
4143
"""Order a block storage replica volume."""
4244
block_manager = SoftLayer.BlockStorageManager(env.client)
45+
block_volume_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Block Volume')
4346

4447
if tier is not None:
4548
tier = float(tier)
4649

4750
try:
4851
order = block_manager.order_replicant_volume(
49-
volume_id,
52+
block_volume_id,
5053
snapshot_schedule=snapshot_schedule,
5154
location=location,
5255
tier=tier,
@@ -57,9 +60,9 @@ def cli(env, volume_id, snapshot_schedule, location, tier, os_type):
5760

5861
if 'placedOrder' in order.keys():
5962
click.echo("Order #{0} placed successfully!".format(
60-
order['placedOrder']['id']))
61-
for item in order['placedOrder']['items']:
62-
click.echo(" > %s" % item['description'])
63+
utils.lookup(order, 'placedOrder', 'id')))
64+
for item in utils.lookup(order, 'placedOrder', 'items'):
65+
click.echo(" > %s" % item.get('description'))
6366
else:
6467
click.echo("Order could not be placed! Please verify your options " +
6568
"and try again.")

SoftLayer/CLI/file/replication/order.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import SoftLayer
66
from SoftLayer.CLI import environment
77
from SoftLayer.CLI import exceptions
8+
from SoftLayer.CLI import helpers
9+
from SoftLayer import utils
810

911

1012
CONTEXT_SETTINGS = {'token_normalize_func': lambda x: x.upper()}
@@ -14,9 +16,9 @@
1416
@click.argument('volume_id')
1517
@click.option('--snapshot-schedule', '-s',
1618
help='Snapshot schedule to use for replication, '
17-
'(INTERVAL | HOURLY | DAILY | WEEKLY)',
19+
'(HOURLY | DAILY | WEEKLY)',
1820
required=True,
19-
type=click.Choice(['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']))
21+
type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY']))
2022
@click.option('--location', '-l',
2123
help='Short name of the data center for the replicant '
2224
'(e.g.: dal09)',
@@ -29,13 +31,14 @@
2931
def cli(env, volume_id, snapshot_schedule, location, tier):
3032
"""Order a file storage replica volume."""
3133
file_manager = SoftLayer.FileStorageManager(env.client)
34+
file_volume_id = helpers.resolve_id(file_manager.resolve_ids, volume_id, 'File Storage')
3235

3336
if tier is not None:
3437
tier = float(tier)
3538

3639
try:
3740
order = file_manager.order_replicant_volume(
38-
volume_id,
41+
file_volume_id,
3942
snapshot_schedule=snapshot_schedule,
4043
location=location,
4144
tier=tier,
@@ -45,9 +48,9 @@ def cli(env, volume_id, snapshot_schedule, location, tier):
4548

4649
if 'placedOrder' in order.keys():
4750
click.echo("Order #{0} placed successfully!".format(
48-
order['placedOrder']['id']))
49-
for item in order['placedOrder']['items']:
50-
click.echo(" > %s" % item['description'])
51+
utils.lookup(order, 'placedOrder', 'id')))
52+
for item in utils.lookup(order, 'placedOrder', 'items'):
53+
click.echo(" > %s" % item.get('description'))
5154
else:
5255
click.echo("Order could not be placed! Please verify your options " +
5356
"and try again.")

0 commit comments

Comments
 (0)