summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2016-11-18 22:15:55 -0600
committerJames Cammarata <jimi@sngx.net>2016-11-18 22:20:08 -0600
commit3ce19f4c58cfb4d0e116904a081d77d27dd07778 (patch)
tree76c8660742f2ecb628d2077829e11858d7c7bd2a
parent585c57fca4a79b8d206979350a4c46bfb28f5525 (diff)
downloadansible-3ce19f4c58cfb4d0e116904a081d77d27dd07778.tar.gz
With role params also keep special params in the ds as well as params
With 2.0, we decided to create a special list of param names which were taken out of the role data structure and stored as params instead (connection, port, and remote_user). This causes problems with inheritance of these params, so we are now deprecating that while also keeping those keys in the ds so they are brought in as attributes on the Role correctly. Fixes #17395 (cherry picked from commit f36926f8d3368de4610ea285645e7e5f0fae0f43)
-rw-r--r--lib/ansible/playbook/role/definition.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ansible/playbook/role/definition.py b/lib/ansible/playbook/role/definition.py
index 6b78a1b349..32a1bdca58 100644
--- a/lib/ansible/playbook/role/definition.py
+++ b/lib/ansible/playbook/role/definition.py
@@ -34,6 +34,12 @@ from ansible.playbook.taggable import Taggable
from ansible.template import Templar
from ansible.utils.path import unfrackpath
+try:
+ from __main__ import display
+except ImportError:
+ from ansible.utils.display import Display
+ display = Display()
+
__all__ = ['RoleDefinition']
@@ -197,6 +203,11 @@ class RoleDefinition(Base, Become, Conditional, Taggable):
# or make this list more automatic in some way so we don't have to
# remember to update it manually.
if key not in base_attribute_names or key in ('connection', 'port', 'remote_user'):
+ if key in ('connection', 'port', 'remote_user'):
+ display.deprecated("Using '%s' as a role param has been deprecated. " % key + \
+ "In the future, these values should be entered in the `vars:` " + \
+ "section for roles, but for now we'll store it as both a param and an attribute.")
+ role_def[key] = value
# this key does not match a field attribute, so it must be a role param
role_params[key] = value
else: