mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 09:54:02 -07:00
PEP 8 E111 & E114 cleanup. (#20838)
This commit is contained in:
parent
1609afbd12
commit
cb76200c7d
119 changed files with 339 additions and 378 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue