Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up validate-modules ignores for modules: net_tools/nios #1598

Merged
merged 29 commits into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4307938
Added ``normalize_ib_spec()``
russoz Jan 6, 2021
1b23da6
Added suboptions
russoz Jan 6, 2021
b3f5857
fixed validation-modules for plugins/modules/net_tools/nios/nios_a_re…
russoz Jan 6, 2021
8ffffb1
fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa…
russoz Jan 6, 2021
a9500fb
fixed validation-modules for plugins/modules/net_tools/nios/nios_cnam…
russoz Jan 6, 2021
4c7f275
fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_…
russoz Jan 6, 2021
d401397
fixed validation-modules for plugins/modules/net_tools/nios/nios_fixe…
russoz Jan 6, 2021
2b734ed
fixed validation-modules for plugins/modules/net_tools/nios/nios_host…
russoz Jan 6, 2021
f2fb035
fixed validation-modules for plugins/modules/net_tools/nios/nios_memb…
russoz Jan 6, 2021
81d87cc
fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_r…
russoz Jan 6, 2021
37f790d
fixed validation-modules for plugins/modules/net_tools/nios/nios_napt…
russoz Jan 6, 2021
787b781
fixed validation-modules for plugins/modules/net_tools/nios/nios_netw…
russoz Jan 6, 2021
ab5e340
fixed validation-modules for plugins/modules/net_tools/nios/nios_netw…
russoz Jan 6, 2021
090481e
fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_…
russoz Jan 6, 2021
a0adf8d
fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_…
russoz Jan 6, 2021
60af55c
fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_…
russoz Jan 6, 2021
3e83b06
fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py
russoz Jan 6, 2021
5d96723
fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgr…
russoz Jan 6, 2021
5d5acbd
Added function to normalize the ``ib_spec`` for ansible usage.
russoz Jan 6, 2021
556de17
Tidy up validate-modules ignores for net_tools/nios modules
russoz Jan 6, 2021
bbc9d7b
Update plugins/modules/net_tools/nios/nios_nsgroup.py
russoz Jan 6, 2021
f216827
Update plugins/modules/net_tools/nios/nios_nsgroup.py
russoz Jan 6, 2021
9bd0e1e
Update plugins/modules/net_tools/nios/nios_nsgroup.py
russoz Jan 6, 2021
c599c25
Update plugins/modules/net_tools/nios/nios_nsgroup.py
russoz Jan 6, 2021
cbb3ee5
Update plugins/modules/net_tools/nios/nios_nsgroup.py
russoz Jan 6, 2021
53da56b
Update plugins/modules/net_tools/nios/nios_nsgroup.py
russoz Jan 6, 2021
0c9c782
fixed missing defaults, per PR tests
russoz Jan 6, 2021
2435be2
added changelog fragment
russoz Jan 6, 2021
2da5d7e
Update changelogs/fragments/nios-fix-ib_spec.yaml
russoz Jan 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/nios-fix-ib_spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- nios modules - clean up module argument spec processing (https://github.com/ansible-collections/community.general/pull/1598).
18 changes: 18 additions & 0 deletions plugins/doc_fragments/nios.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ class ModuleDocFragment(object):
variable.
type: int
default: 1000
http_pool_connections:
description:
- Number of pools to be used by the C(infoblox_client.Connector) object.
- This is passed as-is to the underlying C(requests.adapters.HTTPAdapter) class.
type: int
default: 10
http_pool_maxsize:
description:
- Maximum number of connections per pool to be used by the C(infoblox_client.Connector) object.
- This is passed as-is to the underlying C(requests.adapters.HTTPAdapter) class.
type: int
default: 10
silent_ssl_warnings:
description:
- Disable C(urllib3) SSL warnings in the C(infoblox_client.Connector) object.
- This is passed as-is to the underlying C(requests.adapters.HTTPAdapter) class.
type: bool
default: true
notes:
- "This module must be run locally, which can be achieved by specifying C(connection: local)."
- Please read the :ref:`nios_guide` for more detailed information on how to use Infoblox with Ansible.
Expand Down
9 changes: 9 additions & 0 deletions plugins/module_utils/net_tools/nios/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ def member_normalize(member_spec):
return member_spec


def normalize_ib_spec(ib_spec):
result = {}
for arg in ib_spec:
result[arg] = dict([(k, v)
for k, v in iteritems(ib_spec[arg])
if k not in ('ib_req', 'transform', 'update')])
return result


class WapiBase(object):
''' Base class for implementing Infoblox WAPI API '''
provider_spec = {'provider': dict(type='dict', options=NIOS_PROVIDER_SPEC)}
Expand Down
8 changes: 6 additions & 2 deletions plugins/modules/net_tools/nios/nios_a_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@
ttl:
description:
- Configures the TTL to be associated with this A record
type: int
extattrs:
description:
- Allows for the configuration of Extensible Attributes on the
instance of the object. This argument accepts a set of key / value
pairs for configuration.
type: dict
comment:
description:
- Configures a text string comment to be associated with the instance
of this object. The provided text string will be configured on the
object instance.
type: str
state:
description:
- Configures the intended state of the instance of the object on
Expand All @@ -65,6 +68,7 @@
choices:
- present
- absent
type: str
'''

EXAMPLES = '''
Expand Down Expand Up @@ -128,9 +132,9 @@
RETURN = ''' # '''

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_A_RECORD
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_ib_spec


def main():
Expand All @@ -154,7 +158,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'])
)

argument_spec.update(ib_spec)
argument_spec.update(normalize_ib_spec(ib_spec))
argument_spec.update(WapiModule.provider_spec)

module = AnsibleModule(argument_spec=argument_spec,
Expand Down
11 changes: 9 additions & 2 deletions plugins/modules/net_tools/nios/nios_aaaa_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,37 @@
- Specifies the fully qualified hostname to add or remove from
the system
required: true
type: str
view:
description:
- Sets the DNS view to associate this AAAA record with. The DNS
view must already be configured on the system
default: default
aliases:
- dns_view
type: str
ipv6addr:
description:
- Configures the IPv6 address for this AAAA record.
aliases:
- ipv6
type: str
ttl:
description:
- Configures the TTL to be associated with this AAAA record
type: int
extattrs:
description:
- Allows for the configuration of Extensible Attributes on the
instance of the object. This argument accepts a set of key / value
pairs for configuration.
type: dict
comment:
description:
- Configures a text string comment to be associated with the instance
of this object. The provided text string will be configured on the
object instance.
type: str
state:
description:
- Configures the intended state of the instance of the object on
Expand All @@ -60,6 +66,7 @@
choices:
- present
- absent
type: str
'''

EXAMPLES = '''
Expand Down Expand Up @@ -112,9 +119,9 @@
RETURN = ''' # '''

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_AAAA_RECORD
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_ib_spec


def main():
Expand All @@ -138,7 +145,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'])
)

argument_spec.update(ib_spec)
argument_spec.update(normalize_ib_spec(ib_spec))
argument_spec.update(WapiModule.provider_spec)

module = AnsibleModule(argument_spec=argument_spec,
Expand Down
11 changes: 9 additions & 2 deletions plugins/modules/net_tools/nios/nios_cname_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,37 @@
- Specifies the fully qualified hostname to add or remove from
the system
required: true
type: str
view:
description:
- Sets the DNS view to associate this CNAME record with. The DNS
view must already be configured on the system
default: default
aliases:
- dns_view
type: str
canonical:
description:
- Configures the canonical name for this CNAME record.
aliases:
- cname
type: str
ttl:
description:
- Configures the TTL to be associated with this CNAME record
type: int
extattrs:
description:
- Allows for the configuration of Extensible Attributes on the
instance of the object. This argument accepts a set of key / value
pairs for configuration.
type: dict
comment:
description:
- Configures a text string comment to be associated with the instance
of this object. The provided text string will be configured on the
object instance.
type: str
state:
description:
- Configures the intended state of the instance of the object on
Expand All @@ -60,6 +66,7 @@
choices:
- present
- absent
type: str
'''

EXAMPLES = '''
Expand Down Expand Up @@ -101,9 +108,9 @@
RETURN = ''' # '''

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_CNAME_RECORD
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_ib_spec


def main():
Expand All @@ -127,7 +134,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'])
)

argument_spec.update(ib_spec)
argument_spec.update(normalize_ib_spec(ib_spec))
argument_spec.update(WapiModule.provider_spec)

module = AnsibleModule(argument_spec=argument_spec,
Expand Down
8 changes: 7 additions & 1 deletion plugins/modules/net_tools/nios/nios_dns_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,28 @@
required: true
aliases:
- view
type: str
network_view:
description:
- Specifies the name of the network view to assign the configured
DNS view to. The network view must already be configured on the
target system.
default: default
type: str
extattrs:
description:
- Allows for the configuration of Extensible Attributes on the
instance of the object. This argument accepts a set of key / value
pairs for configuration.
required: false
type: dict
comment:
description:
- Configures a text string comment to be associated with the instance
of this object. The provided text string will be configured on the
object instance.
required: false
type: str
state:
description:
- Configures the intended state of the instance of the object on
Expand All @@ -58,6 +62,7 @@
choices:
- present
- absent
type: str
'''

EXAMPLES = '''
Expand Down Expand Up @@ -105,6 +110,7 @@
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_DNS_VIEW
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_ib_spec


def main():
Expand All @@ -123,7 +129,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'])
)

argument_spec.update(ib_spec)
argument_spec.update(normalize_ib_spec(ib_spec))
argument_spec.update(WapiModule.provider_spec)

module = AnsibleModule(argument_spec=argument_spec,
Expand Down
15 changes: 14 additions & 1 deletion plugins/modules/net_tools/nios/nios_fixed_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,29 @@
- Specifies the hostname with which fixed DHCP ip-address is stored
for respective mac.
required: true
type: str
ipaddr:
description:
- IPV4/V6 address of the fixed address.
required: true
type: str
mac:
description:
- The MAC address of the interface.
required: true
type: str
network:
description:
- Specifies the network range in which ipaddr exists.
required: true
type: str
network_view:
description:
- Configures the name of the network view to associate with this
configured instance.
required: false
default: default
type: str
options:
description:
- Configures the set of DHCP options to be included as part of
Expand All @@ -56,13 +61,16 @@
name:
description:
- The name of the DHCP option to configure
type: str
num:
description:
- The number of the DHCP option to configure
type: int
value:
description:
- The value of the DHCP option specified by C(name)
required: true
type: str
use_option:
description:
- Only applies to a subset of options (see NIOS API documentation)
Expand All @@ -72,16 +80,19 @@
description:
- The name of the space this DHCP option is associated to
default: DHCP
type: str
extattrs:
description:
- Allows for the configuration of Extensible Attributes on the
instance of the object. This argument accepts a set of key / value
pairs for configuration.
type: dict
comment:
description:
- Configures a text string comment to be associated with the instance
of this object. The provided text string will be configured on the
object instance.
type: str
state:
description:
- Configures the intended state of the instance of the object on
Expand All @@ -92,6 +103,7 @@
choices:
- present
- absent
type: str
'''

EXAMPLES = '''
Expand Down Expand Up @@ -163,6 +175,7 @@
from ansible.module_utils.six import iteritems
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_IPV4_FIXED_ADDRESS, NIOS_IPV6_FIXED_ADDRESS
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_ib_spec


def validate_ip_address(address):
Expand Down Expand Up @@ -261,7 +274,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'])
)

argument_spec.update(ib_spec)
argument_spec.update(normalize_ib_spec(ib_spec))
argument_spec.update(WapiModule.provider_spec)

module = AnsibleModule(argument_spec=argument_spec,
Expand Down
Loading