# code to allow "with_glob" and to reference a lookup plugin named glob
elifx.startswith("with_"):
# Only a variable, no logic
if(isinstance(ds[x],basestring)and
ds[x].startswith('{{')and
ds[x].find('}}')==len(ds[x])-2and
find('|')==-1):
utils.warning("It is unnecessary to use '{{' in loops, leave variables in loop expressions bare.")
ifisinstance(ds[x],basestring):
param=ds[x].strip()
# Only a variable, no logic
if(param.startswith('{{')and
param.find('}}')==len(ds[x])-2and
param.find('|')==-1):
utils.warning("It is unnecessary to use '{{' in loops, leave variables in loop expressions bare.")
plugin_name=x.replace("with_","")
ifplugin_nameinutils.plugins.lookup_loader:
@ -100,12 +101,13 @@ class Task(object):
raiseerrors.AnsibleError("cannot find lookup plugin named %s for usage in with_%s"%(plugin_name,plugin_name))
elifxin['changed_when','failed_when','when']:
# Only a variable, no logic
if(isinstance(ds[x],basestring)and
ds[x].startswith('{{')and
ds[x].find('}}')==len(ds[x])-2and
find('|')==-1):
utils.warning("It is unnecessary to use '{{' in conditionals, leave variables in loop expressions bare.")
ifisinstance(ds[x],basestring):
param=ds[x].strip()
# Only a variable, no logic
if(param.startswith('{{')and
param.find('}}')==len(ds[x])-2and
param.find('|')==-1):
utils.warning("It is unnecessary to use '{{' in conditionals, leave variables in loop expressions bare.")
elifx.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)