mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Refactors main() function and module manager in multiple modules (#53948)
Improves docs
This commit is contained in:
parent
dcc4e0f220
commit
fbc8ee0288
16 changed files with 168 additions and 177 deletions
|
@ -23,6 +23,7 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the APM policy or APM access profile exported to create a file on the remote device for downloading.
|
- The name of the APM policy or APM access profile exported to create a file on the remote device for downloading.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
dest:
|
dest:
|
||||||
description:
|
description:
|
||||||
|
@ -31,9 +32,11 @@ options:
|
||||||
file:
|
file:
|
||||||
description:
|
description:
|
||||||
- The name of the file to be created on the remote device for downloading.
|
- The name of the file to be created on the remote device for downloading.
|
||||||
|
type: str
|
||||||
type:
|
type:
|
||||||
description:
|
description:
|
||||||
- Specifies the type of item to export from device.
|
- Specifies the type of item to export from device.
|
||||||
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- profile_access
|
- profile_access
|
||||||
- access_policy
|
- access_policy
|
||||||
|
@ -41,11 +44,12 @@ options:
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- If C(no), the file will only be transferred if it does not exist in the the destination.
|
- If C(no), the file will only be transferred if it does not exist in the the destination.
|
||||||
default: yes
|
|
||||||
type: bool
|
type: bool
|
||||||
|
default: yes
|
||||||
partition:
|
partition:
|
||||||
description:
|
description:
|
||||||
- Device partition to which contain APM policy or APM access profile to export.
|
- Device partition to which contain APM policy or APM access profile to export.
|
||||||
|
type: str
|
||||||
default: Common
|
default: Common
|
||||||
notes:
|
notes:
|
||||||
- Due to ID685681 it is not possible to execute ng_* tools via REST api on v12.x and 13.x, once this is fixed
|
- Due to ID685681 it is not possible to execute ng_* tools via REST api on v12.x and 13.x, once this is fixed
|
||||||
|
@ -127,10 +131,7 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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
|
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.common import transform_name
|
from library.module_utils.network.f5.common import transform_name
|
||||||
from library.module_utils.network.f5.icontrol import download_file
|
from library.module_utils.network.f5.icontrol import download_file
|
||||||
from library.module_utils.network.f5.icontrol import tmos_version
|
from library.module_utils.network.f5.icontrol import tmos_version
|
||||||
|
@ -139,10 +140,7 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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
|
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.common import transform_name
|
from ansible.module_utils.network.f5.common import transform_name
|
||||||
from ansible.module_utils.network.f5.icontrol import download_file
|
from ansible.module_utils.network.f5.icontrol import download_file
|
||||||
from ansible.module_utils.network.f5.icontrol import tmos_version
|
from ansible.module_utils.network.f5.icontrol import tmos_version
|
||||||
|
@ -262,7 +260,7 @@ class ReportableChanges(Changes):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params)
|
self.want = ModuleParameters(params=self.module.params)
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
|
||||||
|
@ -489,16 +487,12 @@ def main():
|
||||||
supports_check_mode=spec.supports_check_mode,
|
supports_check_mode=spec.supports_check_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -23,10 +23,12 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the APM policy or APM access profile to create or override.
|
- The name of the APM policy or APM access profile to create or override.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
type:
|
type:
|
||||||
description:
|
description:
|
||||||
- Specifies the type of item to export from device.
|
- Specifies the type of item to export from device.
|
||||||
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- profile_access
|
- profile_access
|
||||||
- access_policy
|
- access_policy
|
||||||
|
@ -120,12 +122,9 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import transform_name
|
from library.module_utils.network.f5.common import transform_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
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 upload_file
|
||||||
from library.module_utils.network.f5.icontrol import tmos_version
|
from library.module_utils.network.f5.icontrol import tmos_version
|
||||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
@ -133,12 +132,9 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import transform_name
|
from ansible.module_utils.network.f5.common import transform_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
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 upload_file
|
||||||
from ansible.module_utils.network.f5.icontrol import tmos_version
|
from ansible.module_utils.network.f5.icontrol import tmos_version
|
||||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
@ -218,7 +214,7 @@ class Difference(object):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params)
|
self.want = ModuleParameters(params=self.module.params)
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
|
||||||
|
@ -397,16 +393,12 @@ def main():
|
||||||
supports_check_mode=spec.supports_check_mode,
|
supports_check_mode=spec.supports_check_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -36,6 +36,7 @@ options:
|
||||||
- If you are using the C(to_nice_json) filter, it will cause this module to fail because
|
- If you are using the C(to_nice_json) filter, it will cause this module to fail because
|
||||||
the purpose of that filter is to format the JSON to be human-readable and this process
|
the purpose of that filter is to format the JSON to be human-readable and this process
|
||||||
includes inserting "extra characters that break JSON validators.
|
includes inserting "extra characters that break JSON validators.
|
||||||
|
type: raw
|
||||||
required: True
|
required: True
|
||||||
tenants:
|
tenants:
|
||||||
description:
|
description:
|
||||||
|
@ -44,6 +45,7 @@ options:
|
||||||
C(state) is C(present).
|
C(state) is C(present).
|
||||||
- A value of C(all) will remove all tenants.
|
- A value of C(all) will remove all tenants.
|
||||||
- Tenants can be specified as a list as well to remove only specific tenants.
|
- Tenants can be specified as a list as well to remove only specific tenants.
|
||||||
|
type: raw
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- Force updates a declaration.
|
- Force updates a declaration.
|
||||||
|
@ -55,6 +57,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- When C(state) is C(present), ensures the configuration exists.
|
- When C(state) is C(present), ensures the configuration exists.
|
||||||
- When C(state) is C(absent), ensures that the configuration is removed.
|
- When C(state) is C(absent), ensures that the configuration is removed.
|
||||||
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
- absent
|
- absent
|
||||||
|
@ -116,14 +119,12 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
from library.module_utils.network.f5.common import f5_argument_spec
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
from ansible.module_utils.network.f5.common import f5_argument_spec
|
||||||
|
|
||||||
|
@ -328,7 +329,7 @@ class Difference(object):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params)
|
self.want = ModuleParameters(params=self.module.params)
|
||||||
self.have = ApiParameters()
|
self.have = ApiParameters()
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
@ -532,15 +533,11 @@ def main():
|
||||||
required_if=spec.required_if
|
required_if=spec.required_if
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
|
||||||
module.fail_json(msg=str(ex))
|
module.fail_json(msg=str(ex))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the policy exported to create a file on the remote device for downloading.
|
- The name of the policy exported to create a file on the remote device for downloading.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
dest:
|
dest:
|
||||||
description:
|
description:
|
||||||
|
@ -33,6 +34,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- The name of the file to be create on the remote device for downloading.
|
- The name of the file to be create on the remote device for downloading.
|
||||||
- When C(binary) is set to C(no) the ASM policy will be in XML format.
|
- When C(binary) is set to C(no) the ASM policy will be in XML format.
|
||||||
|
type: str
|
||||||
inline:
|
inline:
|
||||||
description:
|
description:
|
||||||
- If C(yes), the ASM policy will be exported C(inline) as a string instead of a file.
|
- If C(yes), the ASM policy will be exported C(inline) as a string instead of a file.
|
||||||
|
@ -61,6 +63,7 @@ options:
|
||||||
partition:
|
partition:
|
||||||
description:
|
description:
|
||||||
- Device partition which contains ASM policy to export.
|
- Device partition which contains ASM policy to export.
|
||||||
|
type: str
|
||||||
default: Common
|
default: Common
|
||||||
extends_documentation_fragment: f5
|
extends_documentation_fragment: f5
|
||||||
author:
|
author:
|
||||||
|
@ -177,11 +180,8 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
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.common import flatten_boolean
|
from library.module_utils.network.f5.common import flatten_boolean
|
||||||
from library.module_utils.network.f5.icontrol import download_file
|
from library.module_utils.network.f5.icontrol import download_file
|
||||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
@ -189,11 +189,8 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
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.common import flatten_boolean
|
from ansible.module_utils.network.f5.common import flatten_boolean
|
||||||
from ansible.module_utils.network.f5.icontrol import download_file
|
from ansible.module_utils.network.f5.icontrol import download_file
|
||||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
@ -353,7 +350,7 @@ class ReportableChanges(Changes):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params)
|
self.want = ModuleParameters(params=self.module.params)
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
|
||||||
|
@ -679,16 +676,12 @@ def main():
|
||||||
mutually_exclusive=spec.mutually_exclusive,
|
mutually_exclusive=spec.mutually_exclusive,
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -23,11 +23,13 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The ASM policy to create or override.
|
- The ASM policy to create or override.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
inline:
|
inline:
|
||||||
description:
|
description:
|
||||||
- When specified the ASM policy is created from a provided string.
|
- When specified the ASM policy is created from a provided string.
|
||||||
- Content needs to be provided in a valid XML format otherwise the operation will fail.
|
- Content needs to be provided in a valid XML format otherwise the operation will fail.
|
||||||
|
type: str
|
||||||
source:
|
source:
|
||||||
description:
|
description:
|
||||||
- Full path to a policy file to be imported into the BIG-IP ASM.
|
- Full path to a policy file to be imported into the BIG-IP ASM.
|
||||||
|
@ -45,6 +47,7 @@ options:
|
||||||
partition:
|
partition:
|
||||||
description:
|
description:
|
||||||
- Device partition to create policy on.
|
- Device partition to create policy on.
|
||||||
|
type: str
|
||||||
default: Common
|
default: Common
|
||||||
extends_documentation_fragment: f5
|
extends_documentation_fragment: f5
|
||||||
author:
|
author:
|
||||||
|
@ -116,24 +119,18 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import transform_name
|
from library.module_utils.network.f5.common import transform_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
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 upload_file
|
||||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import transform_name
|
from ansible.module_utils.network.f5.common import transform_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
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 upload_file
|
||||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
|
||||||
|
@ -212,7 +209,7 @@ class Difference(object):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params)
|
self.want = ModuleParameters(params=self.module.params)
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
|
||||||
|
@ -466,16 +463,12 @@ def main():
|
||||||
mutually_exclusive=spec.mutually_exclusive
|
mutually_exclusive=spec.mutually_exclusive
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -30,6 +30,7 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The ASM policy to manage or create.
|
- The ASM policy to manage or create.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
|
@ -39,6 +40,7 @@ options:
|
||||||
new blank ASM policy is created with the given policy C(name).
|
new blank ASM policy is created with the given policy C(name).
|
||||||
- When C(state) is C(absent), ensures that the policy is removed, even if it is
|
- When C(state) is C(absent), ensures that the policy is removed, even if it is
|
||||||
currently active.
|
currently active.
|
||||||
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
- absent
|
- absent
|
||||||
|
@ -50,6 +52,7 @@ options:
|
||||||
- The C(Comprehensive), C(Drupal), C(Fundamental), C(Joomla),
|
- The C(Comprehensive), C(Drupal), C(Fundamental), C(Joomla),
|
||||||
C(Vulnerability Assessment Baseline), and C(Wordpress) templates are only available
|
C(Vulnerability Assessment Baseline), and C(Wordpress) templates are only available
|
||||||
on BIG-IP versions >= 13.
|
on BIG-IP versions >= 13.
|
||||||
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- ActiveSync v1.0 v2.0 (http)
|
- ActiveSync v1.0 v2.0 (http)
|
||||||
- ActiveSync v1.0 v2.0 (https)
|
- ActiveSync v1.0 v2.0 (https)
|
||||||
|
@ -89,6 +92,7 @@ options:
|
||||||
partition:
|
partition:
|
||||||
description:
|
description:
|
||||||
- Device partition to manage resources on.
|
- Device partition to manage resources on.
|
||||||
|
type: str
|
||||||
default: Common
|
default: Common
|
||||||
extends_documentation_fragment: f5
|
extends_documentation_fragment: f5
|
||||||
author:
|
author:
|
||||||
|
@ -182,24 +186,18 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import transform_name
|
from library.module_utils.network.f5.common import transform_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
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 tmos_version
|
from library.module_utils.network.f5.icontrol import tmos_version
|
||||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import transform_name
|
from ansible.module_utils.network.f5.common import transform_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
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 tmos_version
|
from ansible.module_utils.network.f5.icontrol import tmos_version
|
||||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
|
||||||
|
@ -755,7 +753,8 @@ class BaseManager(object):
|
||||||
|
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
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
|
self.kwargs = kwargs
|
||||||
|
|
||||||
def exec_module(self):
|
def exec_module(self):
|
||||||
|
@ -785,8 +784,8 @@ class ModuleManager(object):
|
||||||
|
|
||||||
class V1Manager(BaseManager):
|
class V1Manager(BaseManager):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
client = kwargs.get('client', None)
|
|
||||||
module = kwargs.get('module', None)
|
module = kwargs.get('module', None)
|
||||||
|
client = F5RestClient(**module.params)
|
||||||
super(V1Manager, self).__init__(client=client, module=module)
|
super(V1Manager, self).__init__(client=client, module=module)
|
||||||
self.want = V1Parameters(params=module.params, client=client)
|
self.want = V1Parameters(params=module.params, client=client)
|
||||||
|
|
||||||
|
@ -796,8 +795,8 @@ class V1Manager(BaseManager):
|
||||||
|
|
||||||
class V2Manager(BaseManager):
|
class V2Manager(BaseManager):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
client = kwargs.get('client', None)
|
|
||||||
module = kwargs.get('module', None)
|
module = kwargs.get('module', None)
|
||||||
|
client = F5RestClient(**module.params)
|
||||||
super(V2Manager, self).__init__(client=client, module=module)
|
super(V2Manager, self).__init__(client=client, module=module)
|
||||||
self.want = V2Parameters(params=module.params, client=client)
|
self.want = V2Parameters(params=module.params, client=client)
|
||||||
|
|
||||||
|
@ -881,16 +880,12 @@ def main():
|
||||||
supports_check_mode=spec.supports_check_mode,
|
supports_check_mode=spec.supports_check_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -23,6 +23,7 @@ options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of the server technology to apply on or remove from the ASM policy.
|
- Specifies the name of the server technology to apply on or remove from the ASM policy.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
choices:
|
choices:
|
||||||
- jQuery
|
- jQuery
|
||||||
|
@ -69,11 +70,13 @@ options:
|
||||||
policy_name:
|
policy_name:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of an existing ASM policy to add or remove server technology.
|
- Specifies the name of an existing ASM policy to add or remove server technology.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- When C(present), ensures that the resource exists.
|
- When C(present), ensures that the resource exists.
|
||||||
- When C(absent), ensures the resource is removed.
|
- When C(absent), ensures the resource is removed.
|
||||||
|
type: str
|
||||||
default: present
|
default: present
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
|
@ -81,6 +84,7 @@ options:
|
||||||
partition:
|
partition:
|
||||||
description:
|
description:
|
||||||
- This parameter is only used when identifying ASM policy.
|
- This parameter is only used when identifying ASM policy.
|
||||||
|
type: str
|
||||||
default: Common
|
default: Common
|
||||||
notes:
|
notes:
|
||||||
- This module is primarily used as a component of configuring ASM policy in Ansible Galaxy ASM Policy Role.
|
- This module is primarily used as a component of configuring ASM policy in Ansible Galaxy ASM Policy Role.
|
||||||
|
@ -133,24 +137,18 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import transform_name
|
from library.module_utils.network.f5.common import transform_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
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 tmos_version
|
from library.module_utils.network.f5.icontrol import tmos_version
|
||||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import transform_name
|
from ansible.module_utils.network.f5.common import transform_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
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 tmos_version
|
from ansible.module_utils.network.f5.icontrol import tmos_version
|
||||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
|
||||||
|
@ -206,7 +204,7 @@ class ReportableChanges(Changes):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params)
|
self.want = ModuleParameters(params=self.module.params)
|
||||||
self.have = ApiParameters()
|
self.have = ApiParameters()
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
@ -472,16 +470,12 @@ def main():
|
||||||
supports_check_mode=spec.supports_check_mode,
|
supports_check_mode=spec.supports_check_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -80,10 +80,12 @@ options:
|
||||||
- When C(XPath Injection Signatures), configures signatures targeting attacks that attempt to gain access
|
- When C(XPath Injection Signatures), configures signatures targeting attacks that attempt to gain access
|
||||||
to data structures or bypass permissions when a web site uses user-supplied information
|
to data structures or bypass permissions when a web site uses user-supplied information
|
||||||
to construct XPath queries for XML data.
|
to construct XPath queries for XML data.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
policy_name:
|
policy_name:
|
||||||
description:
|
description:
|
||||||
- Specifies the name of an existing ASM policy to add or remove signature sets.
|
- Specifies the name of an existing ASM policy to add or remove signature sets.
|
||||||
|
type: str
|
||||||
required: True
|
required: True
|
||||||
alarm:
|
alarm:
|
||||||
description:
|
description:
|
||||||
|
@ -107,6 +109,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- When C(present), ensures that the resource exists.
|
- When C(present), ensures that the resource exists.
|
||||||
- When C(absent), ensures the resource is removed.
|
- When C(absent), ensures the resource is removed.
|
||||||
|
type: str
|
||||||
default: present
|
default: present
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
|
@ -114,6 +117,7 @@ options:
|
||||||
partition:
|
partition:
|
||||||
description:
|
description:
|
||||||
- This parameter is only used when identifying ASM policy.
|
- This parameter is only used when identifying ASM policy.
|
||||||
|
type: str
|
||||||
default: Common
|
default: Common
|
||||||
notes:
|
notes:
|
||||||
- This module is primarily used as a component of configuring ASM policy in Ansible Galaxy ASM Policy Role.
|
- This module is primarily used as a component of configuring ASM policy in Ansible Galaxy ASM Policy Role.
|
||||||
|
@ -180,12 +184,9 @@ try:
|
||||||
from library.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from library.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from library.module_utils.network.f5.common import transform_name
|
from library.module_utils.network.f5.common import transform_name
|
||||||
from library.module_utils.network.f5.common import f5_argument_spec
|
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.common import flatten_boolean
|
from library.module_utils.network.f5.common import flatten_boolean
|
||||||
from library.module_utils.network.f5.icontrol import tmos_version
|
from library.module_utils.network.f5.icontrol import tmos_version
|
||||||
from library.module_utils.network.f5.icontrol import module_provisioned
|
from library.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
@ -193,12 +194,9 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.bigip import F5RestClient
|
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 F5ModuleError
|
||||||
from ansible.module_utils.network.f5.common import AnsibleF5Parameters
|
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 fq_name
|
||||||
from ansible.module_utils.network.f5.common import transform_name
|
from ansible.module_utils.network.f5.common import transform_name
|
||||||
from ansible.module_utils.network.f5.common import f5_argument_spec
|
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.common import flatten_boolean
|
from ansible.module_utils.network.f5.common import flatten_boolean
|
||||||
from ansible.module_utils.network.f5.icontrol import tmos_version
|
from ansible.module_utils.network.f5.icontrol import tmos_version
|
||||||
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
from ansible.module_utils.network.f5.icontrol import module_provisioned
|
||||||
|
@ -415,7 +413,7 @@ class Difference(object):
|
||||||
class ModuleManager(object):
|
class ModuleManager(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.module = kwargs.get('module', None)
|
self.module = kwargs.get('module', None)
|
||||||
self.client = kwargs.get('client', None)
|
self.client = F5RestClient(**self.module.params)
|
||||||
self.want = ModuleParameters(params=self.module.params, client=self.client)
|
self.want = ModuleParameters(params=self.module.params, client=self.client)
|
||||||
self.have = ApiParameters()
|
self.have = ApiParameters()
|
||||||
self.changes = UsableChanges()
|
self.changes = UsableChanges()
|
||||||
|
@ -711,16 +709,12 @@ def main():
|
||||||
supports_check_mode=spec.supports_check_mode,
|
supports_check_mode=spec.supports_check_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
client = F5RestClient(**module.params)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mm = ModuleManager(module=module, client=client)
|
mm = ModuleManager(module=module)
|
||||||
results = mm.exec_module()
|
results = mm.exec_module()
|
||||||
cleanup_tokens(client)
|
module.exit_json(**results)
|
||||||
exit_json(module, results, client)
|
|
||||||
except F5ModuleError as ex:
|
except F5ModuleError as ex:
|
||||||
cleanup_tokens(client)
|
module.fail_json(msg=str(ex))
|
||||||
fail_json(module, ex, client)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -70,9 +70,11 @@ class TestParameters(unittest.TestCase):
|
||||||
dest='/tmp/',
|
dest='/tmp/',
|
||||||
force='yes',
|
force='yes',
|
||||||
file='foo_export',
|
file='foo_export',
|
||||||
password='password',
|
provider=dict(
|
||||||
server='localhost',
|
server='localhost',
|
||||||
user='admin'
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
p = ModuleParameters(params=args)
|
p = ModuleParameters(params=args)
|
||||||
assert p.file == 'foo_export'
|
assert p.file == 'foo_export'
|
||||||
|
@ -102,9 +104,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
file='foo_export',
|
file='foo_export',
|
||||||
dest='/tmp/',
|
dest='/tmp/',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -103,9 +103,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
source=self.policy,
|
source=self.policy,
|
||||||
type='access_policy',
|
type='access_policy',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -85,14 +85,17 @@ class TestManager(unittest.TestCase):
|
||||||
def test_create(self, *args):
|
def test_create(self, *args):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
content='{ "foo": "bar" }',
|
content='{ "foo": "bar" }',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
user='admin',
|
server='localhost',
|
||||||
password='password'
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=self.spec.argument_spec,
|
argument_spec=self.spec.argument_spec,
|
||||||
supports_check_mode=self.spec.supports_check_mode
|
supports_check_mode=self.spec.supports_check_mode,
|
||||||
|
required_if=self.spec.required_if
|
||||||
)
|
)
|
||||||
mm = ModuleManager(module=module)
|
mm = ModuleManager(module=module)
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,7 @@ class TestParameters(unittest.TestCase):
|
||||||
base64='yes',
|
base64='yes',
|
||||||
dest='/tmp/foo.xml',
|
dest='/tmp/foo.xml',
|
||||||
force='yes',
|
force='yes',
|
||||||
file='foo.xml',
|
file='foo.xml'
|
||||||
password='password',
|
|
||||||
server='localhost',
|
|
||||||
user='admin'
|
|
||||||
)
|
)
|
||||||
p = ModuleParameters(params=args)
|
p = ModuleParameters(params=args)
|
||||||
assert p.inline is True
|
assert p.inline is True
|
||||||
|
@ -108,9 +105,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
file='foobar.xml',
|
file='foobar.xml',
|
||||||
dest='/tmp/foobar.xml',
|
dest='/tmp/foobar.xml',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -101,14 +101,17 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
source=self.policy,
|
source=self.policy,
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=self.spec.argument_spec,
|
argument_spec=self.spec.argument_spec,
|
||||||
supports_check_mode=self.spec.supports_check_mode
|
supports_check_mode=self.spec.supports_check_mode,
|
||||||
|
mutually_exclusive=self.spec.mutually_exclusive,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Override methods to force specific logic in the module to happen
|
# Override methods to force specific logic in the module to happen
|
||||||
|
|
|
@ -112,9 +112,11 @@ class TestManager(unittest.TestCase):
|
||||||
template='OWA Exchange 2007 (https)',
|
template='OWA Exchange 2007 (https)',
|
||||||
state='present',
|
state='present',
|
||||||
active='yes',
|
active='yes',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -149,9 +151,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
active='yes',
|
active='yes',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -186,9 +190,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
active='yes',
|
active='yes',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -219,9 +225,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
active='yes',
|
active='yes',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_active.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_active.json'))
|
||||||
|
@ -248,10 +256,12 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
server='localhost',
|
active='no',
|
||||||
password='password',
|
provider=dict(
|
||||||
user='admin',
|
server='localhost',
|
||||||
active='no'
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_active.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_active.json'))
|
||||||
|
@ -280,10 +290,12 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
server='localhost',
|
active='no',
|
||||||
password='password',
|
provider=dict(
|
||||||
user='admin',
|
server='localhost',
|
||||||
active='no'
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -311,9 +323,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
template='LotusDomino 6.5 (http)',
|
template='LotusDomino 6.5 (http)',
|
||||||
state='present',
|
state='present',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -346,9 +360,11 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -382,9 +398,11 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='absent',
|
state='absent',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -411,9 +429,11 @@ class TestManager(unittest.TestCase):
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
active='yes',
|
active='yes',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
current = V1Parameters(params=load_fixture('load_asm_policy_inactive.json'))
|
||||||
|
@ -444,9 +464,11 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -474,9 +496,11 @@ class TestManager(unittest.TestCase):
|
||||||
set_module_args(dict(
|
set_module_args(dict(
|
||||||
name='fake_policy',
|
name='fake_policy',
|
||||||
state='absent',
|
state='absent',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -99,9 +99,11 @@ class TestManager(unittest.TestCase):
|
||||||
policy_name='fake_policy',
|
policy_name='fake_policy',
|
||||||
state='present',
|
state='present',
|
||||||
name='IIS',
|
name='IIS',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -126,9 +126,11 @@ class TestManager(unittest.TestCase):
|
||||||
alarm='yes',
|
alarm='yes',
|
||||||
block='no',
|
block='no',
|
||||||
learn='yes',
|
learn='yes',
|
||||||
server='localhost',
|
provider=dict(
|
||||||
password='password',
|
server='localhost',
|
||||||
user='admin',
|
password='password',
|
||||||
|
user='admin'
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue