diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2022-02-16 20:20:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 17:20:03 -0800 |
commit | f7f27ade2d9443e67805e8a654480b610400a049 (patch) | |
tree | 4a027a5b28bda2729b016397770eeb724e581e32 | |
parent | ee112d9984d52983afcf44061ce850c3dfb4aacf (diff) | |
download | ansible-f7f27ade2d9443e67805e8a654480b610400a049.tar.gz |
gather_facts sees collection networking connection (#76954) (#76964)
needed to properly propagate some arguments by convention: subset, filter
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
(cherry picked from commit 5bddecb048aae0a7fc84e38e086ac90445c4edb4)
-rw-r--r-- | changelogs/fragments/gather_facts_collections.yml | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/gather_facts.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/changelogs/fragments/gather_facts_collections.yml b/changelogs/fragments/gather_facts_collections.yml new file mode 100644 index 0000000000..2b6feae4d7 --- /dev/null +++ b/changelogs/fragments/gather_facts_collections.yml @@ -0,0 +1,2 @@ +bugfixes: + - gather_facts action now handles the move of base connection plugin types into collections to add/prevent subset argument correctly diff --git a/lib/ansible/plugins/action/gather_facts.py b/lib/ansible/plugins/action/gather_facts.py index f35481d8f0..27e7cc8ab9 100644 --- a/lib/ansible/plugins/action/gather_facts.py +++ b/lib/ansible/plugins/action/gather_facts.py @@ -22,8 +22,13 @@ class ActionModule(ActionBase): # deal with 'setup specific arguments' if fact_module not in C._ACTION_SETUP: + # TODO: remove in favor of controller side argspec detecing valid arguments # network facts modules must support gather_subset - if self._connection._load_name not in ('network_cli', 'httpapi', 'netconf'): + try: + name = self._connection.redirected_names[-1].replace('ansible.netcommon.', '', 1) + except (IndexError, AttributeError): + name = self._connection._load_name.split('.')[-1] + if name not in ('network_cli', 'httpapi', 'netconf'): subset = mod_args.pop('gather_subset', None) if subset not in ('all', ['all']): self._display.warning('Ignoring subset(%s) for %s' % (subset, fact_module)) |