mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
PEP 8 E111 & E114 cleanup. (#20838)
This commit is contained in:
@@ -376,9 +376,9 @@ class AzureRMModuleBase(object):
|
||||
dependencies = dict()
|
||||
if enum_modules:
|
||||
for module_name in enum_modules:
|
||||
mod = importlib.import_module(module_name)
|
||||
for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass):
|
||||
dependencies[mod_class_name] = mod_class_obj
|
||||
mod = importlib.import_module(module_name)
|
||||
for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass):
|
||||
dependencies[mod_class_name] = mod_class_obj
|
||||
self.log("dependencies: ")
|
||||
self.log(str(dependencies))
|
||||
serializer = Serializer(classes=dependencies)
|
||||
|
||||
@@ -1399,7 +1399,7 @@ class AnsibleModule(object):
|
||||
','.join(sorted(list(unsupported_parameters))),
|
||||
','.join(sorted(self.argument_spec.keys()))))
|
||||
if self.check_mode and not self.supports_check_mode:
|
||||
self.exit_json(skipped=True, msg="remote module (%s) does not support check mode" % self._name)
|
||||
self.exit_json(skipped=True, msg="remote module (%s) does not support check mode" % self._name)
|
||||
|
||||
def _count_terms(self, check):
|
||||
count = 0
|
||||
|
||||
@@ -249,7 +249,7 @@ class AnsibleDockerClient(Client):
|
||||
tls_config = TLSConfig(**kwargs)
|
||||
return tls_config
|
||||
except TLSParameterError as exc:
|
||||
self.fail("TLS config error: %s" % exc)
|
||||
self.fail("TLS config error: %s" % exc)
|
||||
|
||||
def _get_connect_params(self):
|
||||
auth = self.auth_params
|
||||
|
||||
@@ -68,7 +68,7 @@ def run_commands(module, commands):
|
||||
module.fail_json(msg=err)
|
||||
|
||||
try:
|
||||
out = module.from_json(out)
|
||||
out = module.from_json(out)
|
||||
except ValueError:
|
||||
out = str(out).strip()
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ class Facts(object):
|
||||
|
||||
def get_pkg_mgr_facts(self):
|
||||
if self.facts['system'] == 'OpenBSD':
|
||||
self.facts['pkg_mgr'] = 'openbsd_pkg'
|
||||
self.facts['pkg_mgr'] = 'openbsd_pkg'
|
||||
else:
|
||||
self.facts['pkg_mgr'] = 'unknown'
|
||||
for pkg in Facts.PKG_MGRS:
|
||||
@@ -476,9 +476,9 @@ class Facts(object):
|
||||
def get_apparmor_facts(self):
|
||||
self.facts['apparmor'] = {}
|
||||
if os.path.exists('/sys/kernel/security/apparmor'):
|
||||
self.facts['apparmor']['status'] = 'enabled'
|
||||
self.facts['apparmor']['status'] = 'enabled'
|
||||
else:
|
||||
self.facts['apparmor']['status'] = 'disabled'
|
||||
self.facts['apparmor']['status'] = 'disabled'
|
||||
|
||||
def get_caps_facts(self):
|
||||
capsh_path = self.module.get_bin_path('capsh')
|
||||
@@ -884,7 +884,7 @@ class Distribution(object):
|
||||
# example pattern are 13.04 13.0 13
|
||||
distribution_version = re.search('^VERSION_ID="?([0-9]+\.?[0-9]*)"?', line)
|
||||
if distribution_version:
|
||||
self.facts['distribution_version'] = distribution_version.group(1)
|
||||
self.facts['distribution_version'] = distribution_version.group(1)
|
||||
if 'open' in data.lower():
|
||||
release = re.search("^PRETTY_NAME=[^(]+ \(?([^)]+?)\)", line)
|
||||
if release:
|
||||
@@ -1071,8 +1071,8 @@ class LinuxHardware(Hardware):
|
||||
self.facts["%s_mb" % key.lower()] = int(val) // 1024
|
||||
|
||||
if key in self.MEMORY_FACTS:
|
||||
val = data[1].strip().split(' ')[0]
|
||||
memstats[key.lower()] = int(val) // 1024
|
||||
val = data[1].strip().split(' ')[0]
|
||||
memstats[key.lower()] = int(val) // 1024
|
||||
|
||||
if None not in (memstats.get('memtotal'), memstats.get('memfree')):
|
||||
memstats['real:used'] = memstats['memtotal'] - memstats['memfree']
|
||||
@@ -1811,8 +1811,8 @@ class OpenBSDHardware(Hardware):
|
||||
}
|
||||
|
||||
for mib in sysctl_to_dmi:
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
|
||||
class FreeBSDHardware(Hardware):
|
||||
"""
|
||||
@@ -2040,8 +2040,8 @@ class NetBSDHardware(Hardware):
|
||||
}
|
||||
|
||||
for mib in sysctl_to_dmi:
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
|
||||
class AIX(Hardware):
|
||||
"""
|
||||
@@ -2283,8 +2283,8 @@ class HPUX(Hardware):
|
||||
if os.access("/dev/kmem", os.R_OK):
|
||||
rc, out, err = self.module.run_command("echo 'phys_mem_pages/D' | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2}'", use_unsafe_shell=True)
|
||||
if not err:
|
||||
data = out
|
||||
self.facts['memtotal_mb'] = int(data) / 256
|
||||
data = out
|
||||
self.facts['memtotal_mb'] = int(data) / 256
|
||||
else:
|
||||
rc, out, err = self.module.run_command("/usr/contrib/bin/machinfo | grep Memory", use_unsafe_shell=True)
|
||||
data = re.search('Memory[\ :=]*([0-9]*).*MB.*',out).groups()[0].strip()
|
||||
@@ -2308,7 +2308,7 @@ class HPUX(Hardware):
|
||||
self.facts['firmware_version'] = out.split(separator)[1].strip()
|
||||
rc, out, err = self.module.run_command("/usr/contrib/bin/machinfo |grep -i 'Machine serial number' ",use_unsafe_shell=True)
|
||||
if rc == 0 and out:
|
||||
self.facts['product_serial'] = out.split(separator)[1].strip()
|
||||
self.facts['product_serial'] = out.split(separator)[1].strip()
|
||||
|
||||
class Darwin(Hardware):
|
||||
"""
|
||||
@@ -2926,18 +2926,18 @@ class HPUXNetwork(Network):
|
||||
interfaces = self.get_interfaces_info()
|
||||
self.facts['interfaces'] = interfaces.keys()
|
||||
for iface in interfaces:
|
||||
self.facts[iface] = interfaces[iface]
|
||||
self.facts[iface] = interfaces[iface]
|
||||
return self.facts
|
||||
|
||||
def get_default_interfaces(self):
|
||||
rc, out, err = self.module.run_command("/usr/bin/netstat -nr")
|
||||
lines = out.splitlines()
|
||||
for line in lines:
|
||||
words = line.split()
|
||||
if len(words) > 1:
|
||||
if words[0] == 'default':
|
||||
self.facts['default_interface'] = words[4]
|
||||
self.facts['default_gateway'] = words[1]
|
||||
words = line.split()
|
||||
if len(words) > 1:
|
||||
if words[0] == 'default':
|
||||
self.facts['default_interface'] = words[4]
|
||||
self.facts['default_gateway'] = words[1]
|
||||
|
||||
def get_interfaces_info(self):
|
||||
interfaces = {}
|
||||
@@ -3122,7 +3122,7 @@ class OpenBSDNetwork(GenericBsdIfconfigNetwork):
|
||||
|
||||
# OpenBSD 'ifconfig -a' does not have information about aliases
|
||||
def get_interfaces_info(self, ifconfig_path, ifconfig_options='-aA'):
|
||||
return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options)
|
||||
return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options)
|
||||
|
||||
# Return macaddress instead of lladdr
|
||||
def parse_lladdr_line(self, words, current_if, ips):
|
||||
|
||||
@@ -101,7 +101,7 @@ def get_fqdn(repo_url):
|
||||
return result
|
||||
|
||||
def check_hostkey(module, fqdn):
|
||||
return not not_in_host_file(module, fqdn)
|
||||
return not not_in_host_file(module, fqdn)
|
||||
|
||||
# this is a variant of code found in connection_plugins/paramiko.py and we should modify
|
||||
# the paramiko code to import and use this.
|
||||
|
||||
@@ -226,7 +226,7 @@ def connect_to_api(module, disconnect_atexit=True):
|
||||
|
||||
def get_all_objs(content, vimtype, folder=None, recurse=True):
|
||||
if not folder:
|
||||
folder = content.rootFolder
|
||||
folder = content.rootFolder
|
||||
|
||||
obj = {}
|
||||
container = content.viewManager.CreateContainerView(folder, vimtype, recurse)
|
||||
|
||||
Reference in New Issue
Block a user