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/galaxy.yml b/ansible_collections/f5networks/f5_modules/galaxy.yml index 798a6d7..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.31.0 +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 1e01ac3..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.31.0" +CURRENT_COLL_VERSION = "1.32.0" 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'