1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix pylint and pep8 issues exposed by latest ansible-core's ansible-test sanity checks (#8720)

* Remove bad whitespace.

* 'Fixing' various used-before-assignment issues that pylint flagged.
This commit is contained in:
Felix Fontein 2024-08-07 15:18:58 +02:00 committed by GitHub
parent 5b2711bbd3
commit 9a16eaf9ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 16 additions and 1 deletions

View file

@ -88,6 +88,10 @@ class ActionModule(ActionBase):
max_timeout = self._connection._play_context.timeout max_timeout = self._connection._play_context.timeout
module_args = self._task.args module_args = self._task.args
async_status_args = {}
starter_cmd = None
confirm_cmd = None
if module_args.get('state', None) == 'restored': if module_args.get('state', None) == 'restored':
if not wrap_async: if not wrap_async:
if not check_mode: if not check_mode:

View file

@ -356,6 +356,7 @@ class OpenTelemetrySource(object):
status = Status(status_code=StatusCode.OK) status = Status(status_code=StatusCode.OK)
if host_data.status != 'included': if host_data.status != 'included':
# Support loops # Support loops
enriched_error_message = None
if 'results' in host_data.result._result: if 'results' in host_data.result._result:
if host_data.status == 'failed': if host_data.status == 'failed':
message = self.get_error_message_from_results(host_data.result._result['results'], task_data.action) message = self.get_error_message_from_results(host_data.result._result['results'], task_data.action)

View file

@ -29,6 +29,7 @@ class iLORedfishUtils(RedfishUtils):
result['ret'] = True result['ret'] = True
data = response['data'] data = response['data']
current_session = None
if 'Oem' in data: if 'Oem' in data:
if data["Oem"]["Hpe"]["Links"]["MySession"]["@odata.id"]: if data["Oem"]["Hpe"]["Links"]["MySession"]["@odata.id"]:
current_session = data["Oem"]["Hpe"]["Links"]["MySession"]["@odata.id"] current_session = data["Oem"]["Hpe"]["Links"]["MySession"]["@odata.id"]

View file

@ -192,6 +192,7 @@ def main():
rmitab = module.get_bin_path('rmitab') rmitab = module.get_bin_path('rmitab')
chitab = module.get_bin_path('chitab') chitab = module.get_bin_path('chitab')
rc = 0 rc = 0
err = None
# check if the new entry exists # check if the new entry exists
current_entry = check_current_entry(module) current_entry = check_current_entry(module)

View file

@ -183,6 +183,7 @@ class CronVar(object):
fileh = open(backup_file, 'w') fileh = open(backup_file, 'w')
elif self.cron_file: elif self.cron_file:
fileh = open(self.cron_file, 'w') fileh = open(self.cron_file, 'w')
path = None
else: else:
filed, path = tempfile.mkstemp(prefix='crontab') filed, path = tempfile.mkstemp(prefix='crontab')
fileh = os.fdopen(filed, 'w') fileh = os.fdopen(filed, 'w')

View file

@ -459,6 +459,7 @@ def main():
if not os.access(b_path, os.R_OK): if not os.access(b_path, os.R_OK):
module.fail_json(msg="Source %s not readable" % path) module.fail_json(msg="Source %s not readable" % path)
state_to_restore = read_state(b_path) state_to_restore = read_state(b_path)
cmd = None
else: else:
cmd = ' '.join(SAVECOMMAND) cmd = ' '.join(SAVECOMMAND)

View file

@ -181,6 +181,7 @@ def api_validation(args=None):
https://www.memset.com/apidocs/methods_dns.html#dns.zone_record_create) https://www.memset.com/apidocs/methods_dns.html#dns.zone_record_create)
''' '''
failed_validation = False failed_validation = False
error = None
# priority can only be integer 0 > 999 # priority can only be integer 0 > 999
if not 0 <= args['priority'] <= 999: if not 0 <= args['priority'] <= 999:

View file

@ -740,6 +740,8 @@ class ProxmoxLxcAnsible(ProxmoxAnsible):
# If not, we have proxmox create one using the special syntax # If not, we have proxmox create one using the special syntax
except Exception: except Exception:
vol_string = "{storage}:{size}".format(storage=storage, size=size) vol_string = "{storage}:{size}".format(storage=storage, size=size)
else:
raise AssertionError('Internal error')
# 1.3 If we have a host_path, we don't have storage, a volume, or a size # 1.3 If we have a host_path, we don't have storage, a volume, or a size
vol_string = ",".join( vol_string = ",".join(

View file

@ -544,6 +544,7 @@ class ProxmoxDiskAnsible(ProxmoxAnsible):
# NOOP # NOOP
return False, "Disk %s not found in VM %s and creation was disabled in parameters." % (disk, vmid) return False, "Disk %s not found in VM %s and creation was disabled in parameters." % (disk, vmid)
timeout_str = "Reached timeout. Last line in task before timeout: %s"
if (create == 'regular' and disk not in vm_config) or (create == 'forced'): if (create == 'regular' and disk not in vm_config) or (create == 'forced'):
# CREATE # CREATE
playbook_config = self.get_create_attributes() playbook_config = self.get_create_attributes()

View file

@ -307,6 +307,8 @@ def main():
if m_args['community'] is None: if m_args['community'] is None:
module.fail_json(msg='Community not set when using snmp version 2') module.fail_json(msg='Community not set when using snmp version 2')
integrity_proto = None
privacy_proto = None
if m_args['version'] == "v3": if m_args['version'] == "v3":
if m_args['username'] is None: if m_args['username'] is None:
module.fail_json(msg='Username not set when using snmp version 3') module.fail_json(msg='Username not set when using snmp version 3')