mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-27 11:29:09 -07:00
Fix linting errors; fix some real bugs (#5111)
* Fix linting errors. * Fix bugs. * Another linter error ignored. * More fixes. * Ignore sanity errors with older versions. ci_complete * Forgot to commit more changes.
This commit is contained in:
parent
0338eb7a7c
commit
a54af8909c
52 changed files with 115 additions and 94 deletions
|
@ -165,10 +165,10 @@ class BE(object):
|
|||
for line in out.splitlines():
|
||||
if self.is_freebsd:
|
||||
check = line.split()
|
||||
if(check == []):
|
||||
if check == []:
|
||||
continue
|
||||
full_name = check[0].split('/')
|
||||
if(full_name == []):
|
||||
if full_name == []:
|
||||
continue
|
||||
check[0] = full_name[len(full_name) - 1]
|
||||
if check[0] == self.name:
|
||||
|
|
|
@ -329,7 +329,7 @@ class Homectl(object):
|
|||
cmd = [self.module.get_bin_path('homectl', True)]
|
||||
cmd.append('create')
|
||||
cmd.append('--identity=-') # Read the user record from standard input.
|
||||
return(self.module.run_command(cmd, data=record))
|
||||
return self.module.run_command(cmd, data=record)
|
||||
|
||||
def _hash_password(self, password):
|
||||
method = crypt.METHOD_SHA512
|
||||
|
|
|
@ -84,6 +84,7 @@ try:
|
|||
import keyring
|
||||
|
||||
HAS_KEYRING = True
|
||||
KEYRING_IMP_ERR = None
|
||||
except ImportError:
|
||||
HAS_KEYRING = False
|
||||
KEYRING_IMP_ERR = traceback.format_exc()
|
||||
|
|
|
@ -74,6 +74,7 @@ try:
|
|||
import keyring
|
||||
|
||||
HAS_KEYRING = True
|
||||
KEYRING_IMP_ERR = None
|
||||
except ImportError:
|
||||
HAS_KEYRING = False
|
||||
KEYRING_IMP_ERR = traceback.format_exc()
|
||||
|
|
|
@ -363,7 +363,7 @@ def format_disk_size(size_bytes, unit):
|
|||
This function has been adapted from https://github.com/Distrotech/parted/blo
|
||||
b/279d9d869ff472c52b9ec2e180d568f0c99e30b0/libparted/unit.c
|
||||
"""
|
||||
global units_si, units_iec
|
||||
global units_si, units_iec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
unit = unit.lower()
|
||||
|
||||
|
@ -459,7 +459,7 @@ def get_device_info(device, unit):
|
|||
Fetches information about a disk and its partitions and it returns a
|
||||
dictionary.
|
||||
"""
|
||||
global module, parted_exec
|
||||
global module, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
# If parted complains about missing labels, it means there are no partitions.
|
||||
# In this case only, use a custom function to fetch information and emulate
|
||||
|
@ -486,7 +486,7 @@ def check_parted_label(device):
|
|||
to 3.1 don't return data when there is no label. For more information see:
|
||||
http://upstream.rosalinux.ru/changelogs/libparted/3.1/changelog.html
|
||||
"""
|
||||
global parted_exec
|
||||
global parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
# Check the version
|
||||
parted_major, parted_minor, dummy = parted_version()
|
||||
|
@ -532,7 +532,7 @@ def parted_version():
|
|||
"""
|
||||
Returns the major and minor version of parted installed on the system.
|
||||
"""
|
||||
global module, parted_exec
|
||||
global module, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
rc, out, err = module.run_command("%s --version" % parted_exec)
|
||||
if rc != 0:
|
||||
|
@ -551,7 +551,7 @@ def parted(script, device, align):
|
|||
"""
|
||||
Runs a parted script.
|
||||
"""
|
||||
global module, parted_exec
|
||||
global module, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
align_option = '-a %s' % align
|
||||
if align == 'undefined':
|
||||
|
@ -602,7 +602,7 @@ def check_size_format(size_str):
|
|||
|
||||
|
||||
def main():
|
||||
global module, units_si, units_iec, parted_exec
|
||||
global module, units_si, units_iec, parted_exec # pylint: disable=global-variable-not-assigned
|
||||
|
||||
changed = False
|
||||
output_script = ""
|
||||
|
|
|
@ -188,6 +188,7 @@ except ImportError:
|
|||
PYRFC_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_PYRFC_LIBRARY = True
|
||||
PYRFC_LIBRARY_IMPORT_ERROR = None
|
||||
try:
|
||||
import xmltodict
|
||||
except ImportError:
|
||||
|
@ -195,6 +196,7 @@ except ImportError:
|
|||
XMLTODICT_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_XMLTODICT_LIBRARY = True
|
||||
XMLTODICT_LIBRARY_IMPORT_ERROR = None
|
||||
|
||||
|
||||
def call_rfc_method(connection, method_name, kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue