From 962c2393782ee086120e4ef49f904e4024b90de6 Mon Sep 17 00:00:00 2001 From: wypior Date: Wed, 11 Sep 2024 23:00:55 +0000 Subject: [PATCH 1/3] Merging devel changes - 2024-09-11T23:00:39Z --- ansible_collections/f5networks/f5_modules/galaxy.yml | 2 +- .../f5networks/f5_modules/plugins/module_utils/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible_collections/f5networks/f5_modules/galaxy.yml b/ansible_collections/f5networks/f5_modules/galaxy.yml index 798a6d7..dd78780 100644 --- a/ansible_collections/f5networks/f5_modules/galaxy.yml +++ b/ansible_collections/f5networks/f5_modules/galaxy.yml @@ -30,4 +30,4 @@ tags: - networking - bigip - bigiq -version: 1.31.0 +version: 1.32.0-devel diff --git a/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py b/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py index 1e01ac3..7d75ded 100644 --- a/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py +++ b/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py @@ -4,4 +4,4 @@ # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # This collection version needs to be updated at each release -CURRENT_COLL_VERSION = "1.31.0" +CURRENT_COLL_VERSION = "1.32.0-devel" From a92f490614e7a963b2c5a7f10abd7c2c7697193f Mon Sep 17 00:00:00 2001 From: rupadhyay Date: Wed, 23 Oct 2024 23:02:37 +0000 Subject: [PATCH 2/3] Merging devel changes - 2024-10-23T23:02:23Z --- .../fragments/imish_route_domain_bugfix.yml | 3 ++ .../changelogs/fragments/issue-2429.yaml | 3 ++ .../plugins/modules/bigip_gtm_server.py | 20 ++++++++++++ .../plugins/modules/bigip_imish_config.py | 31 ++++++++++++------- .../network/f5/test_bigip_gtm_server.py | 2 ++ 5 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml create mode 100644 ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml diff --git a/ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml b/ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml new file mode 100644 index 0000000..4e71e98 --- /dev/null +++ b/ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - bigip_imish_config - fixed a bug that resulted in incomplete config when using BGV route domain diff --git a/ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml b/ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml new file mode 100644 index 0000000..9aa9f4e --- /dev/null +++ b/ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: + - bigip_gtm_server - Added check for datacenter existence in Check Mode. diff --git a/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_gtm_server.py b/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_gtm_server.py index b543716..7d1b034 100644 --- a/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_gtm_server.py +++ b/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_gtm_server.py @@ -1591,6 +1591,24 @@ def exists(self): else: raise F5ModuleError(resp.content) + def check_datacenter(self): + # check if datacenter exists + if self.want.datacenter is not None: + uri = "https://{0}:{1}/mgmt/tm/gtm/datacenter/".format( + self.client.provider['server'], + self.client.provider['server_port'] + ) + resp = self.client.api.get(uri) + try: + response = resp.json() + datacenter = [dc for dc in response['items'] if dc['fullPath'] == self.want.datacenter] + if len(datacenter) == 0: + raise F5ModuleError( + f'{self.want.datacenter} does not exists' + ) + except ValueError as ex: + raise F5ModuleError(str(ex)) + class V1Manager(BaseManager): def _assign_creation_defaults(self): @@ -1630,10 +1648,12 @@ def handle_prober_settings(self): self.want._values.pop('prober_preference') if self.want.prober_fallback is not None: self.want._values.pop('prober_fallback') + self.check_datacenter() class V2Manager(BaseManager): def update(self): + self.check_datacenter() self.have = self.read_current_from_device() if not self.should_update(): return False diff --git a/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_imish_config.py b/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_imish_config.py index d728f75..7be74e9 100644 --- a/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_imish_config.py +++ b/ansible_collections/f5networks/f5_modules/plugins/modules/bigip_imish_config.py @@ -324,6 +324,7 @@ import os import tempfile +import time from datetime import datetime from ansible.module_utils.basic import AnsibleModule @@ -629,18 +630,26 @@ def load_config_on_device(self, name): self.client.provider['server'], self.client.provider['server_port'] ) - resp = self.client.api.post(uri, json=params) - try: - response = resp.json() - except ValueError as ex: - raise F5ModuleError(str(ex)) - if resp.status in [200, 201] or 'code' in response and response['code'] in [200, 201]: - if 'commandResult' in response: - if 'Dynamic routing is not enabled' in response['commandResult']: - raise F5ModuleError(response['commandResult']) - return True - raise F5ModuleError(resp.content) + x = 0 + while x < 3: + resp = self.client.api.post(uri, json=params) + try: + response = resp.json() + except ValueError as ex: + raise F5ModuleError(str(ex)) + + if resp.status in [200, 201] or 'code' in response and response['code'] in [200, 201]: + if 'commandResult' in response: + if 'Dynamic routing is not enabled' in response['commandResult']: + raise F5ModuleError(response['commandResult']) + if 'Protocol daemon is not running' in response['commandResult']: + x += 1 + time.sleep(5) + continue + return True + + raise F5ModuleError(resp.content) def read_current_from_device(self): command = 'imish -r {0} -e \\\"show running-config\\\"'.format(self.want.route_domain) diff --git a/ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_gtm_server.py b/ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_gtm_server.py index d46796d..091f81b 100644 --- a/ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_gtm_server.py +++ b/ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_gtm_server.py @@ -192,6 +192,7 @@ def test_create(self, *args): m1 = V1Manager(module=module, params=module.params) m1.exists = Mock(side_effect=[False, True]) m1.create_on_device = Mock(return_value=True) + m1.check_datacenter = Mock(return_value=[{"fullPath": "/Common/New York"}]) m1.client = Mock() m1.client.api.tmos_version = '12.0.0' @@ -287,6 +288,7 @@ def test_create(self, *args): m1 = V2Manager(module=module) m1.exists = Mock(side_effect=[False, True]) m1.create_on_device = Mock(return_value=True) + m1.check_datacenter = Mock(return_value=[{"fullPath": "/Common/New York"}]) m1.client = Mock() m1.client.api.tmos_version = '13.1.0' From d16a77871f2f582652df73ce7a124524a2d9971f Mon Sep 17 00:00:00 2001 From: rupadhyay Date: Thu, 24 Oct 2024 12:47:12 +0000 Subject: [PATCH 3/3] Version 1.32.0 release --- .../f5networks/f5_modules/CHANGELOG.rst | 13 +++++++++++++ .../f5networks/f5_modules/changelogs/changelog.yaml | 11 +++++++++++ .../fragments/imish_route_domain_bugfix.yml | 3 --- .../f5_modules/changelogs/fragments/issue-2429.yaml | 3 --- .../f5networks/f5_modules/galaxy.yml | 2 +- .../f5_modules/plugins/module_utils/version.py | 2 +- 6 files changed, 26 insertions(+), 8 deletions(-) delete mode 100644 ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml delete mode 100644 ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml diff --git a/ansible_collections/f5networks/f5_modules/CHANGELOG.rst b/ansible_collections/f5networks/f5_modules/CHANGELOG.rst index bf7ae64..3fbb468 100644 --- a/ansible_collections/f5networks/f5_modules/CHANGELOG.rst +++ b/ansible_collections/f5networks/f5_modules/CHANGELOG.rst @@ -4,6 +4,19 @@ F5Networks F5\_Modules Collection Release Notes .. contents:: Topics +v1.32.0 +======= + +Minor Changes +------------- + +- bigip_gtm_server - Added check for datacenter existence in Check Mode. + +Bugfixes +-------- + +- bigip_imish_config - fixed a bug that resulted in incomplete config when using BGV route domain + v1.31.0 ======= diff --git a/ansible_collections/f5networks/f5_modules/changelogs/changelog.yaml b/ansible_collections/f5networks/f5_modules/changelogs/changelog.yaml index ac6f4bc..2e19b2b 100644 --- a/ansible_collections/f5networks/f5_modules/changelogs/changelog.yaml +++ b/ansible_collections/f5networks/f5_modules/changelogs/changelog.yaml @@ -1151,6 +1151,17 @@ releases: fragments: - issue_2419_2421.yaml release_date: '2024-09-11' + 1.32.0: + changes: + bugfixes: + - bigip_imish_config - fixed a bug that resulted in incomplete config when using + BGV route domain + minor_changes: + - bigip_gtm_server - Added check for datacenter existence in Check Mode. + fragments: + - imish_route_domain_bugfix.yml + - issue-2429.yaml + release_date: '2024-10-24' 1.4.0: changes: bugfixes: diff --git a/ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml b/ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml deleted file mode 100644 index 4e71e98..0000000 --- a/ansible_collections/f5networks/f5_modules/changelogs/fragments/imish_route_domain_bugfix.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - bigip_imish_config - fixed a bug that resulted in incomplete config when using BGV route domain diff --git a/ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml b/ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml deleted file mode 100644 index 9aa9f4e..0000000 --- a/ansible_collections/f5networks/f5_modules/changelogs/fragments/issue-2429.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - bigip_gtm_server - Added check for datacenter existence in Check Mode. diff --git a/ansible_collections/f5networks/f5_modules/galaxy.yml b/ansible_collections/f5networks/f5_modules/galaxy.yml index dd78780..50f5b76 100644 --- a/ansible_collections/f5networks/f5_modules/galaxy.yml +++ b/ansible_collections/f5networks/f5_modules/galaxy.yml @@ -30,4 +30,4 @@ tags: - networking - bigip - bigiq -version: 1.32.0-devel +version: 1.32.0 diff --git a/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py b/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py index 7d75ded..d52ae02 100644 --- a/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py +++ b/ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py @@ -4,4 +4,4 @@ # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # This collection version needs to be updated at each release -CURRENT_COLL_VERSION = "1.32.0-devel" +CURRENT_COLL_VERSION = "1.32.0"