Skip to content

Commit

Permalink
Removes ignores for f5 (ansible#40038)
Browse files Browse the repository at this point in the history
Removes ignores for f5 from unit tests and fixes any issues that
are being suppressed by the ignores
  • Loading branch information
caphrim007 authored May 12, 2018
1 parent 383a4f0 commit 06f76d6
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 83 deletions.
1 change: 1 addition & 0 deletions lib/ansible/modules/network/f5/bigip_asm_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
choices:
- present
- absent
default: present
file:
description:
- Full path to a policy file to be imported into the BIG-IP ASM.
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/modules/network/f5/bigip_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
then all conditionals in the I(wait_for) must be satisfied. If
the value is set to C(any) then only one of the values must be
satisfied.
choices:
- any
- all
default: all
retries:
description:
Expand Down
14 changes: 7 additions & 7 deletions lib/ansible/modules/network/f5/bigip_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
save:
description:
- The C(save) argument instructs the module to save the
running-config to startup-config. This operation is performed
after any changes are made to the current running config. If
no changes are made, the configuration is still saved to the
startup config. This option will always cause the module to
return changed.
running-config to startup-config.
- This operation is performed after any changes are made to the
current running config. If no changes are made, the configuration
is still saved to the startup config.
- This option will always cause the module to return changed.
type: bool
default: no
default: yes
reset:
description:
- Loads the default configuration on the device.
Expand Down Expand Up @@ -323,7 +323,7 @@ def __init__(self):
),
save=dict(
type='bool',
default=True
default='yes'
)
)
self.argument_spec = {}
Expand Down
9 changes: 2 additions & 7 deletions lib/ansible/modules/network/f5/bigip_device_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
operation each time a lookup is needed. Please note that this applies
only to Access Policy Manager features, such as ACLs, web application
rewrites, and authentication.
default: disable
choices:
- enabled
- disabled
- enable
- disable
name_servers:
description:
- A list of name servers that the system uses to validate DNS lookups
Expand Down Expand Up @@ -320,18 +321,12 @@ def __init__(self):
choices=['disabled', 'enabled', 'disable', 'enable']
),
name_servers=dict(
required=False,
default=None,
type='list'
),
search=dict(
required=False,
default=None,
type='list'
),
ip_version=dict(
required=False,
default=None,
choices=[4, 6],
type='int'
),
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/modules/network/f5/bigip_device_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
choices:
- present
- absent
default: present
notes:
- This module is primarily used as a component of configuring HA pairs of
BIG-IP devices.
Expand Down
7 changes: 3 additions & 4 deletions lib/ansible/modules/network/f5/bigip_device_httpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
description:
- Specifies, if you have enabled HTTPD access, the IP address or address
range for other systems that can communicate with this system.
choices:
- all
- IP address, such as 172.27.1.10
- IP range, such as 172.27.*.* or 172.27.0.0/255.255.0.0
- To specify all addresses, use the value C(all).
- IP address can be specified, such as 172.27.1.10.
- IP rangees can be specified, such as 172.27.*.* or 172.27.0.0/255.255.0.0.
auth_name:
description:
- Sets the BIG-IP authentication realm name.
Expand Down
1 change: 0 additions & 1 deletion lib/ansible/modules/network/f5/bigip_device_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
description:
- The timezone to set for NTP lookups. At least one of C(ntp_servers) or
C(timezone) is required.
default: UTC
extends_documentation_fragment: f5
author:
- Tim Rupp (@caphrim007)
Expand Down
7 changes: 3 additions & 4 deletions lib/ansible/modules/network/f5/bigip_device_sshd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
- Specifies, if you have enabled SSH access, the IP address or address
range for other systems that can use SSH to communicate with this
system.
choices:
- all
- IP address, such as 172.27.1.10
- IP range, such as 172.27.*.* or 172.27.0.0/255.255.0.0
- To specify all addresses, use the value C(all).
- IP address can be specified, such as 172.27.1.10.
- IP rangees can be specified, such as 172.27.*.* or 172.27.0.0/255.255.0.0.
banner:
description:
- Whether to enable the banner or not.
Expand Down
56 changes: 41 additions & 15 deletions lib/ansible/modules/network/f5/bigip_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
short_description: Collect facts from F5 BIG-IP devices
description:
- Collect facts from F5 BIG-IP devices via iControl SOAP API
version_added: "1.6"
version_added: 1.6
author:
- Matt Hite (@mhite)
- Tim Rupp (@caphrim007)
Expand All @@ -36,12 +36,12 @@
description:
- BIG-IP session support; may be useful to avoid concurrency
issues in certain circumstances.
default: no
type: bool
default: 'yes'
include:
description:
- Fact category or list of categories to collect
required: true
required: True
choices:
- address_class
- certificate
Expand Down Expand Up @@ -83,20 +83,22 @@
import re
import traceback

try:
from suds import MethodNotFound, WebFault
except ImportError:
pass # Handle via f5_utils.bigsuds_found

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.f5_utils import bigip_api, bigsuds_found
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves import map, zip

try:
from library.module_utils.network.f5.legacy import bigip_api, bigsuds_found
from library.module_utils.network.f5.common import f5_argument_spec
except ImportError:
from ansible.module_utils.network.f5.legacy import bigip_api, bigsuds_found
from ansible.module_utils.network.f5.common import f5_argument_spec

try:
from suds import MethodNotFound, WebFault
except ImportError:
pass # Handle via f5_utils.bigsuds_found


class F5(object):
"""F5 iControl class.
Expand Down Expand Up @@ -1089,6 +1091,9 @@ class AddressClasses(object):
F5 BIG-IP address group/class class.
In TMUI these things are known as Address Data Groups. Examples that ship with the
box include /Common/aol and /Common/private_net
Attributes:
api: iControl API instance.
address_classes: List of address classes.
Expand All @@ -1107,7 +1112,15 @@ def get_list(self):
def get_address_class(self):
key = self.api.LocalLB.Class.get_address_class(self.address_classes)
value = self.api.LocalLB.Class.get_address_class_member_data_value(key)
result = list(map(zip, [x['members'] for x in key], value))

result = []
for idx, v in enumerate(key):
for idx2, member in enumerate(v['members']):
dg_value = dict(
value=value[idx][idx2]
)
dg_value.update(member)
result.append(dg_value)
return result

def get_description(self):
Expand Down Expand Up @@ -1639,9 +1652,18 @@ def generate_provision_dict(f5):
def main():
argument_spec = f5_argument_spec
meta_args = dict(
session=dict(type='bool', default=False),
include=dict(type='list', required=True),
filter=dict(type='str', required=False),
session=dict(type='bool', default='no'),
include=dict(
type='raw',
required=True,
choices=[
'address_class', 'certificate', 'client_ssl_profile', 'device',
'device_group', 'interface', 'key', 'node', 'pool', 'provision',
'rule', 'self_ip', 'software', 'system_info', 'traffic_group',
'trunk', 'virtual_address', 'virtual_server', 'vlan'
]
),
filter=dict(type='str'),
)
argument_spec.update(meta_args)

Expand Down Expand Up @@ -1671,15 +1693,19 @@ def main():
regex = fnmatch.translate(fact_filter)
else:
regex = None
include = [x.lower() for x in module.params['include']]
if isinstance(module.params['include'], string_types):
includes = module.params['include'].split(',')
else:
includes = module.params['include']
include = [x.lower() for x in includes]
valid_includes = ('address_class', 'certificate', 'client_ssl_profile',
'device', 'device_group', 'interface', 'key', 'node',
'pool', 'provision', 'rule', 'self_ip', 'software',
'system_info', 'traffic_group', 'trunk',
'virtual_address', 'virtual_server', 'vlan')
include_test = (x in valid_includes for x in include)
if not all(include_test):
module.fail_json(msg="value of include must be one or more of: %s, got: %s" % (",".join(valid_includes), ",".join(include)))
module.fail_json(msg="Value of include must be one or more of: %s, got: %s" % (",".join(valid_includes), ",".join(include)))

try:
facts = {}
Expand Down
2 changes: 2 additions & 0 deletions lib/ansible/modules/network/f5/bigip_gtm_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- absent
- enabled
- disabled
default: present
preferred_lb_method:
description:
- The load balancing mode that the system tries first.
Expand Down Expand Up @@ -94,6 +95,7 @@
- drop-packet
- fallback-ip
- virtual-server-score
- none
fallback_ip:
description:
- Specifies the IPv4, or IPv6 address of the server to which the system
Expand Down
22 changes: 16 additions & 6 deletions lib/ansible/modules/network/f5/bigip_gtm_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,12 +769,22 @@ class ArgumentSpec(object):
def __init__(self):
self.states = ['absent', 'present', 'enabled', 'disabled']
self.server_types = [
'alteon-ace-director', 'cisco-css', 'cisco-server-load-balancer',
'generic-host', 'radware-wsd', 'windows-nt-4.0', 'bigip',
'cisco-local-director-v2', 'extreme', 'generic-load-balancer',
'sun-solaris', 'cacheflow', 'cisco-local-director-v3',
'foundry-server-iron', 'netapp', 'standalone-bigip',
'redundant-bigip', 'windows-2000-server'
'alteon-ace-director',
'cisco-css',
'cisco-server-load-balancer',
'generic-host',
'radware-wsd',
'windows-nt-4.0',
'bigip',
'cisco-local-director-v2',
'extreme',
'generic-load-balancer',
'sun-solaris',
'cacheflow',
'cisco-local-director-v3',
'foundry-server-iron',
'netapp',
'windows-2000-server'
]
self.supports_check_mode = True
argument_spec = dict(
Expand Down
4 changes: 3 additions & 1 deletion lib/ansible/modules/network/f5/bigip_iapp_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
over any similar setting in the iApp Server payload that you provide in
the C(parameters) field.
default: yes
type: bool
version_added: 2.5
traffic_group:
description:
Expand Down Expand Up @@ -618,7 +619,8 @@ def __init__(self):
type='bool'
),
strict_updates=dict(
type='bool'
type='bool',
default='yes'
),
traffic_group=dict(),
partition=dict(
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/f5/bigip_monitor_snmp_dca.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def __init__(self):
timeout=dict(type='int'),
time_until_up=dict(type='int'),
community=dict(),
version=dict(),
version=dict(choices=['v1', 'v2c']),
agent_type=dict(
choices=['UCD', 'WIN2000', 'GENERIC']
),
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/modules/network/f5/bigip_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- present
- absent
- draft
default: present
strategy:
description:
- Specifies the method to determine which actions get executed in the
Expand Down
4 changes: 2 additions & 2 deletions lib/ansible/modules/network/f5/bigip_profile_client_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
- The parent template of this monitor template. Once this value has
been set, it cannot be changed. By default, this value is the C(clientssl)
parent on the C(Common) partition.
default: "/Common/clientssl"
default: /Common/clientssl
ciphers:
description:
- Specifies the list of ciphers that the system supports. When creating a new
Expand Down Expand Up @@ -480,7 +480,7 @@ def __init__(self):
self.supports_check_mode = True
argument_spec = dict(
name=dict(required=True),
parent=dict(),
parent=dict(default='/Common/clientssl'),
ciphers=dict(),
cert_key_chain=dict(
type='list',
Expand Down
3 changes: 2 additions & 1 deletion lib/ansible/modules/network/f5/bigip_selfip.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
name:
description:
- The self IP to create.
- If this parameter is not specified, then it will default to the value supplied
in the C(address) parameter.
required: True
default: Value of C(address)
netmask:
description:
- The netmask for the self IP. When creating a new Self IP, this value
Expand Down
13 changes: 6 additions & 7 deletions lib/ansible/modules/network/f5/bigip_sys_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,26 +383,25 @@ class ArgumentSpec(object):
def __init__(self):
self.supports_check_mode = True
self.states = ['present']
self.on_off_choices = ['enabled', 'disabled', 'True', 'False'] + list(BOOLEANS)
argument_spec = dict(
security_banner=dict(
choices=self.on_off_choices
type='bool'
),
banner_text=dict(),
gui_setup=dict(
choices=self.on_off_choices
type='bool'
),
lcd_display=dict(
choices=self.on_off_choices
type='bool'
),
mgmt_dhcp=dict(
choices=self.on_off_choices
type='bool'
),
net_reboot=dict(
choices=self.on_off_choices
type='bool'
),
quiet_boot=dict(
choices=self.on_off_choices
type='bool'
),
console_timeout=dict(required=False, type='int', default=None),
state=dict(default='present', choices=['present'])
Expand Down
Loading

0 comments on commit 06f76d6

Please sign in to comment.