mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix missing strip() in a1809a371a
This commit is contained in:
parent
2211ae113c
commit
cf548baeab
1 changed files with 14 additions and 12 deletions
|
@ -84,12 +84,13 @@ class Task(object):
|
||||||
|
|
||||||
# code to allow "with_glob" and to reference a lookup plugin named glob
|
# code to allow "with_glob" and to reference a lookup plugin named glob
|
||||||
elif x.startswith("with_"):
|
elif x.startswith("with_"):
|
||||||
# Only a variable, no logic
|
if isinstance(ds[x], basestring):
|
||||||
if (isinstance(ds[x], basestring) and
|
param = ds[x].strip()
|
||||||
ds[x].startswith('{{') and
|
# Only a variable, no logic
|
||||||
ds[x].find('}}') == len(ds[x]) - 2 and
|
if (param.startswith('{{') and
|
||||||
find ('|') == -1):
|
param.find('}}') == len(ds[x]) - 2 and
|
||||||
utils.warning("It is unnecessary to use '{{' in loops, leave variables in loop expressions bare.")
|
param.find('|') == -1):
|
||||||
|
utils.warning("It is unnecessary to use '{{' in loops, leave variables in loop expressions bare.")
|
||||||
|
|
||||||
plugin_name = x.replace("with_","")
|
plugin_name = x.replace("with_","")
|
||||||
if plugin_name in utils.plugins.lookup_loader:
|
if plugin_name in utils.plugins.lookup_loader:
|
||||||
|
@ -100,12 +101,13 @@ class Task(object):
|
||||||
raise errors.AnsibleError("cannot find lookup plugin named %s for usage in with_%s" % (plugin_name, plugin_name))
|
raise errors.AnsibleError("cannot find lookup plugin named %s for usage in with_%s" % (plugin_name, plugin_name))
|
||||||
|
|
||||||
elif x in [ 'changed_when', 'failed_when', 'when']:
|
elif x in [ 'changed_when', 'failed_when', 'when']:
|
||||||
# Only a variable, no logic
|
if isinstance(ds[x], basestring):
|
||||||
if (isinstance(ds[x], basestring) and
|
param = ds[x].strip()
|
||||||
ds[x].startswith('{{') and
|
# Only a variable, no logic
|
||||||
ds[x].find('}}') == len(ds[x]) - 2 and
|
if (param.startswith('{{') and
|
||||||
find ('|') == -1):
|
param.find('}}') == len(ds[x]) - 2 and
|
||||||
utils.warning("It is unnecessary to use '{{' in conditionals, leave variables in loop expressions bare.")
|
param.find('|') == -1):
|
||||||
|
utils.warning("It is unnecessary to use '{{' in conditionals, leave variables in loop expressions bare.")
|
||||||
elif x.startswith("when_"):
|
elif x.startswith("when_"):
|
||||||
utils.deprecated("The 'when_' conditional has been removed. Switch to using the regular unified 'when' statements as described on docs.ansible.com.","1.5", removed=True)
|
utils.deprecated("The 'when_' conditional has been removed. Switch to using the regular unified 'when' statements as described on docs.ansible.com.","1.5", removed=True)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue