From a795f6941eb50c9e21ff20c297700c1e264223b5 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Wed, 4 Sep 2019 19:59:00 +0530 Subject: [PATCH] Make *_bgp modules collection safe (#61761) Signed-off-by: NilashishC --- lib/ansible/module_utils/network/eos/providers/module.py | 2 +- lib/ansible/module_utils/network/frr/providers/module.py | 2 +- lib/ansible/module_utils/network/ios/providers/module.py | 2 +- lib/ansible/module_utils/network/iosxr/providers/module.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/network/eos/providers/module.py b/lib/ansible/module_utils/network/eos/providers/module.py index 9f259ebb460..2d8fd67ebc5 100644 --- a/lib/ansible/module_utils/network/eos/providers/module.py +++ b/lib/ansible/module_utils/network/eos/providers/module.py @@ -31,7 +31,7 @@ class NetworkModule(AnsibleModule): if network_api == 'cliconf': connection_type = 'network_cli' - cls = providers.get(network_os, self._name, connection_type) + cls = providers.get(network_os, self._name.split('.')[-1], connection_type) if not cls: msg = 'unable to find suitable provider for network os %s' % network_os diff --git a/lib/ansible/module_utils/network/frr/providers/module.py b/lib/ansible/module_utils/network/frr/providers/module.py index d1dfa6c0691..073837c8d31 100644 --- a/lib/ansible/module_utils/network/frr/providers/module.py +++ b/lib/ansible/module_utils/network/frr/providers/module.py @@ -31,7 +31,7 @@ class NetworkModule(AnsibleModule): if network_api == 'cliconf': connection_type = 'network_cli' - cls = providers.get(network_os, self._name, connection_type) + cls = providers.get(network_os, self._name.split('.')[-1], connection_type) if not cls: msg = 'unable to find suitable provider for network os %s' % network_os diff --git a/lib/ansible/module_utils/network/ios/providers/module.py b/lib/ansible/module_utils/network/ios/providers/module.py index e7dc037e5b2..69c6dd96590 100644 --- a/lib/ansible/module_utils/network/ios/providers/module.py +++ b/lib/ansible/module_utils/network/ios/providers/module.py @@ -31,7 +31,7 @@ class NetworkModule(AnsibleModule): if network_api == 'cliconf': connection_type = 'network_cli' - cls = providers.get(network_os, self._name, connection_type) + cls = providers.get(network_os, self._name.split('.')[-1], connection_type) if not cls: msg = 'unable to find suitable provider for network os %s' % network_os diff --git a/lib/ansible/module_utils/network/iosxr/providers/module.py b/lib/ansible/module_utils/network/iosxr/providers/module.py index 28725e9a8e3..2c4d97a3371 100644 --- a/lib/ansible/module_utils/network/iosxr/providers/module.py +++ b/lib/ansible/module_utils/network/iosxr/providers/module.py @@ -31,7 +31,7 @@ class NetworkModule(AnsibleModule): if network_api == 'cliconf': connection_type = 'network_cli' - cls = providers.get(network_os, self._name, connection_type) + cls = providers.get(network_os, self._name.split('.')[-1], connection_type) if not cls: msg = 'unable to find suitable provider for network os %s' % network_os