mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Fix errors reported by pylint. (#23282)
* Fix pylint misplaced-bare-raise errors. * Fix pylint return-in-init error. * Fix pylint bad-format-character error. * Fix pylint too-many-format-args errors. * Fix pylint too-few-format-args errors. * Fix pylint truncated-format-string error.
This commit is contained in:
parent
9e1bf1c6f2
commit
48eeab8a53
15 changed files with 17 additions and 25 deletions
|
@ -372,7 +372,7 @@ def get_stack_facts(cfn, stack_name):
|
|||
#except AmazonCloudFormationException as e:
|
||||
except (botocore.exceptions.ValidationError,botocore.exceptions.ClientError) as err:
|
||||
error_msg = boto_exception(err)
|
||||
if 'does not exist'.format(stack_name) in error_msg:
|
||||
if 'does not exist' in error_msg:
|
||||
# missing stack, don't bail.
|
||||
return None
|
||||
|
||||
|
|
|
@ -305,7 +305,7 @@ def _delete_disks_when_detached(azure, wait_timeout, disk_names):
|
|||
azure.delete_disk(disk.name, True)
|
||||
disk_names.remove(disk_name)
|
||||
except AzureException as e:
|
||||
module.fail_json(msg="failed to get or delete disk, error was: %s" % (disk_name, str(e)))
|
||||
module.fail_json(msg="failed to get or delete disk %s, error was: %s" % (disk_name, str(e)))
|
||||
finally:
|
||||
signal.alarm(0)
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
try:
|
||||
response = self.network_client.network_interfaces.list_all()
|
||||
except Exception as exc:
|
||||
self.fail("Error listing all - {1}".format(self.resource_group, str(exc)))
|
||||
self.fail("Error listing all - {0}".format(str(exc)))
|
||||
|
||||
results = []
|
||||
for item in response:
|
||||
|
|
|
@ -200,8 +200,7 @@ class AzureRMResourceGroup(AzureRMModuleBase):
|
|||
# Create resource group
|
||||
self.log("Creating resource group {0}".format(self.name))
|
||||
if not self.location:
|
||||
self.fail("Parameter error: location is required when creating a resource "
|
||||
"group.".format(self.name))
|
||||
self.fail("Parameter error: location is required when creating a resource group.")
|
||||
if self.name_exists():
|
||||
self.fail("Error: a resource group with the name {0} already exists in your subscription."
|
||||
.format(self.name))
|
||||
|
|
|
@ -688,8 +688,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
except CloudError:
|
||||
self.log('Virtual machine {0} does not exist'.format(self.name))
|
||||
if self.state == 'present':
|
||||
self.log("CHANGED: virtual machine does not exist but state is present." \
|
||||
.format(self.name))
|
||||
self.log("CHANGED: virtual machine {0} does not exist but state is 'present'.".format(self.name))
|
||||
changed = True
|
||||
|
||||
self.results['changed'] = changed
|
||||
|
@ -887,7 +886,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
vm = self.compute_client.virtual_machines.get(self.resource_group, self.name, expand='instanceview')
|
||||
return vm
|
||||
except Exception as exc:
|
||||
self.fail("Error getting virtual machine (0) - {1}".format(self.name, str(exc)))
|
||||
self.fail("Error getting virtual machine {0} - {1}".format(self.name, str(exc)))
|
||||
|
||||
def serialize_vm(self, vm):
|
||||
'''
|
||||
|
|
|
@ -449,7 +449,7 @@ class RHEVConn(object):
|
|||
currentdisk = VM.disks.get(name=diskname)
|
||||
if attempt == 100:
|
||||
setMsg("Error, disk %s, state %s" % (diskname, str(currentdisk.status.state)))
|
||||
raise
|
||||
raise Exception()
|
||||
else:
|
||||
attempt += 1
|
||||
time.sleep(2)
|
||||
|
@ -489,7 +489,7 @@ class RHEVConn(object):
|
|||
currentnic = VM.nics.get(name=nicname)
|
||||
if attempt == 100:
|
||||
setMsg("Error, iface %s, state %s" % (nicname, str(currentnic.active)))
|
||||
raise
|
||||
raise Exception()
|
||||
else:
|
||||
attempt += 1
|
||||
time.sleep(2)
|
||||
|
|
|
@ -178,7 +178,7 @@ def _create_stack(module, stack, cloud):
|
|||
return stack
|
||||
else:
|
||||
return False
|
||||
module.fail_json(msg = "Failure in creating stack: ".format(stack))
|
||||
module.fail_json(msg="Failure in creating stack: {0}".format(stack))
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue