Fixed bug in example where updating a user to a group Fixed bug in create_group and update_group whereby paramaters were not being set correctly.

This commit is contained in:
toninog 2015-06-08 13:55:24 +01:00 committed by Matt Clay
parent 97ce6a500d
commit 15b65fa115

View file

@ -144,7 +144,7 @@ task:
iam_type: user iam_type: user
name: jdavila name: jdavila
state: update state: update
group: "{{ item.created_group.group_name }}" groups: "{{ item.created_group.group_name }}"
with_items: new_groups.results with_items: new_groups.results
''' '''
@ -387,7 +387,7 @@ new_name=None):
return (groups, changed) return (groups, changed)
def create_group(module, iam, name, path): def create_group(module=None, iam=None, name=None, path=None):
changed = False changed = False
try: try:
iam.create_group( iam.create_group(
@ -425,8 +425,7 @@ def delete_group(module, iam, name):
changed = True changed = True
return changed, name return changed, name
def update_group(module=None, iam=None, name=None, new_name=None, new_path=None):
def update_group(module, iam, name, new_name, new_path):
changed = False changed = False
try: try:
current_group_path = iam.get_group( current_group_path = iam.get_group(
@ -678,7 +677,7 @@ def main():
module.exit_json(changed=changed, group_name=new_group) module.exit_json(changed=changed, group_name=new_group)
elif state in ['present', 'update'] and group_exists: elif state in ['present', 'update'] and group_exists:
changed, updated_name, updated_path, cur_path = update_group( changed, updated_name, updated_path, cur_path = update_group(
iam, name, new_name, new_path) iam=iam, name=name, new_name=new_name, new_path=new_path)
if new_path and new_name: if new_path and new_name:
module.exit_json(changed=changed, old_group_name=name, module.exit_json(changed=changed, old_group_name=name,