1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Strip None values from mod_args in gather_facts action (#53758)

This commit is contained in:
Matt Martz 2019-03-14 10:19:04 -05:00 committed by GitHub
parent db3a2686ed
commit 97161ed2ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,10 @@ class ActionModule(ActionBase):
if fact_filter is not None: if fact_filter is not None:
self._display.warning('Ignoring filter(%s) for %s' % (fact_filter, fact_module)) self._display.warning('Ignoring filter(%s) for %s' % (fact_filter, fact_module))
# Strip out keys with ``None`` values, effectively mimicking ``omit`` behavior
# This ensures we don't pass a ``None`` value as an argument expecting a specific type
mod_args = dict((k, v) for k, v in mod_args.items() if v is not None)
return mod_args return mod_args
def run(self, tmp=None, task_vars=None): def run(self, tmp=None, task_vars=None):