summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/constants.py2
-rw-r--r--lib/ansible/vars/clean.py8
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py
index e56a34ffd8..faceafa5e8 100644
--- a/lib/ansible/constants.py
+++ b/lib/ansible/constants.py
@@ -110,7 +110,7 @@ INTERNAL_RESULT_KEYS = ('add_host', 'add_group')
LOCALHOST = ('127.0.0.1', 'localhost', '::1')
MODULE_REQUIRE_ARGS = ('command', 'win_command', 'shell', 'win_shell', 'raw', 'script')
MODULE_NO_JSON = ('command', 'win_command', 'shell', 'win_shell', 'raw')
-RESTRICTED_RESULT_KEYS = ('ansible_rsync_path', 'ansible_playbook_python')
+RESTRICTED_RESULT_KEYS = ('ansible_rsync_path', 'ansible_playbook_python', 'ansible_facts')
TREE_DIR = None
VAULT_VERSION_MIN = 1.0
VAULT_VERSION_MAX = 1.0
diff --git a/lib/ansible/vars/clean.py b/lib/ansible/vars/clean.py
index 06417823c2..6796c8f63c 100644
--- a/lib/ansible/vars/clean.py
+++ b/lib/ansible/vars/clean.py
@@ -16,7 +16,6 @@ from ansible.module_utils.common._collections_compat import MutableMapping, Muta
from ansible.plugins.loader import connection_loader
from ansible.utils.display import Display
-
display = Display()
@@ -172,10 +171,9 @@ def namespace_facts(facts):
''' return all facts inside 'ansible_facts' w/o an ansible_ prefix '''
deprefixed = {}
for k in facts:
- if k in ('ansible_local',):
- # exceptions to 'deprefixing'
- deprefixed[k] = module_response_deepcopy(facts[k])
+ if k.startswith('ansible_') and k not in ('ansible_local',):
+ deprefixed[k[8:]] = module_response_deepcopy(facts[k])
else:
- deprefixed[k.replace('ansible_', '', 1)] = module_response_deepcopy(facts[k])
+ deprefixed[k] = module_response_deepcopy(facts[k])
return {'ansible_facts': deprefixed}