From 37c64b3eb375535dc3bd6e712f2f9b7ba5afb0f6 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 18 Sep 2019 10:02:42 -0400 Subject: [PATCH] Pull request for temp/bgp_61761 (#62469) * Make *_bgp modules collection safe (#61761) Signed-off-by: NilashishC * Add changelog entry Signed-off-by: Paul Belanger --- changelogs/fragments/61761-bgp-modules-collection-safe.yaml | 3 +++ 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 +- 5 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/61761-bgp-modules-collection-safe.yaml 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 0000000000..18427995cb --- /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 9f259ebb46..2d8fd67ebc 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 d1dfa6c069..073837c8d3 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 e7dc037e5b..69c6dd9659 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 28725e9a8e..2c4d97a337 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