Fixes for convention incompatibilities (#39209)

Minor fixes for the f5 modules to use current conventions
pull/39211/head
Tim Rupp 7 years ago committed by GitHub
parent 37e114756d
commit 39e4754fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,7 +18,7 @@ module: bigip_software_update
short_description: Manage the software update settings of a BIG-IP
description:
- Manage the software update settings of a BIG-IP.
version_added: "2.5"
version_added: 2.5
options:
auto_check:
description:
@ -48,7 +48,6 @@ EXAMPLES = r'''
auto_check: yes
password: secret
server: lb.mydomain.com
state: present
user: admin
delegate_to: localhost
@ -58,7 +57,6 @@ EXAMPLES = r'''
auto_phone_home: no
password: secret
server: lb.mydomain.com
state: present
user: admin
delegate_to: localhost
'''
@ -83,31 +81,26 @@ frequency:
from ansible.module_utils.basic import AnsibleModule
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:

@ -63,7 +63,6 @@ author:
- Tim Rupp (@caphrim007)
'''
EXAMPLES = r'''
- name: Use a file lookup to import PEM Certificate
bigip_ssl_certificate:
@ -127,31 +126,28 @@ import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import env_fallback
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
@ -187,11 +183,6 @@ class Parameters(AnsibleF5Parameters):
k.update(data.encode('utf-8'))
return k.hexdigest()
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
class ApiParameters(Parameters):
@property
@ -215,7 +206,7 @@ class ModuleParameters(Parameters):
def issuer_cert(self):
if self._values['issuer_cert'] is None:
return None
name = self._fqdn_name(self._values['issuer_cert'])
name = fq_name(self.partition, self._values['issuer_cert'])
if name.endswith('.crt'):
return name
else:

@ -110,30 +110,23 @@ import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import env_fallback
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError

@ -57,6 +57,7 @@ options:
reject:
description:
- Specifies that the system drops packets sent to the destination.
type: bool
mtu:
description:
- Specifies a specific maximum transmission unit (MTU).
@ -67,9 +68,8 @@ options:
- This value cannot be changed once it is set.
state:
description:
- When C(present), ensures that the cloud connector exists. When
C(absent), ensures that the cloud connector does not exist.
required: False
- When C(present), ensures that the static route exists.
- When C(absent), ensures that the static does not exist.
default: present
choices:
- present
@ -146,31 +146,28 @@ import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from library.module_utils.network.f5.common import fq_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from ansible.module_utils.network.f5.common import fq_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
@ -224,7 +221,7 @@ class ModuleParameters(Parameters):
def vlan(self):
if self._values['vlan'] is None:
return None
return fqdn_name(self.partition, self._values['vlan'])
return fq_name(self.partition, self._values['vlan'])
@property
def gateway_address(self):
@ -251,6 +248,8 @@ class ModuleParameters(Parameters):
return None
if self._values['destination'] == 'default':
self._values['destination'] = '0.0.0.0/0'
if self._values['destination'] == 'default-inet6':
self._values['destination'] = '::/::'
try:
ip = netaddr.IPNetwork(self.destination_ip)
if self.route_domain:
@ -315,6 +314,8 @@ class ApiParameters(Parameters):
return None
if self._values['destination'] == 'default':
self._values['destination'] = '0.0.0.0/0'
if self._values['destination'] == 'default-inet6':
self._values['destination'] = '::/::'
try:
pattern = r'(?P<rd>%[0-9]+)'
addr = re.sub(pattern, '', self._values['destination'])

@ -18,7 +18,7 @@ module: bigip_sys_db
short_description: Manage BIG-IP system database variables
description:
- Manage BIG-IP system database variables
version_added: "2.2"
version_added: 2.2
options:
key:
description:
@ -94,31 +94,26 @@ value:
from ansible.module_utils.basic import AnsibleModule
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:

@ -18,7 +18,7 @@ module: bigip_sys_global
short_description: Manage BIG-IP global settings
description:
- Manage BIG-IP global settings.
version_added: "2.3"
version_added: 2.3
options:
banner_text:
description:
@ -140,31 +140,26 @@ from ansible.module_utils.parsing.convert_bool import BOOLEANS
from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE
from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE
HAS_DEVEL_IMPORTS = False
try:
# Sideband repository used for dev
from library.module_utils.network.f5.bigip import HAS_F5SDK
from library.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from library.module_utils.network.f5.common import f5_argument_spec
try:
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:
HAS_F5SDK = False
HAS_DEVEL_IMPORTS = True
except ImportError:
# Upstream Ansible
from ansible.module_utils.network.f5.bigip import HAS_F5SDK
from ansible.module_utils.network.f5.bigip import F5Client
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 fqdn_name
from ansible.module_utils.network.f5.common import f5_argument_spec
try:
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
except ImportError:

@ -1164,7 +1164,6 @@ lib/ansible/modules/network/f5/bigip_qkview.py E324
lib/ansible/modules/network/f5/bigip_qkview.py E326
lib/ansible/modules/network/f5/bigip_routedomain.py E326
lib/ansible/modules/network/f5/bigip_selfip.py E324
lib/ansible/modules/network/f5/bigip_static_route.py E325
lib/ansible/modules/network/f5/bigip_sys_global.py E326
lib/ansible/modules/network/f5/bigip_virtual_server.py E326
lib/ansible/modules/network/f5/bigiq_regkey_license.py E325

@ -20,10 +20,10 @@ from ansible.compat.tests.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.bigip_software_update import ApiParameters
from library.bigip_software_update import ModuleParameters
from library.bigip_software_update import ModuleManager
from library.bigip_software_update import ArgumentSpec
from library.modules.bigip_software_update import ApiParameters
from library.modules.bigip_software_update import ModuleParameters
from library.modules.bigip_software_update import ModuleManager
from library.modules.bigip_software_update import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args

@ -20,11 +20,11 @@ from ansible.compat.tests.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.bigip_ssl_certificate import ArgumentSpec
from library.bigip_ssl_certificate import ApiParameters
from library.bigip_ssl_certificate import ModuleParameters
from library.bigip_ssl_certificate import ModuleManager
from library.bigip_ssl_certificate import HAS_F5SDK
from library.modules.bigip_ssl_certificate import ArgumentSpec
from library.modules.bigip_ssl_certificate import ApiParameters
from library.modules.bigip_ssl_certificate import ModuleParameters
from library.modules.bigip_ssl_certificate import ModuleManager
from library.modules.bigip_ssl_certificate import HAS_F5SDK
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args

@ -20,10 +20,10 @@ from ansible.compat.tests.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.bigip_ssl_key import ArgumentSpec
from library.bigip_ssl_key import Parameters
from library.bigip_ssl_key import ModuleManager
from library.bigip_ssl_key import HAS_F5SDK
from library.modules.bigip_ssl_key import ArgumentSpec
from library.modules.bigip_ssl_key import Parameters
from library.modules.bigip_ssl_key import ModuleManager
from library.modules.bigip_ssl_key import HAS_F5SDK
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args

@ -20,10 +20,10 @@ from ansible.compat.tests.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.bigip_static_route import ApiParameters
from library.bigip_static_route import ModuleParameters
from library.bigip_static_route import ModuleManager
from library.bigip_static_route import ArgumentSpec
from library.modules.bigip_static_route import ApiParameters
from library.modules.bigip_static_route import ModuleParameters
from library.modules.bigip_static_route import ModuleManager
from library.modules.bigip_static_route import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args

@ -20,9 +20,9 @@ from ansible.compat.tests.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.bigip_sys_db import Parameters
from library.bigip_sys_db import ModuleManager
from library.bigip_sys_db import ArgumentSpec
from library.modules.bigip_sys_db import Parameters
from library.modules.bigip_sys_db import ModuleManager
from library.modules.bigip_sys_db import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args

@ -20,10 +20,10 @@ from ansible.compat.tests.mock import patch
from ansible.module_utils.basic import AnsibleModule
try:
from library.bigip_sys_global import ApiParameters
from library.bigip_sys_global import ModuleParameters
from library.bigip_sys_global import ModuleManager
from library.bigip_sys_global import ArgumentSpec
from library.modules.bigip_sys_global import ApiParameters
from library.modules.bigip_sys_global import ModuleParameters
from library.modules.bigip_sys_global import ModuleManager
from library.modules.bigip_sys_global import ArgumentSpec
from library.module_utils.network.f5.common import F5ModuleError
from library.module_utils.network.f5.common import iControlUnexpectedHTTPError
from test.unit.modules.utils import set_module_args

Loading…
Cancel
Save