changed collection arg to argregate on 2.4 network modules (#26649)

* changed collection arg to argregate on 2.4 network modules

* replace users with aggregate in eos_user, junos_user, nxos_user

* added version_added to places where we replaced users with aggregate in the docs

* fix ios_static_route test

* update tests to reference aggregate instead of collection/users
This commit is contained in:
David Newswanger 2017-07-26 10:09:17 -04:00 committed by Peter Sprygada
commit 8643e9cb34
42 changed files with 170 additions and 167 deletions

View file

@ -35,19 +35,20 @@ description:
current running config. It also supports purging usernames from the
configuration that are not explicitly defined.
options:
users:
aggregate:
description:
- The set of username objects to be configured on the remote
Cisco Nexus device. The list entries can either be the username
or a hash of username and properties. This argument is mutually
exclusive with the C(name) argument.
version_added: "2.4"
required: false
default: null
name:
description:
- The username to be configured on the remote Cisco Nexus
device. This argument accepts a stringv value and is mutually
exclusive with the C(users) argument.
exclusive with the C(aggregate) argument.
required: false
default: null
update_password:
@ -106,7 +107,7 @@ EXAMPLES = """
purge: yes
- name: set multiple users role
users:
aggregate:
- name: netop
- name: netend
role: network-operator
@ -242,8 +243,8 @@ def get_param_value(key, item, module):
return value
def map_params_to_obj(module):
users = module.params['users']
if not users:
aggregate = module.params['aggregate']
if not aggregate:
if not module.params['name'] and module.params['purge']:
return list()
elif not module.params['name']:
@ -252,7 +253,7 @@ def map_params_to_obj(module):
collection = [{'name': module.params['name']}]
else:
collection = list()
for item in users:
for item in aggregate:
if not isinstance(item, dict):
collection.append({'name': item})
elif 'name' not in item:
@ -298,7 +299,7 @@ def main():
""" main entry point for module execution
"""
argument_spec = dict(
users=dict(type='list', no_log=True, aliases=['collection']),
aggregate=dict(type='list', no_log=True, aliases=['collection', 'users']),
name=dict(),
password=dict(no_log=True),
@ -314,7 +315,7 @@ def main():
argument_spec.update(nxos_argument_spec)
mutually_exclusive = [('name', 'users')]
mutually_exclusive = [('name', 'aggregate')]
module = AnsibleModule(argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,