Skip to content

Commit d376545

Browse files
author
Brian Flores
committed
Merge branch 'master' of https://github.com/BrianSantivanez/softlayer-python into issue1829
2 parents 1dd4cee + 1c9d0a6 commit d376545

25 files changed

+143
-82
lines changed

SoftLayer/CLI/account/events.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,26 @@
1010

1111

1212
@click.command(cls=SLCommand)
13+
@click.option('--announcement', is_flag=True, default=False,
14+
help="Show only announcement events.")
1315
@click.option('--ack-all', is_flag=True, default=False,
14-
help="Acknowledge every upcoming event. Doing so will turn off the popup in the control portal")
16+
help="Acknowledge every upcoming event. Doing so will turn off the popup in the control portal.")
17+
@click.option('--date-min', help="Earliest date to retrieve events for [MM/DD/YYYY]. Default: 2 days ago.")
1518
@click.option('--planned', is_flag=True, default=False,
16-
help="Show only planned events")
19+
help="Show only planned events.")
1720
@click.option('--unplanned', is_flag=True, default=False,
18-
help="Show only unplanned events")
19-
@click.option('--announcement', is_flag=True, default=False,
20-
help="Show only announcement events")
21+
help="Show only unplanned events.")
2122
@environment.pass_env
22-
def cli(env, ack_all, planned, unplanned, announcement):
23+
def cli(env, ack_all, planned, unplanned, announcement, date_min):
2324
"""Summary and acknowledgement of upcoming and ongoing maintenance events"""
2425

26+
if date_min:
27+
utils.verify_date(date_min)
28+
2529
manager = AccountManager(env.client)
26-
planned_events = manager.get_upcoming_events("PLANNED")
27-
unplanned_events = manager.get_upcoming_events("UNPLANNED_INCIDENT")
28-
announcement_events = manager.get_upcoming_events("ANNOUNCEMENT")
30+
planned_events = manager.get_upcoming_events("PLANNED", date_min)
31+
unplanned_events = manager.get_upcoming_events("UNPLANNED_INCIDENT", date_min)
32+
announcement_events = manager.get_upcoming_events("ANNOUNCEMENT", date_min)
2933

3034
add_ack_flag(planned_events, manager, ack_all)
3135
add_ack_flag(unplanned_events, manager, ack_all)

SoftLayer/CLI/account/invoices.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212

1313
@click.command(cls=SLCommand)
14-
@click.option('--limit', default=50, show_default=True,
15-
help="How many invoices to get back.")
16-
@click.option('--closed', is_flag=True, default=False, show_default=True,
17-
help="Include invoices with a CLOSED status.")
1814
@click.option('--all', 'get_all', is_flag=True, default=False, show_default=True,
1915
help="Return ALL invoices. There may be a lot of these.")
16+
@click.option('--closed', is_flag=True, default=False, show_default=True,
17+
help="Include invoices with a CLOSED status.")
18+
@click.option('--limit', default=50, show_default=True,
19+
help="How many invoices to get back.")
2020
@environment.pass_env
2121
def cli(env, limit, closed=False, get_all=False):
2222
"""List invoices"""

SoftLayer/CLI/account/orders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@click.command(cls=SLCommand)
1414
@click.option('--limit', '-l',
1515
help='How many results to get in one api call',
16-
default=100,
16+
default=50,
1717
show_default=True)
1818
@environment.pass_env
1919
def cli(env, limit):

SoftLayer/CLI/block/replication/disaster_recovery_failover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
After using this method, to failback to the original volume, please open a support ticket.
1616
If you wish to test failover, please use replica-failover.""")
1717
@click.argument('volume-id')
18-
@click.option('--replicant-id', help="ID of the replicant volume")
18+
@click.option('--replicant-id', help="ID of the replicant volume.")
1919
@environment.pass_env
2020
def cli(env, volume_id, replicant_id):
2121
"""Failover an inaccessible block volume to its available replicant volume."""

SoftLayer/CLI/block/replication/failback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@click.argument('volume-id')
1111
@environment.pass_env
1212
def cli(env, volume_id):
13-
"""Failback a block volume from the given replicant volume."""
13+
"""Failback a block volume from the given replica volume."""
1414
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
1515

1616
success = block_storage_manager.failback_from_replicant(volume_id)

SoftLayer/CLI/block/replication/failover.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1010
@click.argument('volume-id')
11-
@click.option('--replicant-id', help="ID of the replicant volume")
11+
@click.option('--replicant-id', help="ID of the replicant volume.")
1212
@environment.pass_env
1313
def cli(env, volume_id, replicant_id):
14-
"""Failover a block volume to the given replicant volume."""
14+
"""Failover a block volume to the given replica volume."""
1515
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
1616

1717
success = block_storage_manager.failover_to_replicant(

SoftLayer/CLI/block/replication/locations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
2424
@click.argument('volume-id')
25-
@click.option('--sortby', help='Column to sort by', default='Long Name')
2625
@click.option('--columns',
2726
callback=column_helper.get_formatter(COLUMNS),
2827
help='Columns to display. Options: {0}'.format(
2928
', '.join(column.name for column in COLUMNS)),
3029
default=','.join(DEFAULT_COLUMNS))
30+
@click.option('--sortby', help='Column to sort by', default='Long Name')
3131
@environment.pass_env
3232
def cli(env, columns, sortby, volume_id):
3333
"""List suitable replication datacenters for the given volume."""

SoftLayer/CLI/block/replication/order.py

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,16 @@
1414

1515
@click.command(cls=SoftLayer.CLI.command.SLCommand, context_settings=CONTEXT_SETTINGS)
1616
@click.argument('volume_id')
17-
@click.option('--snapshot-schedule', '-s',
18-
help='Snapshot schedule to use for replication, '
19-
'(HOURLY | DAILY | WEEKLY)',
20-
required=True,
21-
type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY']))
22-
@click.option('--location', '-l',
23-
help='Short name of the data center for the replicant '
24-
'(e.g.: dal09)',
17+
@click.option('--datacenter', '-d',
18+
help='Short name of the datacenter for the replica (e.g.: dal09)',
2519
required=True)
26-
@click.option('--tier',
27-
help='Endurance Storage Tier (IOPS per GB) of the primary'
28-
' volume for which a replicant is ordered [optional]',
29-
type=click.Choice(['0.25', '2', '4', '10']))
30-
@click.option('--os-type',
31-
help='Operating System Type (e.g.: LINUX) of the primary'
32-
' volume for which a replica is ordered [optional]',
20+
@click.option('--iops', '-i',
21+
help='Performance Storage IOPs, between 100 and 6000 in multiples of 100. If no IOPS value is specified,'
22+
' the IOPS value of the original volume will be used.',
23+
type=int)
24+
@click.option('--os-type', '-o',
25+
help='Operating System Type (eg. LINUX) of the primary volume for '
26+
'which a replica is ordered [optional].',
3327
type=click.Choice([
3428
'HYPER_V',
3529
'LINUX',
@@ -38,22 +32,39 @@
3832
'WINDOWS_GPT',
3933
'WINDOWS',
4034
'XEN']))
35+
@click.option('--snapshot-schedule', '-s',
36+
help='Snapshot schedule to use for replication. Options are: '
37+
'HOURLY, DAILY, WEEKLY',
38+
required=True,
39+
type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY']))
40+
@click.option('--tier', '-t',
41+
help='Endurance Storage Tier (IOPS per GB) of the primary volume for which a replica is ordered '
42+
'[optional]. If no tier is specified, the tier of the original volume will be used',
43+
type=click.Choice(['0.25', '2', '4', '10']))
4144
@environment.pass_env
42-
def cli(env, volume_id, snapshot_schedule, location, tier, os_type):
45+
def cli(env, volume_id, snapshot_schedule, datacenter, tier, os_type, iops):
4346
"""Order a block storage replica volume."""
4447
block_manager = SoftLayer.BlockStorageManager(env.client)
4548
block_volume_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Block Volume')
4649

4750
if tier is not None:
4851
tier = float(tier)
4952

53+
if iops is not None:
54+
if iops < 100 or iops > 6000:
55+
raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not one "
56+
"of between 100 and 6000.")
57+
if iops % 100 != 0:
58+
raise exceptions.ArgumentError(f"Invalid value for '--iops' / '-i': '{iops}' is not a multiple of 100.")
59+
5060
try:
5161
order = block_manager.order_replicant_volume(
5262
block_volume_id,
5363
snapshot_schedule=snapshot_schedule,
54-
location=location,
64+
location=datacenter,
5565
tier=tier,
5666
os_type=os_type,
67+
iops=iops
5768
)
5869
except ValueError as ex:
5970
raise exceptions.ArgumentError(str(ex))

SoftLayer/CLI/block/replication/partners.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1616
@click.argument('volume-id')
17-
@click.option('--sortby', help='Column to sort by', default='Username')
1817
@click.option('--columns',
1918
callback=column_helper.get_formatter(COLUMNS),
2019
help='Columns to display. Options: {0}'.format(
2120
', '.join(column.name for column in COLUMNS)),
2221
default=','.join(DEFAULT_COLUMNS))
22+
@click.option('--sortby', help='Column to sort by', default='Username')
2323
@environment.pass_env
2424
def cli(env, columns, sortby, volume_id):
25-
"""List existing replicant volumes for a block volume."""
25+
"""List existing replica volumes for a block volume."""
2626
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
2727

2828
legal_volumes = block_storage_manager.get_replication_partners(

SoftLayer/CLI/virt/capture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def cli(env, identifier, name, all, note):
2929
table.align['name'] = 'r'
3030
table.align['value'] = 'l'
3131

32-
table.add_row(['vs_id', capture['guestId']])
32+
table.add_row(['globalIdentifier', capture['globalIdentifier']])
3333
table.add_row(['date', capture['createDate'][:10]])
3434
table.add_row(['time', capture['createDate'][11:19]])
3535
table.add_row(['transaction', formatting.transaction_status(capture)])

0 commit comments

Comments
 (0)