Created
February 4, 2016 21:08
-
-
Save sivel/3bea3e5c76321d903483 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py | |
index 1804a03..3703062 100644 | |
--- a/lib/ansible/playbook/play_context.py | |
+++ b/lib/ansible/playbook/play_context.py | |
@@ -80,6 +80,13 @@ MAGIC_VARIABLE_MAPPING = dict( | |
su_flags = ('ansible_su_flags',), | |
) | |
+MAGIC_VARIABLE_UNDEFINED = [ | |
+ 'remote_addr', | |
+ 'remote_user', | |
+ 'port', | |
+ 'password' | |
+] | |
+ | |
SU_PROMPT_LOCALIZATIONS = [ | |
'Password', | |
'암호', | |
@@ -531,4 +538,6 @@ class PlayContext(Base): | |
if special_var not in variables: | |
for prop, varnames in MAGIC_VARIABLE_MAPPING.items(): | |
if special_var in varnames: | |
- variables[special_var] = getattr(self, prop) | |
+ value = getattr(self, prop) | |
+ if prop in MAGIC_VARIABLE_UNDEFINED and value is not None: | |
+ variables[special_var] = getattr(self, prop) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment