mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 07:24:00 -07:00
Deprecation warnings of several flavors, nice and purple and can be disabled
in ansible.cfg.
This commit is contained in:
parent
a017a69bb3
commit
9637f620d7
6 changed files with 66 additions and 7 deletions
|
@ -19,6 +19,7 @@ from ansible import errors
|
|||
from ansible import utils
|
||||
import os
|
||||
import ansible.utils.template as template
|
||||
import sys
|
||||
|
||||
class Task(object):
|
||||
|
||||
|
@ -91,8 +92,10 @@ class Task(object):
|
|||
elif x in [ 'changed_when', 'failed_when', 'when']:
|
||||
ds[x] = "jinja2_compare %s" % (ds[x])
|
||||
elif x.startswith("when_"):
|
||||
utils.deprecated("The 'when_' conditional is a deprecated syntax as of 1.2. Switch to using the regular unified 'when' statements as described in ansibleworks.com/docs/.","1.5")
|
||||
|
||||
if 'when' in ds:
|
||||
raise errors.AnsibleError("multiple when_* statements specified in task %s" % (ds.get('name', ds['action'])))
|
||||
raise errors.AnsibleError("multiple when_* statements specified in task %s" % (ds.get('name', ds['action'])))
|
||||
when_name = x.replace("when_","")
|
||||
ds['when'] = "%s %s" % (when_name, ds[x])
|
||||
ds.pop(x)
|
||||
|
@ -172,6 +175,10 @@ class Task(object):
|
|||
|
||||
# load various attributes
|
||||
self.only_if = ds.get('only_if', 'True')
|
||||
|
||||
if self.only_if != True:
|
||||
utils.deprecated("only_if is a very old feature and has been obsolete since 0.9, please switch to the 'when' conditional as described at http://ansibleworks.com/docs","1.5")
|
||||
|
||||
self.when = ds.get('when', None)
|
||||
self.changed_when = ds.get('changed_when', None)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue