Skip to content

Conversation

@mrchrd
Copy link
Contributor

@mrchrd mrchrd commented Aug 12, 2017

This fix the case where get_object is called for a method that accepts no argument (like list_group).

@fabianvf
Copy link
Member

Can you give me an example that is failing without this change?

@mrchrd
Copy link
Contributor Author

mrchrd commented Sep 8, 2017

When using the Ansible Kubernetes module (https://github.com/ansible/ansible-kubernetes-modules), asking to list groups for example, fail.

# task.yml
---
- openshift_v1_group_list:
  register: o_groups
- debug:
    var: o_groups

This returns an error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: list_group() takes exactly 1 argument (3 given)

Traceback (most recent call last):
  File "/tmp/ansible_gDZmjF/ansible_module_openshift_v1_group_list.py", line 332, in <module>
    main()
  File "/tmp/ansible_gDZmjF/ansible_module_openshift_v1_group_list.py", line 326, in main
    module.execute_module()
  File "/tmp/ansible_gDZmjF/ansible_modlib.zip/ansible/module_utils/k8s_common.py", line 178, in execute_module
  File "/usr/lib/python2.7/site-packages/openshift/helper/base.py", line 164, in get_object
    k8s_obj = get_method(name, namespace)
TypeError: list_group() takes exactly 1 argument (3 given)

Since no condition catches the case where both name and namespace are None, it reaches the else case and calls get_method(name, namespace) while list_group() expects no argument.

@fabianvf fabianvf merged commit 27c1d51 into openshift:master Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants