BIGIP: deprecates TMOS v11.x support for GTM modules (#54543)

* deprecates TMOS v11 support for GTM modules

* correct version

* correct version
This commit is contained in:
Wojciech Wypior 2019-03-30 22:52:55 +01:00 committed by Tim Rupp
parent b36c0832ae
commit 6a27e308dd
4 changed files with 51 additions and 0 deletions

View file

@ -208,6 +208,8 @@ options:
- Specifies the number of seconds that the IP address, once found, is valid. - Specifies the number of seconds that the IP address, once found, is valid.
type: int type: int
version_added: 2.8 version_added: 2.8
notes:
- Support for TMOS versions below v12.x has been deprecated for this module, and will be removed in Ansible 2.12.
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -889,12 +891,29 @@ class BaseManager(object):
def _announce_deprecations(self, result): def _announce_deprecations(self, result):
warnings = result.pop('__warnings', []) warnings = result.pop('__warnings', [])
if self.version_is_less_than_12():
self._deprecate_v11(warnings)
for warning in warnings: for warning in warnings:
self.module.deprecate( self.module.deprecate(
msg=warning['msg'], msg=warning['msg'],
version=warning['version'] version=warning['version']
) )
def version_is_less_than_12(self):
version = tmos_version(self.client)
if LooseVersion(version) < LooseVersion('12.0.0'):
return True
else:
return False
def _deprecate_v11(self, result):
result.append(
dict(
msg='The support for this TMOS version is deprecated.',
version='2.12'
)
)
def present(self): def present(self):
if self.exists(): if self.exists():
return self.update() return self.update()

View file

@ -123,6 +123,8 @@ options:
module. module.
type: str type: str
version_added: 2.8 version_added: 2.8
notes:
- Support for TMOS versions below v12.x has been deprecated for this module, and will be removed in Ansible 2.12.
extends_documentation_fragment: f5 extends_documentation_fragment: f5
author: author:
- Tim Rupp (@caphrim007) - Tim Rupp (@caphrim007)
@ -646,12 +648,29 @@ class BaseManager(object):
def _announce_deprecations(self, result): def _announce_deprecations(self, result):
warnings = result.pop('__warnings', []) warnings = result.pop('__warnings', [])
if self.version_is_less_than_12():
self._deprecate_v11(warnings)
for warning in warnings: for warning in warnings:
self.module.deprecate( self.module.deprecate(
msg=warning['msg'], msg=warning['msg'],
version=warning['version'] version=warning['version']
) )
def version_is_less_than_12(self):
version = tmos_version(self.client)
if LooseVersion(version) < LooseVersion('12.0.0'):
return True
else:
return False
def _deprecate_v11(self, result):
result.append(
dict(
msg='The support for this TMOS version is deprecated.',
version='2.12'
)
)
def present(self): def present(self):
if self.exists(): if self.exists():
return self.update() return self.update()

View file

@ -162,6 +162,7 @@ class TestUntypedManager(unittest.TestCase):
tm = UntypedManager(module=module) tm = UntypedManager(module=module)
tm.exists = Mock(side_effect=[False, True]) tm.exists = Mock(side_effect=[False, True])
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=True)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -200,6 +201,7 @@ class TestUntypedManager(unittest.TestCase):
tm = UntypedManager(module=module) tm = UntypedManager(module=module)
tm.exists = Mock(side_effect=[True, True]) tm.exists = Mock(side_effect=[True, True])
tm.update_on_device = Mock(return_value=True) tm.update_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=True)
tm.read_current_from_device = Mock(return_value=current) tm.read_current_from_device = Mock(return_value=current)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -236,6 +238,7 @@ class TestUntypedManager(unittest.TestCase):
# Override methods in the specific type of manager # Override methods in the specific type of manager
tm = UntypedManager(module=module) tm = UntypedManager(module=module)
tm.exists = Mock(side_effect=[True, False]) tm.exists = Mock(side_effect=[True, False])
tm.version_is_less_than_12 = Mock(return_value=True)
tm.remove_from_device = Mock(return_value=True) tm.remove_from_device = Mock(return_value=True)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -289,6 +292,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module) tm = TypedManager(module=module)
tm.exists = Mock(side_effect=[False, True]) tm.exists = Mock(side_effect=[False, True])
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -328,6 +332,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module) tm = TypedManager(module=module)
tm.exists = Mock(side_effect=[True, True]) tm.exists = Mock(side_effect=[True, True])
tm.update_on_device = Mock(return_value=True) tm.update_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
tm.read_current_from_device = Mock(return_value=current) tm.read_current_from_device = Mock(return_value=current)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
@ -365,6 +370,7 @@ class TestTypedManager(unittest.TestCase):
# Override methods in the specific type of manager # Override methods in the specific type of manager
tm = TypedManager(module=module) tm = TypedManager(module=module)
tm.exists = Mock(side_effect=[True, False]) tm.exists = Mock(side_effect=[True, False])
tm.version_is_less_than_12 = Mock(return_value=False)
tm.remove_from_device = Mock(return_value=True) tm.remove_from_device = Mock(return_value=True)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen

View file

@ -159,6 +159,7 @@ class TestUntypedManager(unittest.TestCase):
tm = UntypedManager(module=module, params=module.params) tm = UntypedManager(module=module, params=module.params)
tm.exists = Mock(return_value=False) tm.exists = Mock(return_value=False)
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=True)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -210,6 +211,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module, params=module.params) tm = TypedManager(module=module, params=module.params)
tm.exists = Mock(return_value=False) tm.exists = Mock(return_value=False)
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -244,6 +246,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module, params=module.params) tm = TypedManager(module=module, params=module.params)
tm.exists = Mock(return_value=False) tm.exists = Mock(return_value=False)
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -278,6 +281,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module, params=module.params) tm = TypedManager(module=module, params=module.params)
tm.exists = Mock(return_value=False) tm.exists = Mock(return_value=False)
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -318,6 +322,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module, params=module.params) tm = TypedManager(module=module, params=module.params)
tm.exists = Mock(return_value=False) tm.exists = Mock(return_value=False)
tm.create_on_device = Mock(return_value=True) tm.create_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -359,6 +364,7 @@ class TestTypedManager(unittest.TestCase):
tm = TypedManager(module=module, params=module.params) tm = TypedManager(module=module, params=module.params)
tm.exists = Mock(return_value=True) tm.exists = Mock(return_value=True)
tm.read_current_from_device = Mock(return_value=current) tm.read_current_from_device = Mock(return_value=current)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)
@ -402,6 +408,7 @@ class TestTypedManager(unittest.TestCase):
tm.exists = Mock(return_value=True) tm.exists = Mock(return_value=True)
tm.read_current_from_device = Mock(return_value=current) tm.read_current_from_device = Mock(return_value=current)
tm.update_on_device = Mock(return_value=True) tm.update_on_device = Mock(return_value=True)
tm.version_is_less_than_12 = Mock(return_value=False)
# Override methods to force specific logic in the module to happen # Override methods to force specific logic in the module to happen
mm = ModuleManager(module=module) mm = ModuleManager(module=module)