Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
urohit011 committed Oct 24, 2024
2 parents 5ff625c + d16a778 commit 4b8f7bc
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 13 deletions.
13 changes: 13 additions & 0 deletions ansible_collections/f5networks/f5_modules/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ansible_collections/f5networks/f5_modules/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ tags:
- networking
- bigip
- bigiq
version: 1.31.0
version: 1.32.0
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@

import os
import tempfile
import time
from datetime import datetime

from ansible.module_utils.basic import AnsibleModule
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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'

Expand Down

0 comments on commit 4b8f7bc

Please sign in to comment.