mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
removes redundant functions (#53989)
This commit is contained in:
parent
e3b6a07f6e
commit
7592d486ed
3 changed files with 7 additions and 123 deletions
|
@ -241,11 +241,8 @@ try:
|
|||
from library.module_utils.network.f5.bigip import F5RestClient
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
||||
from library.module_utils.network.f5.common import cleanup_tokens
|
||||
from library.module_utils.network.f5.common import fq_name
|
||||
from library.module_utils.network.f5.common import f5_argument_spec
|
||||
from library.module_utils.network.f5.common import exit_json
|
||||
from library.module_utils.network.f5.common import fail_json
|
||||
from library.module_utils.network.f5.icontrol import upload_file
|
||||
from library.module_utils.network.f5.icontrol import tmos_version
|
||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||
|
@ -253,11 +250,8 @@ except ImportError:
|
|||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
||||
from ansible.module_utils.network.f5.common import cleanup_tokens
|
||||
from ansible.module_utils.network.f5.common import fq_name
|
||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
||||
from ansible.module_utils.network.f5.common import exit_json
|
||||
from ansible.module_utils.network.f5.common import fail_json
|
||||
from ansible.module_utils.network.f5.icontrol import upload_file
|
||||
from ansible.module_utils.network.f5.icontrol import tmos_version
|
||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||
|
@ -916,7 +910,8 @@ class BaseManager(object):
|
|||
|
||||
class ModuleManager(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.client = kwargs.get('client', None)
|
||||
self.module = kwargs.get('module', None)
|
||||
self.client = F5RestClient(**self.module.params)
|
||||
self.kwargs = kwargs
|
||||
|
||||
def exec_module(self):
|
||||
|
@ -946,8 +941,8 @@ class ModuleManager(object):
|
|||
|
||||
class V1Manager(BaseManager):
|
||||
def __init__(self, *args, **kwargs):
|
||||
client = kwargs.get('client', None)
|
||||
module = kwargs.get('module', None)
|
||||
client = F5RestClient(**module.params)
|
||||
super(V1Manager, self).__init__(client=client, module=module)
|
||||
self.want = V1Parameters(params=module.params, client=client)
|
||||
|
||||
|
@ -961,8 +956,8 @@ class V1Manager(BaseManager):
|
|||
|
||||
class V2Manager(BaseManager):
|
||||
def __init__(self, *args, **kwargs):
|
||||
client = kwargs.get('client', None)
|
||||
module = kwargs.get('module', None)
|
||||
client = F5RestClient(**module.params)
|
||||
super(V2Manager, self).__init__(client=client, module=module)
|
||||
self.want = V2Parameters(params=module.params, client=client)
|
||||
|
||||
|
@ -1055,13 +1050,11 @@ def main():
|
|||
client = F5RestClient(**module.params)
|
||||
|
||||
try:
|
||||
mm = ModuleManager(module=module, client=client)
|
||||
mm = ModuleManager(module=module)
|
||||
results = mm.exec_module()
|
||||
cleanup_tokens(client)
|
||||
exit_json(module, results, client)
|
||||
module.exit_json(**results)
|
||||
except F5ModuleError as ex:
|
||||
cleanup_tokens(client)
|
||||
fail_json(module, ex, client)
|
||||
module.fail_json(msg=str(ex))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -198,12 +198,10 @@ except ImportError:
|
|||
try:
|
||||
from library.module_utils.network.f5.common import F5ModuleError
|
||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
||||
from library.module_utils.network.f5.common import cleanup_tokens
|
||||
from library.module_utils.network.f5.common import f5_argument_spec
|
||||
except ImportError:
|
||||
from ansible.module_utils.network.f5.common import F5ModuleError
|
||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
||||
from ansible.module_utils.network.f5.common import cleanup_tokens
|
||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
||||
|
||||
|
||||
|
@ -978,10 +976,8 @@ def main():
|
|||
try:
|
||||
mm = ModuleManager(module=module, client=client)
|
||||
results = mm.exec_module()
|
||||
cleanup_tokens(client)
|
||||
module.exit_json(**results)
|
||||
except F5ModuleError as ex:
|
||||
cleanup_tokens(client)
|
||||
module.fail_json(msg=str(ex))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue