diff --git a/changelogs/fragments/61761-bgp-modules-collection-safe.yaml b/changelogs/fragments/61761-bgp-modules-collection-safe.yaml new file mode 100644 index 00000000000..18427995cb9 --- /dev/null +++ b/changelogs/fragments/61761-bgp-modules-collection-safe.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- Make EOS / FRR / IOS / IOSXR bgp modules collection safe 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