mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
PEP 8 E111 & E114 cleanup. (#20838)
This commit is contained in:
@@ -452,9 +452,9 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||
if mystat.get('failed'):
|
||||
msg = mystat.get('module_stderr')
|
||||
if not msg:
|
||||
msg = mystat.get('module_stdout')
|
||||
msg = mystat.get('module_stdout')
|
||||
if not msg:
|
||||
msg = mystat.get('msg')
|
||||
msg = mystat.get('msg')
|
||||
raise AnsibleError('Failed to get information on remote file (%s): %s' % (path, msg))
|
||||
|
||||
if not mystat['stat']['exists']:
|
||||
|
||||
@@ -70,11 +70,11 @@ class ActionModule(ActionBase):
|
||||
new_groups = []
|
||||
if groups:
|
||||
if isinstance(groups, list):
|
||||
group_list = groups
|
||||
group_list = groups
|
||||
elif isinstance(groups, string_types):
|
||||
group_list = groups.split(",")
|
||||
group_list = groups.split(",")
|
||||
else:
|
||||
raise AnsibleError("Groups must be specfied as a list.", obj=self._task)
|
||||
raise AnsibleError("Groups must be specfied as a list.", obj=self._task)
|
||||
|
||||
for group_name in group_list:
|
||||
if group_name not in new_groups:
|
||||
|
||||
@@ -332,7 +332,7 @@ def ipaddr(value, query = '', version = False, alias = 'ipaddr'):
|
||||
_ret = []
|
||||
for element in value:
|
||||
if ipaddr(element, str(query), version):
|
||||
_ret.append(ipaddr(element, str(query), version))
|
||||
_ret.append(ipaddr(element, str(query), version))
|
||||
|
||||
if _ret:
|
||||
return _ret
|
||||
@@ -587,7 +587,7 @@ def nthhost(value, query=''):
|
||||
try:
|
||||
nth = int(query)
|
||||
if value.size > nth:
|
||||
return value[nth]
|
||||
return value[nth]
|
||||
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
@@ -178,7 +178,7 @@ class LookupModule(LookupBase):
|
||||
except (AnsibleUndefinedVariable, UndefinedError):
|
||||
continue
|
||||
|
||||
# get subdir if set by task executor, default to files otherwise
|
||||
# get subdir if set by task executor, default to files otherwise
|
||||
subdir = getattr(self, '_subdir', 'files')
|
||||
path = None
|
||||
path = self.find_file_in_search_path(variables, subdir, fn, ignore_missing=True)
|
||||
|
||||
@@ -102,9 +102,9 @@ class LookupModule(LookupBase):
|
||||
vault_conn = HashiVault(**vault_dict)
|
||||
|
||||
for term in terms:
|
||||
key = term.split()[0]
|
||||
value = vault_conn.get()
|
||||
ret.append(value)
|
||||
key = term.split()[0]
|
||||
value = vault_conn.get()
|
||||
ret.append(value)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ class LookupModule(LookupBase):
|
||||
ret.append(result)
|
||||
|
||||
except ConnectionFailure as e:
|
||||
raise AnsibleError('unable to connect to database: %s' % str(e))
|
||||
raise AnsibleError('unable to connect to database: %s' % str(e))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -466,11 +466,11 @@ class StrategyBase:
|
||||
|
||||
# and if none were found, then we raise an error
|
||||
if not found:
|
||||
msg = "The requested handler '%s' was not found in either the main handlers list nor in the listening handlers list" % handler_name
|
||||
if C.ERROR_ON_MISSING_HANDLER:
|
||||
raise AnsibleError(msg)
|
||||
else:
|
||||
display.warning(msg)
|
||||
msg = "The requested handler '%s' was not found in either the main handlers list nor in the listening handlers list" % handler_name
|
||||
if C.ERROR_ON_MISSING_HANDLER:
|
||||
raise AnsibleError(msg)
|
||||
else:
|
||||
display.warning(msg)
|
||||
|
||||
if 'add_host' in result_item:
|
||||
# this task added a new host (add_host module)
|
||||
|
||||
Reference in New Issue
Block a user