summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/action/gather_facts.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/plugins/action/gather_facts.py')
-rw-r--r--lib/ansible/plugins/action/gather_facts.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/plugins/action/gather_facts.py b/lib/ansible/plugins/action/gather_facts.py
index c2bb544e80..3ff7beb5a8 100644
--- a/lib/ansible/plugins/action/gather_facts.py
+++ b/lib/ansible/plugins/action/gather_facts.py
@@ -25,8 +25,8 @@ class ActionModule(ActionBase):
# TODO: remove in favor of controller side argspec detecing valid arguments
# network facts modules must support gather_subset
try:
- name = self._connection.redirected_names[-1].removeprefix('ansible.netcommon.')
- except (IndexError, AttributeError):
+ name = self._connection.ansible_name.removeprefix('ansible.netcommon.')
+ except AttributeError:
name = self._connection._load_name.split('.')[-1]
if name not in ('network_cli', 'httpapi', 'netconf'):
subset = mod_args.pop('gather_subset', None)
@@ -81,7 +81,7 @@ class ActionModule(ActionBase):
if 'smart' in modules:
connection_map = C.config.get_config_value('CONNECTION_FACTS_MODULES', variables=task_vars)
network_os = self._task.args.get('network_os', task_vars.get('ansible_network_os', task_vars.get('ansible_facts', {}).get('network_os')))
- modules.extend([connection_map.get(network_os or self._connection._load_name, 'ansible.legacy.setup')])
+ modules.extend([connection_map.get(network_os or self._connection.ansible_name, 'ansible.legacy.setup')])
modules.pop(modules.index('smart'))
failed = {}