Skip to content

Commit eb36663

Browse files
Merge pull request #1982 from ramkishor-ch/issue_1981
F-Strings - hardware / image / lb
2 parents 4e99409 + f27b43b commit eb36663

File tree

16 files changed

+41
-40
lines changed

16 files changed

+41
-40
lines changed

SoftLayer/CLI/hardware/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def cli(env, **args):
104104
if do_create:
105105
for pod in pods:
106106
if args.get('datacenter') in pod['name']:
107-
click.secho('Warning: Closed soon: {}'.format(pod['name']), fg='yellow')
107+
click.secho(f"Warning: Closed soon: {pod['name']}", fg='yellow')
108108
if not (env.skip_confirmations or formatting.confirm(
109109
"This action will incur charges on your account. Continue?")):
110110
raise exceptions.CLIAbort('Aborting dedicated server order.')

SoftLayer/CLI/hardware/detail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def cli(env, identifier, passwords, price, components):
6666
table.add_row(['created', result['provisionDate'] or formatting.blank()])
6767
table.add_row(['owner', owner or formatting.blank()])
6868

69-
last_transaction = "{} ({})".format(utils.lookup(result, 'lastTransaction', 'transactionGroup', 'name'),
70-
utils.clean_time(utils.lookup(result, 'lastTransaction', 'modifyDate')))
69+
last_transaction = f"{utils.lookup(result, 'lastTransaction', 'transactionGroup', 'name')} \
70+
({utils.clean_time(utils.lookup(result, 'lastTransaction', 'modifyDate'))})"
7171

7272
table.add_row(['last_transaction', last_transaction])
7373
table.add_row(['billing', 'Hourly' if result['hourlyBillingFlag'] else 'Monthly'])

SoftLayer/CLI/hardware/dns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ def cli(env, identifier, a_record, aaaa_record, ptr, ttl):
6161
ipv6 = instance['primaryNetworkComponent']['primaryVersion6IpAddressRecord']['ipAddress']
6262
dns.sync_host_record(zone_id, instance['hostname'], ipv6, 'aaaa', ttl)
6363
except KeyError as ex:
64-
message = "{} does not have an ipv6 address".format(instance['fullyQualifiedDomainName'])
64+
message = f"{instance['fullyQualifiedDomainName']} does not have an ipv6 address"
6565
raise exceptions.CLIAbort(message) from ex

SoftLayer/CLI/hardware/notification_add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ def cli(env, identifier, users):
3030
notification['user']['username'], notification['user']['email'],
3131
notification['user']['firstName'], notification['user']['lastName']])
3232
else:
33-
raise exceptions.CLIAbort("User not found: {}.".format(user))
33+
raise exceptions.CLIAbort(f"User not found: {user}.")
3434
env.fout(table)

SoftLayer/CLI/hardware/notification_delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def cli(env, identifier):
1818
result = hardware.remove_notification(identifier)
1919

2020
if result:
21-
env.fout("The hardware notification instance: {} was deleted.".format(identifier))
21+
env.fout(f"The hardware notification instance: {identifier} was deleted.")

SoftLayer/CLI/image/share.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ def cli(env, identifier, account_id):
2020
shared_image = image_mgr.share_image(image_id, account_id)
2121

2222
if shared_image:
23-
env.fout("Image template {} was shared to account {}.".format(identifier, account_id))
23+
env.fout(f"Image template {identifier} was shared to account {account_id}.")

SoftLayer/CLI/image/share_deny.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ def cli(env, identifier, account_id):
2020
shared_image = image_mgr.deny_share_image(image_id, account_id)
2121

2222
if shared_image:
23-
env.fout("Image template {} was deny shared to account {}.".format(identifier, account_id))
23+
env.fout(f"Image template {identifier} was deny shared to account {account_id}.")

SoftLayer/CLI/licenses/cancel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ def cli(env, key, immediate):
1919
item = licenses.cancel_item(key, immediate)
2020

2121
if item:
22-
env.fout("License key: {} was cancelled.".format(key))
22+
env.fout(f"License key: {key} was cancelled.")

SoftLayer/CLI/loadbal/detail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def lbaas_table(this_lb):
3434
table.add_row(['Type', SoftLayer.LoadBalancerManager.TYPE.get(this_lb.get('type'))])
3535
table.add_row(['Location', utils.lookup(this_lb, 'datacenter', 'longName')])
3636
table.add_row(['Description', this_lb.get('description')])
37-
table.add_row(['Status', "{} / {}".format(this_lb.get('provisioningStatus'), this_lb.get('operatingStatus'))])
37+
table.add_row(['Status', f"{this_lb.get('provisioningStatus')} / {this_lb.get('operatingStatus')}"])
3838

3939
listener_table, pools = get_listener_table(this_lb)
4040
table.add_row(['Protocols', listener_table])
@@ -122,9 +122,9 @@ def get_listener_table(this_lb):
122122
listener_table = formatting.Table(['UUID', 'Max Connection', 'Mapping', 'Balancer', 'Modify', 'Active'])
123123
for listener in this_lb.get('listeners', []):
124124
pool = listener.get('defaultPool')
125-
priv_map = "{}:{}".format(pool['protocol'], pool['protocolPort'])
125+
priv_map = f"{pool['protocol']}:{pool['protocolPort']}"
126126
pools[pool['uuid']] = priv_map
127-
mapping = "{}:{} -> {}".format(listener.get('protocol'), listener.get('protocolPort'), priv_map)
127+
mapping = f"{listener.get('protocol')}:{listener.get('protocolPort')} -> {priv_map}"
128128
listener_table.add_row([
129129
listener.get('uuid'),
130130
listener.get('connectionLimit', 'None'),

SoftLayer/CLI/loadbal/health.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def cli(env, identifier, uuid, interval, retry, timeout, url):
3131
mgr = SoftLayer.LoadBalancerManager(env.client)
3232
# Need to get the LBaaS uuid if it wasn't supplied
3333
lb_uuid, lb_id = mgr.get_lbaas_uuid_id(identifier)
34-
print("UUID: {}, ID: {}".format(lb_uuid, lb_id))
34+
print(f"UUID: {lb_uuid}, ID: {lb_id}")
3535

3636
# Get the current health checks, and find the one we are updating.
3737
mask = "mask[healthMonitors, listeners[uuid,defaultPool[healthMonitor]]]"
@@ -58,7 +58,7 @@ def cli(env, identifier, uuid, interval, retry, timeout, url):
5858

5959
try:
6060
mgr.update_lb_health_monitors(lb_uuid, [check])
61-
click.secho('Health Check {} updated successfully'.format(uuid), fg='green')
61+
click.secho(f'Health Check {uuid} updated successfully', fg='green')
6262
except SoftLayerAPIError as exception:
63-
click.secho('Failed to update {}'.format(uuid), fg='red')
64-
click.secho("ERROR: {}".format(exception.faultString), fg='red')
63+
click.secho(f'Failed to update {uuid}', fg='red')
64+
click.secho(f"ERROR: {exception.faultString}", fg='red')

0 commit comments

Comments
 (0)