mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
PEP 8 E111 & E114 cleanup. (#20838)
This commit is contained in:
@@ -279,7 +279,7 @@ def set_port_disabled_permanent(zone, port, protocol):
|
||||
def get_source(zone, source):
|
||||
fw_zone, fw_settings = get_fw_zone_settings(zone)
|
||||
if source in fw_settings.getSources():
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@@ -317,7 +317,7 @@ def get_interface_permanent(zone, interface):
|
||||
fw_zone, fw_settings = get_fw_zone_settings(zone)
|
||||
|
||||
if interface in fw_settings.getInterfaces():
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
@@ -102,13 +102,13 @@ def parse_vgs(data):
|
||||
return vgs
|
||||
|
||||
def find_mapper_device_name(module, dm_device):
|
||||
dmsetup_cmd = module.get_bin_path('dmsetup', True)
|
||||
mapper_prefix = '/dev/mapper/'
|
||||
rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device))
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err)
|
||||
mapper_device = mapper_prefix + dm_name.rstrip()
|
||||
return mapper_device
|
||||
dmsetup_cmd = module.get_bin_path('dmsetup', True)
|
||||
mapper_prefix = '/dev/mapper/'
|
||||
rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device))
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err)
|
||||
mapper_device = mapper_prefix + dm_name.rstrip()
|
||||
return mapper_device
|
||||
|
||||
def parse_pvs(module, data):
|
||||
pvs = []
|
||||
|
||||
@@ -315,15 +315,15 @@ def main():
|
||||
if not '%' in size:
|
||||
# LVCREATE(8) -L --size option unit
|
||||
if size[-1].lower() in 'bskmgtpe':
|
||||
size_unit = size[-1].lower()
|
||||
size = size[0:-1]
|
||||
size_unit = size[-1].lower()
|
||||
size = size[0:-1]
|
||||
|
||||
try:
|
||||
float(size)
|
||||
if not size[0].isdigit():
|
||||
raise ValueError()
|
||||
float(size)
|
||||
if not size[0].isdigit():
|
||||
raise ValueError()
|
||||
except ValueError:
|
||||
module.fail_json(msg="Bad size specification of '%s'" % size)
|
||||
module.fail_json(msg="Bad size specification of '%s'" % size)
|
||||
|
||||
# when no unit, megabytes by default
|
||||
if size_opt == 'l':
|
||||
|
||||
@@ -326,10 +326,10 @@ class OSXDefaults(object):
|
||||
# Current value matches the given value. Nothing need to be done. Arrays need extra care
|
||||
if self.type == "array" and self.current_value is not None and not self.array_add and \
|
||||
set(self.current_value) == set(self.value):
|
||||
return False
|
||||
return False
|
||||
elif self.type == "array" and self.current_value is not None and self.array_add and \
|
||||
len(list(set(self.value) - set(self.current_value))) == 0:
|
||||
return False
|
||||
return False
|
||||
elif self.current_value == self.value:
|
||||
return False
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ def main():
|
||||
module.fail_json(msg="Not any of the command arguments %s given" % commands)
|
||||
|
||||
if(params['interface'] is not None and params['direction'] is None):
|
||||
module.fail_json(msg="Direction must be specified when creating a rule on an interface")
|
||||
module.fail_json(msg="Direction must be specified when creating a rule on an interface")
|
||||
|
||||
# Ensure ufw is available
|
||||
ufw_bin = module.get_bin_path('ufw', True)
|
||||
|
||||
@@ -1419,8 +1419,8 @@ class SunOS(User):
|
||||
cmd.append(','.join(new_groups))
|
||||
|
||||
if self.comment is not None and info[4] != self.comment:
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
|
||||
if self.home is not None and info[5] != self.home:
|
||||
if self.move_home:
|
||||
@@ -1563,7 +1563,7 @@ class DarwinUser(User):
|
||||
if max_uid < current_uid:
|
||||
max_uid = current_uid
|
||||
if max_system_uid < current_uid and current_uid < 500:
|
||||
max_system_uid = current_uid
|
||||
max_system_uid = current_uid
|
||||
|
||||
if system and (0 < max_system_uid < 499):
|
||||
return max_system_uid + 1
|
||||
@@ -1923,8 +1923,8 @@ class AIX(User):
|
||||
cmd.append(','.join(groups))
|
||||
|
||||
if self.comment is not None and info[4] != self.comment:
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
|
||||
if self.home is not None and info[5] != self.home:
|
||||
if self.move_home:
|
||||
|
||||
Reference in New Issue
Block a user