summaryrefslogtreecommitdiff
path: root/lib/ansible/vars
diff options
context:
space:
mode:
authorPilou <pierre-louis@libregerbil.fr>2018-02-15 16:43:44 +0100
committerToshio Kuratomi <a.badger@gmail.com>2018-02-15 07:43:44 -0800
commitb3ce13625659421a6791e91a67ce980b5c375ec6 (patch)
tree7c2fc2376d9fac27845eeba54ad1ddb5c0a7528d /lib/ansible/vars
parentf67ff4a78e0d04328ddc9368e214b81ca0a5cc43 (diff)
downloadansible-b3ce13625659421a6791e91a67ce980b5c375ec6.tar.gz
vars.clean: remove unused method inject_facts (#34838)
* vars.clean: remove unused method inject_facts Removing this unused method seems better than fixing the typo. * Fix typo in comments
Diffstat (limited to 'lib/ansible/vars')
-rw-r--r--lib/ansible/vars/clean.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/ansible/vars/clean.py b/lib/ansible/vars/clean.py
index 5a34997f72..a2f47fc318 100644
--- a/lib/ansible/vars/clean.py
+++ b/lib/ansible/vars/clean.py
@@ -24,7 +24,7 @@ except ImportError:
def strip_internal_keys(dirty, exceptions=None):
'''
- All keys stating with _ansible_ are internal, so create a copy of the 'dirty' dict
+ All keys starting with _ansible_ are internal, so create a copy of the 'dirty' dict
and remove them from the clean one before returning it
'''
@@ -56,7 +56,7 @@ def remove_internal_keys(data):
def clean_facts(facts):
- ''' remove facts that can override internal keys or othewise deemed unsafe '''
+ ''' remove facts that can override internal keys or otherwise deemed unsafe '''
data = deepcopy(facts)
remove_keys = set()
@@ -71,7 +71,7 @@ def clean_facts(facts):
conn_name = os.path.splitext(os.path.basename(conn_path))[0]
re_key = re.compile('^ansible_%s_' % conn_name)
for fact_key in fact_keys:
- # exception for lvm tech, whic normally returns asnible_x_bridge facts that get filterd out (docker,lxc, etc)
+ # most lightweight VM or container tech creates devices with this pattern, this avoids filtering them out
if re_key.match(fact_key) and not fact_key.endswith(('_bridge', '_gwbridge')):
remove_keys.add(fact_key)
except AttributeError:
@@ -102,19 +102,6 @@ def clean_facts(facts):
return strip_internal_keys(data)
-def inject_facts(facts):
- ''' return clean facts inside with an ansible_ prefix '''
- injected = {}
- for k in facts:
- if k.startswith('ansible_') or k == 'module_setup':
- new = k
- else:
- new = 'ansilbe_%s' % k
- injected[new] = deepcopy(facts[k])
-
- return clean_facts(injected)
-
-
def namespace_facts(facts):
''' return all facts inside 'ansible_facts' w/o an ansible_ prefix '''
deprefixed = {}