mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-06 16:34:02 -07:00
parent
a4a37e8dfb
commit
006f08da99
3 changed files with 16 additions and 7 deletions
|
@ -63,8 +63,13 @@ def clean_facts(facts):
|
|||
fact_keys = set(data.keys())
|
||||
# first we add all of our magic variable names to the set of
|
||||
# keys we want to remove from facts
|
||||
# NOTE: these will eventually disappear in favor of others below
|
||||
for magic_var in C.MAGIC_VARIABLE_MAPPING:
|
||||
remove_keys.update(fact_keys.intersection(C.MAGIC_VARIABLE_MAPPING[magic_var]))
|
||||
|
||||
# remove common connection vars
|
||||
remove_keys.update(fact_keys.intersection(C.COMMON_CONNECTION_VARS))
|
||||
|
||||
# next we remove any connection plugin specific vars
|
||||
for conn_path in connection_loader.all(path_only=True):
|
||||
try:
|
||||
|
@ -72,7 +77,7 @@ def clean_facts(facts):
|
|||
re_key = re.compile('^ansible_%s_' % conn_name)
|
||||
for fact_key in fact_keys:
|
||||
# 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')):
|
||||
if (re_key.match(fact_key) and not fact_key.endswith(('_bridge', '_gwbridge'))) or re_key.startswith('ansible_become_'):
|
||||
remove_keys.add(fact_key)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue