Skip to content

Commit 4b8f7bc

Browse files
committed
Merge branch 'devel'
2 parents 5ff625c + d16a778 commit 4b8f7bc

File tree

7 files changed

+68
-13
lines changed

7 files changed

+68
-13
lines changed

ansible_collections/f5networks/f5_modules/CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ F5Networks F5\_Modules Collection Release Notes
44

55
.. contents:: Topics
66

7+
v1.32.0
8+
=======
9+
10+
Minor Changes
11+
-------------
12+
13+
- bigip_gtm_server - Added check for datacenter existence in Check Mode.
14+
15+
Bugfixes
16+
--------
17+
18+
- bigip_imish_config - fixed a bug that resulted in incomplete config when using BGV route domain
19+
720
v1.31.0
821
=======
922

ansible_collections/f5networks/f5_modules/changelogs/changelog.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,17 @@ releases:
11511151
fragments:
11521152
- issue_2419_2421.yaml
11531153
release_date: '2024-09-11'
1154+
1.32.0:
1155+
changes:
1156+
bugfixes:
1157+
- bigip_imish_config - fixed a bug that resulted in incomplete config when using
1158+
BGV route domain
1159+
minor_changes:
1160+
- bigip_gtm_server - Added check for datacenter existence in Check Mode.
1161+
fragments:
1162+
- imish_route_domain_bugfix.yml
1163+
- issue-2429.yaml
1164+
release_date: '2024-10-24'
11541165
1.4.0:
11551166
changes:
11561167
bugfixes:

ansible_collections/f5networks/f5_modules/galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ tags:
3030
- networking
3131
- bigip
3232
- bigiq
33-
version: 1.31.0
33+
version: 1.32.0

ansible_collections/f5networks/f5_modules/plugins/module_utils/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
55

66
# This collection version needs to be updated at each release
7-
CURRENT_COLL_VERSION = "1.31.0"
7+
CURRENT_COLL_VERSION = "1.32.0"

ansible_collections/f5networks/f5_modules/plugins/modules/bigip_gtm_server.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,24 @@ def exists(self):
15911591
else:
15921592
raise F5ModuleError(resp.content)
15931593

1594+
def check_datacenter(self):
1595+
# check if datacenter exists
1596+
if self.want.datacenter is not None:
1597+
uri = "https://{0}:{1}/mgmt/tm/gtm/datacenter/".format(
1598+
self.client.provider['server'],
1599+
self.client.provider['server_port']
1600+
)
1601+
resp = self.client.api.get(uri)
1602+
try:
1603+
response = resp.json()
1604+
datacenter = [dc for dc in response['items'] if dc['fullPath'] == self.want.datacenter]
1605+
if len(datacenter) == 0:
1606+
raise F5ModuleError(
1607+
f'{self.want.datacenter} does not exists'
1608+
)
1609+
except ValueError as ex:
1610+
raise F5ModuleError(str(ex))
1611+
15941612

15951613
class V1Manager(BaseManager):
15961614
def _assign_creation_defaults(self):
@@ -1630,10 +1648,12 @@ def handle_prober_settings(self):
16301648
self.want._values.pop('prober_preference')
16311649
if self.want.prober_fallback is not None:
16321650
self.want._values.pop('prober_fallback')
1651+
self.check_datacenter()
16331652

16341653

16351654
class V2Manager(BaseManager):
16361655
def update(self):
1656+
self.check_datacenter()
16371657
self.have = self.read_current_from_device()
16381658
if not self.should_update():
16391659
return False

ansible_collections/f5networks/f5_modules/plugins/modules/bigip_imish_config.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324

325325
import os
326326
import tempfile
327+
import time
327328
from datetime import datetime
328329

329330
from ansible.module_utils.basic import AnsibleModule
@@ -629,18 +630,26 @@ def load_config_on_device(self, name):
629630
self.client.provider['server'],
630631
self.client.provider['server_port']
631632
)
632-
resp = self.client.api.post(uri, json=params)
633-
try:
634-
response = resp.json()
635-
except ValueError as ex:
636-
raise F5ModuleError(str(ex))
637633

638-
if resp.status in [200, 201] or 'code' in response and response['code'] in [200, 201]:
639-
if 'commandResult' in response:
640-
if 'Dynamic routing is not enabled' in response['commandResult']:
641-
raise F5ModuleError(response['commandResult'])
642-
return True
643-
raise F5ModuleError(resp.content)
634+
x = 0
635+
while x < 3:
636+
resp = self.client.api.post(uri, json=params)
637+
try:
638+
response = resp.json()
639+
except ValueError as ex:
640+
raise F5ModuleError(str(ex))
641+
642+
if resp.status in [200, 201] or 'code' in response and response['code'] in [200, 201]:
643+
if 'commandResult' in response:
644+
if 'Dynamic routing is not enabled' in response['commandResult']:
645+
raise F5ModuleError(response['commandResult'])
646+
if 'Protocol daemon is not running' in response['commandResult']:
647+
x += 1
648+
time.sleep(5)
649+
continue
650+
return True
651+
652+
raise F5ModuleError(resp.content)
644653

645654
def read_current_from_device(self):
646655
command = 'imish -r {0} -e \\\"show running-config\\\"'.format(self.want.route_domain)

ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_gtm_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def test_create(self, *args):
192192
m1 = V1Manager(module=module, params=module.params)
193193
m1.exists = Mock(side_effect=[False, True])
194194
m1.create_on_device = Mock(return_value=True)
195+
m1.check_datacenter = Mock(return_value=[{"fullPath": "/Common/New York"}])
195196
m1.client = Mock()
196197
m1.client.api.tmos_version = '12.0.0'
197198

@@ -287,6 +288,7 @@ def test_create(self, *args):
287288
m1 = V2Manager(module=module)
288289
m1.exists = Mock(side_effect=[False, True])
289290
m1.create_on_device = Mock(return_value=True)
291+
m1.check_datacenter = Mock(return_value=[{"fullPath": "/Common/New York"}])
290292
m1.client = Mock()
291293
m1.client.api.tmos_version = '13.1.0'
292294

0 commit comments

Comments
 (0)