Skip to content

Commit 5764106

Browse files
committed
Merge branch 'master' into issue1989
2 parents c94209d + 5509391 commit 5764106

File tree

108 files changed

+226
-260
lines changed

Some content is hidden

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

108 files changed

+226
-260
lines changed

SoftLayer/CLI/block/access/list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
@click.argument('volume_id')
1515
@click.option('--columns',
1616
callback=column_helper.get_formatter(storage_utils.COLUMNS),
17-
help=f"Columns to display. Options are: { ', '.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)}.",
1818
default=','.join(storage_utils.DEFAULT_COLUMNS))
1919
@click.option('--sortby',
20-
help=f"Column to sort by. Options are: { ', '.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)}.",
2121
default='name')
2222
@environment.pass_env
2323
def cli(env, columns, sortby, volume_id):

SoftLayer/CLI/block/list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +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=f"Columns to display. Options: { ', '.join(column.name for column in COLUMNS)}",
63+
help=f"Columns to display. Options: {', '.join(column.name for column in COLUMNS)}",
6464
default=','.join(DEFAULT_COLUMNS))
6565
@environment.pass_env
6666
def cli(env, sortby, columns, datacenter, username, storage_type, order):

SoftLayer/CLI/block/replication/locations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@click.argument('volume-id')
2525
@click.option('--columns',
2626
callback=column_helper.get_formatter(COLUMNS),
27-
help=f"Columns to display. Options: { ', '.join(column.name for column in COLUMNS)}",
27+
help=f"Columns to display. Options: {', '.join(column.name for column in COLUMNS)}",
2828
default=','.join(DEFAULT_COLUMNS))
2929
@click.option('--sortby', help='Column to sort by', default='Long Name')
3030
@environment.pass_env

SoftLayer/CLI/block/replication/partners.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@click.argument('volume-id')
1717
@click.option('--columns',
1818
callback=column_helper.get_formatter(COLUMNS),
19-
help=f"Columns to display. Options: { ', '.join(column.name for column in COLUMNS)}",
19+
help=f"Columns to display. Options: {', '.join(column.name for column in COLUMNS)}",
2020
default=','.join(DEFAULT_COLUMNS))
2121
@click.option('--sortby', help='Column to sort by', default='Username')
2222
@environment.pass_env

SoftLayer/CLI/block/snapshot/list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
default='created')
3333
@click.option('--columns',
3434
callback=column_helper.get_formatter(COLUMNS),
35-
help=f"Columns to display. Options: { ', '.join(column.name for column in COLUMNS)}",
35+
help=f"Columns to display. Options: {', '.join(column.name for column in COLUMNS)}",
3636
default=','.join(DEFAULT_COLUMNS))
3737
@environment.pass_env
3838
def cli(env, volume_id, sortby, columns):

SoftLayer/CLI/call_api.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ def _validate_filter(ctx, param, value): # pylint: disable=unused-argument
7777
try:
7878
_filter = json.loads(value)
7979
if not isinstance(_filter, dict):
80-
raise exceptions.CLIAbort("\"{}\" should be a JSON object, but is a {} instead.".
81-
format(_filter, type(_filter)))
80+
raise exceptions.CLIAbort(f"\"{_filter}\" should be a JSON object, but is a {type(_filter)} instead.")
8281
except json.JSONDecodeError as error:
83-
raise exceptions.CLIAbort("\"{}\" is not valid JSON. {}".format(value, error))
82+
raise exceptions.CLIAbort(f"\"{value}\" is not valid JSON. {error}")
8483

8584
return _filter
8685

@@ -96,8 +95,8 @@ def _validate_parameters(ctx, param, value): # pylint: disable=unused-argument
9695
try:
9796
parameter = json.loads(parameter)
9897
except json.JSONDecodeError as error:
99-
click.secho("{} looked like json, but was invalid, passing to API as is. {}".
100-
format(parameter, error), fg='red')
98+
click.secho(f"{parameter} looked like json, but was invalid, passing to API as is. {error}",
99+
fg='red')
101100
validated_values.append(parameter)
102101
return validated_values
103102

SoftLayer/CLI/cdn/delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def cli(env, unique_id):
1818
cdn = manager.delete_cdn(unique_id)
1919

2020
if cdn:
21-
env.fout("Cdn with uniqueId: {} was deleted.".format(unique_id))
21+
env.fout(f"Cdn with uniqueId: {unique_id} was deleted.")

SoftLayer/CLI/config/setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def ibmid_login(env):
171171
user = client.call('SoftLayer_Account', 'getCurrentUser', mask="mask[id,username,apiAuthenticationKeys]")
172172

173173
if len(user.get('apiAuthenticationKeys', [])) == 0:
174-
env.fout("Creating a Classic Infrastrucutre API key for {}".format(user['username']))
174+
env.fout(f"Creating a Classic Infrastrucutre API key for {user['username']}")
175175
api_key = client.call('User_Customer', 'addApiAuthenticationKey', id=user['id'])
176176
else:
177177
api_key = user['apiAuthenticationKeys'][0]['authenticationKey']
@@ -188,7 +188,7 @@ def get_accounts(env, a_token):
188188
'User-Agent': USER_AGENT,
189189
'Accept': 'application/json'
190190
}
191-
headers['Authorization'] = 'Bearer {}'.format(a_token)
191+
headers['Authorization'] = f'Bearer {a_token}'
192192
response = iam_client.request(
193193
'GET',
194194
'https://accounts.cloud.ibm.com/v1/accounts',
@@ -212,7 +212,7 @@ def get_accounts(env, a_token):
212212
ims_id = link.get('id')
213213
if ims_id is None:
214214
ims_id = "Unlinked"
215-
env.fout("{}: {} ({})".format(counter, utils.lookup(selected, 'entity', 'name'), ims_id))
215+
env.fout(f"{counter}: {utils.lookup(selected, 'entity', 'name')} ({ims_id})")
216216
counter = counter + 1
217217
ims_id = None # Reset ims_id to avoid any mix-match or something.
218218
choice = click.prompt('Enter a number', type=int)
@@ -225,7 +225,7 @@ def get_accounts(env, a_token):
225225
if link.get('origin') == "IMS":
226226
ims_id = link.get('id')
227227

228-
print("Using account {}".format(utils.lookup(selected, 'entity', 'name')))
228+
print(f"Using account {utils.lookup(selected, 'entity', 'name')}")
229229
return {"account_id": account_id, "ims_id": ims_id}
230230

231231

@@ -253,7 +253,7 @@ def get_sso_url():
253253
def sso_login(env):
254254
"""Uses a SSO token to get a SL apikey"""
255255
passcode_url = get_sso_url()
256-
env.fout("Get a one-time code from {} to proceed.".format(passcode_url))
256+
env.fout(f"Get a one-time code from {passcode_url} to proceed.")
257257
open_browser = env.input("Open the URL in the default browser? [Y/n]", default='Y')
258258
if open_browser.lower() == 'y':
259259
webbrowser.open(passcode_url)
@@ -274,7 +274,7 @@ def sso_login(env):
274274
user = client.call('SoftLayer_Account', 'getCurrentUser', mask="mask[id,username,apiAuthenticationKeys]")
275275

276276
if len(user.get('apiAuthenticationKeys', [])) == 0:
277-
env.fout("Creating a Classic Infrastrucutre API key for {}".format(user['username']))
277+
env.fout(f"Creating a Classic Infrastrucutre API key for {user['username']}")
278278
api_key = client.call('User_Customer', 'addApiAuthenticationKey', id=user['id'])
279279
else:
280280
api_key = user['apiAuthenticationKeys'][0]['authenticationKey']

SoftLayer/CLI/core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def get_latest_version():
4646
try:
4747
result = requests.get('https://pypi.org/pypi/SoftLayer/json', timeout=60)
4848
json_result = result.json()
49-
latest = 'v{}'.format(json_result['info']['version'])
49+
latest = f"v{json_result['info']['version']}"
5050
except Exception:
5151
latest = "Unable to get version from pypi."
5252
return latest
@@ -65,8 +65,7 @@ def get_version_message(ctx, param, value):
6565
return
6666
current = SoftLayer.consts.VERSION
6767
latest = get_latest_version()
68-
click.secho("Current: {prog} {current}\nLatest: {prog} {latest}".format(
69-
prog=PROG_NAME, current=current, latest=latest))
68+
click.secho(f"Current: {PROG_NAME} {current}\nLatest: {PROG_NAME} {latest}")
7069
ctx.exit()
7170

7271

@@ -158,7 +157,7 @@ def output_diagnostics(env, result, verbose=0, **kwargs):
158157

159158
if verbose > 1:
160159
for call in env.client.transport.get_last_calls():
161-
call_table = formatting.Table(['', '{}::{}'.format(call.service, call.method)], align="left")
160+
call_table = formatting.Table(['', f'{call.service}::{call.method}'], align="left")
162161
nice_mask = ''
163162
if call.mask is not None:
164163
nice_mask = call.mask

SoftLayer/CLI/custom_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ def convert(self, value, param, ctx):
3030
ip_address, cidr = address
3131
return (ip_address, int(cidr))
3232
except ValueError:
33-
self.fail('{} is not a valid network'.format(value), param, ctx)
33+
self.fail(f'{value} is not a valid network', param, ctx)

0 commit comments

Comments
 (0)