From 1c3fa2b07f92ef81c6831762bf9d79ffc121acc0 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Wed, 5 Dec 2018 16:02:16 -0800 Subject: [PATCH] Deprecate the bigip_asm_policy module (#49574) Specific import and export modules should be used instead --- ...gip_asm_policy.py => _bigip_asm_policy.py} | 19 ++++++++++++- .../network/f5/test_bigip_asm_policy.py | 28 +++++++++---------- 2 files changed, 32 insertions(+), 15 deletions(-) rename lib/ansible/modules/network/f5/{bigip_asm_policy.py => _bigip_asm_policy.py} (97%) diff --git a/lib/ansible/modules/network/f5/bigip_asm_policy.py b/lib/ansible/modules/network/f5/_bigip_asm_policy.py similarity index 97% rename from lib/ansible/modules/network/f5/bigip_asm_policy.py rename to lib/ansible/modules/network/f5/_bigip_asm_policy.py index c8448652b4..55f19cb166 100644 --- a/lib/ansible/modules/network/f5/bigip_asm_policy.py +++ b/lib/ansible/modules/network/f5/_bigip_asm_policy.py @@ -9,7 +9,7 @@ __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', - 'status': ['preview'], + 'status': ['deprecated'], 'supported_by': 'certified'} DOCUMENTATION = r''' @@ -19,6 +19,14 @@ short_description: Manage BIG-IP ASM policies description: - Manage BIG-IP ASM policies. version_added: 2.5 +deprecated: + removed_in: '2.12' + alternative: bigip_asm_policy_manage + why: > + The bigip_asm_policy module has been split into three new modules to handle import, export and general policy + management. This will allow scalability of the asm policy management as well as ease of maintenance. + Additionally to further reduce the burden of having multiple smaller module F5 has created asm_policy + role in Ansible Galaxy for a more declarative way of ASM policy management. options: active: description: @@ -500,8 +508,17 @@ class BaseManager(object): changes = self.changes.to_return() result.update(**changes) result.update(dict(changed=changed)) + self._announce_deprecations(result) return result + def _announce_deprecations(self, result): + warnings = result.pop('__warnings', []) + for warning in warnings: + self.client.module.deprecate( + msg=warning['msg'], + version=warning['version'] + ) + def _set_changed_options(self): changed = {} for key in Parameters.returnables: diff --git a/test/units/modules/network/f5/test_bigip_asm_policy.py b/test/units/modules/network/f5/test_bigip_asm_policy.py index ccc38b3669..7116d88250 100644 --- a/test/units/modules/network/f5/test_bigip_asm_policy.py +++ b/test/units/modules/network/f5/test_bigip_asm_policy.py @@ -17,12 +17,12 @@ if sys.version_info < (2, 7): from ansible.module_utils.basic import AnsibleModule try: - from library.modules.bigip_asm_policy import V1Parameters - from library.modules.bigip_asm_policy import V2Parameters - from library.modules.bigip_asm_policy import ModuleManager - from library.modules.bigip_asm_policy import V1Manager - from library.modules.bigip_asm_policy import V2Manager - from library.modules.bigip_asm_policy import ArgumentSpec + from library.modules._bigip_asm_policy import V1Parameters + from library.modules._bigip_asm_policy import V2Parameters + from library.modules._bigip_asm_policy import ModuleManager + from library.modules._bigip_asm_policy import V1Manager + from library.modules._bigip_asm_policy import V2Manager + from library.modules._bigip_asm_policy import ArgumentSpec from library.module_utils.network.f5.common import F5ModuleError @@ -33,12 +33,12 @@ try: from test.units.modules.utils import set_module_args except ImportError: - from ansible.modules.network.f5.bigip_asm_policy import V1Parameters - from ansible.modules.network.f5.bigip_asm_policy import V2Parameters - from ansible.modules.network.f5.bigip_asm_policy import ModuleManager - from ansible.modules.network.f5.bigip_asm_policy import V1Manager - from ansible.modules.network.f5.bigip_asm_policy import V2Manager - from ansible.modules.network.f5.bigip_asm_policy import ArgumentSpec + from ansible.modules.network.f5._bigip_asm_policy import V1Parameters + from ansible.modules.network.f5._bigip_asm_policy import V2Parameters + from ansible.modules.network.f5._bigip_asm_policy import ModuleManager + from ansible.modules.network.f5._bigip_asm_policy import V1Manager + from ansible.modules.network.f5._bigip_asm_policy import V2Manager + from ansible.modules.network.f5._bigip_asm_policy import ArgumentSpec from ansible.module_utils.network.f5.common import F5ModuleError @@ -99,11 +99,11 @@ class TestManager(unittest.TestCase): self.patcher1.start() try: - self.p1 = patch('library.modules.bigip_asm_policy.module_provisioned') + self.p1 = patch('library.modules._bigip_asm_policy.module_provisioned') self.m1 = self.p1.start() self.m1.return_value = True except Exception: - self.p1 = patch('ansible.modules.network.f5.bigip_asm_policy.module_provisioned') + self.p1 = patch('ansible.modules.network.f5._bigip_asm_policy.module_provisioned') self.m1 = self.p1.start() self.m1.return_value = True