Skip to content

Commit aaaca0a

Browse files
committed
Merge branch 'master' into issue1969
2 parents f6830c8 + 90faebb commit aaaca0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1239
-240
lines changed

SoftLayer/CLI/account/billing_items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def item_table(items, ordered=None):
4242
table.align['Category Code'] = 'l'
4343
for item in items:
4444
description = item.get('description')
45-
fqdn = "{}.{}".format(item.get('hostName', ''), item.get('domainName', ''))
45+
fqdn = f"{item.get('hostName', '')}.{item.get('domainName', '')}"
4646
if fqdn != ".":
4747
description = fqdn
4848
user = utils.lookup(item, 'orderItem', 'order', 'userRecord')

SoftLayer/CLI/account/cancel_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ def cli(env, identifier):
1717
item = manager.cancel_item(identifier)
1818

1919
if item:
20-
env.fout("Item: {} was cancelled.".format(identifier))
20+
env.fout(f"Item: {identifier} was cancelled.")

SoftLayer/CLI/account/item_detail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def item_table(item):
2323
"""Formats a table for billing items"""
2424

2525
date_format = '%Y-%m-%d'
26-
table = formatting.Table(["Key", "Value"], title="{}".format(item.get('description', 'Billing Item')))
26+
table = formatting.Table(["Key", "Value"], title=f"{item.get('description', 'Billing Item')}")
2727
table.add_row(['createDate', utils.clean_time(item.get('createDate'), date_format, date_format)])
2828
table.add_row(['cycleStartDate', utils.clean_time(item.get('cycleStartDate'), date_format, date_format)])
2929
table.add_row(['cancellationDate', utils.clean_time(item.get('cancellationDate'), date_format, date_format)])
3030
table.add_row(['description', item.get('description')])
3131
table.align = 'l'
32-
fqdn = "{}.{}".format(item.get('hostName', ''), item.get('domainName', ''))
32+
fqdn = f"{item.get('hostName', '')}.{item.get('domainName', '')}"
3333
if fqdn != ".":
3434
table.add_row(['FQDN', fqdn])
3535

@@ -43,7 +43,7 @@ def item_table(item):
4343
ordered_by = "IBM"
4444
user = utils.lookup(item, 'orderItem', 'order', 'userRecord')
4545
if user:
46-
ordered_by = "{} ({})".format(user.get('displayName'), utils.lookup(user, 'userStatus', 'name'))
46+
ordered_by = f"{user.get('displayName')} ({utils.lookup(user, 'userStatus', 'name')})"
4747
table.add_row(['Ordered By', ordered_by])
4848
table.add_row(['Notes', item.get('notes')])
4949
table.add_row(['Location', utils.lookup(item, 'location', 'name')])

SoftLayer/CLI/bandwidth/pools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ def cli(env):
3939
name = item.get('name')
4040
region = utils.lookup(item, 'locationGroup', 'name')
4141
servers = manager.get_bandwidth_pool_counts(identifier=item.get('id'))
42-
allocation = "{} GB".format(item.get('totalBandwidthAllocated', 0))
42+
allocation = f"{item.get('totalBandwidthAllocated', 0)} GB"
4343

4444
current = utils.lookup(item, 'billingCyclePublicBandwidthUsage', 'amountOut')
4545
if current is not None:
46-
current = "{} GB".format(current)
46+
current = f"{current} GB"
4747
else:
4848
current = "0 GB"
4949

50-
projected = "{} GB".format(item.get('projectedPublicBandwidthUsage', 0))
50+
projected = f"{item.get('projectedPublicBandwidthUsage', 0)} GB"
5151

5252
cost = utils.lookup(item, 'billingItem', 'nextInvoiceTotalRecurringAmount')
5353
if cost is not None:
54-
cost = "${}".format(cost)
54+
cost = f"${cost}"
5555
else:
5656
cost = "$0.0"
5757

SoftLayer/CLI/bandwidth/pools_detail.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ def cli(env, identifier):
2424
table.add_row(['Id', bandwidths['id']])
2525
table.add_row(['Name', bandwidths['name']])
2626
table.add_row(['Create Date', utils.clean_time(bandwidths.get('createDate'), '%Y-%m-%d')])
27-
current = "{} GB".format(utils.lookup(bandwidths, 'billingCyclePublicBandwidthUsage', 'amountOut'))
27+
current = f"{utils.lookup(bandwidths, 'billingCyclePublicBandwidthUsage', 'amountOut')} GB"
2828
if current is None:
2929
current = '-'
3030
table.add_row(['Current Usage', current])
31-
projected = "{} GB".format(bandwidths.get('projectedPublicBandwidthUsage', 0))
31+
projected = f"{bandwidths.get('projectedPublicBandwidthUsage', 0)} GB"
3232
if projected is None:
3333
projected = '-'
3434
table.add_row(['Projected Usage', projected])
35-
inbound = "{} GB".format(bandwidths.get('inboundPublicBandwidthUsage', 0))
35+
inbound = f"{bandwidths.get('inboundPublicBandwidthUsage', 0)} GB"
3636
if inbound is None:
3737
inbound = '-'
3838
table.add_row(['Inbound Usage', inbound])
@@ -58,8 +58,8 @@ def _bw_table(bw_data):
5858
"""Generates a bandwidth useage table"""
5959
table_data = formatting.Table(['Id', 'HostName', "IP Address", 'Amount', "Current Usage"])
6060
for bw_point in bw_data:
61-
amount = "{} GB".format(utils.lookup(bw_point, 'bandwidthAllotmentDetail', 'allocation', 'amount'))
62-
current = "{} GB".format(bw_point.get('outboundBandwidthUsage', 0))
61+
amount = f"{utils.lookup(bw_point, 'bandwidthAllotmentDetail', 'allocation', 'amount')} GB"
62+
current = f"{bw_point.get('outboundBandwidthUsage', 0)} GB"
6363
ip_address = bw_point.get('primaryIpAddress')
6464
if ip_address is None:
6565
ip_address = '-'
@@ -71,8 +71,8 @@ def _virtual_table(bw_data):
7171
"""Generates a virtual bandwidth usage table"""
7272
table_data = formatting.Table(['Id', 'HostName', "IP Address", 'Amount', "Current Usage"])
7373
for bw_point in bw_data:
74-
amount = "{} GB".format(utils.lookup(bw_point, 'bandwidthAllotmentDetail', 'allocation', 'amount'))
75-
current = "{} GB".format(bw_point.get('outboundBandwidthUsage', 0))
74+
amount = f"{utils.lookup(bw_point, 'bandwidthAllotmentDetail', 'allocation', 'amount')} GB"
75+
current = f"{bw_point.get('outboundBandwidthUsage', 0)} GB"
7676
ip_address = bw_point.get('primaryIpAddress')
7777
if ip_address is None:
7878
ip_address = '-'

SoftLayer/CLI/block/access/list.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
@click.argument('volume_id')
1515
@click.option('--columns',
1616
callback=column_helper.get_formatter(storage_utils.COLUMNS),
17-
help='Columns to display. Options are: {0}.'.format(
18-
', '.join(column.name for column in storage_utils.COLUMNS)),
17+
help=f"Columns to display. Options are: { ', '.join(column.name for column in storage_utils.COLUMNS)}.",
1918
default=','.join(storage_utils.DEFAULT_COLUMNS))
2019
@click.option('--sortby',
21-
help='Column to sort by. Options are: {0}.'.format(
22-
', '.join(column.name for column in storage_utils.COLUMNS)),
20+
help=f"Column to sort by. Options are: { ', '.join(column.name for column in storage_utils.COLUMNS)}.",
2321
default='name')
2422
@environment.pass_env
2523
def cli(env, columns, sortby, volume_id):

SoftLayer/CLI/block/detail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def cli(env, volume_id):
112112
original_volume_info.add_row(['Original Snapshot Name', block_volume['originalSnapshotName']])
113113
table.add_row(['Original Volume Properties', original_volume_info])
114114

115-
notes = '{}'.format(block_volume.get('notes', ''))
115+
notes = f"{block_volume.get('notes', '')}"
116116
table.add_row(['Notes', notes])
117117

118118
env.fout(table)

SoftLayer/CLI/block/duplicate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ def cli(env, origin_volume_id, origin_snapshot_id, duplicate_size,
8989
raise exceptions.ArgumentError(str(ex))
9090

9191
if 'placedOrder' in order.keys():
92-
click.echo("Order #{0} placed successfully!".format(
93-
order['placedOrder']['id']))
92+
click.echo(f"Order #{order['placedOrder']['id']} placed successfully!")
9493
for item in order['placedOrder']['items']:
9594
click.echo(" > %s" % item['description'])
9695
else:

SoftLayer/CLI/block/list.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@
6060
@click.option('--sortby', help='Column to sort by', default='username')
6161
@click.option('--columns',
6262
callback=column_helper.get_formatter(COLUMNS),
63-
help='Columns to display. Options: {0}'.format(
64-
', '.join(column.name for column in COLUMNS)),
63+
help=f"Columns to display. Options: { ', '.join(column.name for column in COLUMNS)}",
6564
default=','.join(DEFAULT_COLUMNS))
6665
@environment.pass_env
6766
def cli(env, sortby, columns, datacenter, username, storage_type, order):

SoftLayer/CLI/block/modify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def cli(env, volume_id, new_size, new_iops, new_tier):
5050
raise exceptions.ArgumentError(str(ex))
5151

5252
if 'placedOrder' in order.keys():
53-
click.echo("Order #{0} placed successfully!".format(order['placedOrder']['id']))
53+
click.echo(f"Order #{order['placedOrder']['id']} placed successfully!")
5454
for item in order['placedOrder']['items']:
5555
click.echo(" > %s" % item['description'])
5656
else:

0 commit comments

Comments
 (0)