mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-16 17:01:30 +00:00
modules s[a-e]*: use f-strings (#10976)
* modules s[a-e]*: use f-strings * add changelog frag
This commit is contained in:
parent
32dd5f04c5
commit
73452acf84
28 changed files with 243 additions and 280 deletions
|
|
@ -141,8 +141,7 @@ def core(module):
|
|||
project = organization
|
||||
|
||||
if not response.ok:
|
||||
module.fail_json(msg='Error getting volume [{0}: {1}]'.format(
|
||||
status_code, response.json['message']))
|
||||
module.fail_json(msg=f"Error getting volume [{status_code}: {response.json['message']}]")
|
||||
|
||||
volumeByName = None
|
||||
for volume in volumes_json['volumes']:
|
||||
|
|
@ -160,8 +159,7 @@ def core(module):
|
|||
if response.ok:
|
||||
module.exit_json(changed=True, data=response.json)
|
||||
|
||||
module.fail_json(msg='Error creating volume [{0}: {1}]'.format(
|
||||
response.status_code, response.json))
|
||||
module.fail_json(msg=f'Error creating volume [{response.status_code}: {response.json}]')
|
||||
|
||||
elif state in ('absent',):
|
||||
if volumeByName is None:
|
||||
|
|
@ -170,12 +168,11 @@ def core(module):
|
|||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
|
||||
response = account_api.delete('/volumes/' + volumeByName['id'])
|
||||
response = account_api.delete(f"/volumes/{volumeByName['id']}")
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True, data=response.json)
|
||||
|
||||
module.fail_json(msg='Error deleting volume [{0}: {1}]'.format(
|
||||
response.status_code, response.json))
|
||||
module.fail_json(msg=f'Error deleting volume [{response.status_code}: {response.json}]')
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue