-
Notifications
You must be signed in to change notification settings - Fork 145
Closed
Labels
Description
Trying to create a k8s config map with the Ansible module k8s_v1_config_map always returns with an error even though the config map actually gets created. If the config map already exists, the module finishes successfully.
The module gets invoked in a role like so:
---
- name: "Create Control Center service config map"
k8s_v1_config_map:
state: "{{ state }}"
name: "cc-config-map"
namespace: "controlcenter"
resource_definition:
kind: "ConfigMap"
apiVersion: "v1"
metadata:
name: "cc-config-map"
namespace: "controlcenter"
data:
pod.yml: "{{ lookup('template', 'pod.yml.j2') }}"
service.yml: "{{ lookup('template', 'service.yml.j2') }}"
register: cc_config_map_result
Environment:
- Ansible from source (latest version in
devel) - Openshift from source with k8s modules generated via
openshift-ansible-gen modules
Error message:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'V1ConfigMap' object has no attribute 'status'
fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"module_stderr": "Traceback (most recent call last):
File \"/tmp/ansible_I4llL5/ansible_module_k8s_v1_config_map.py\", line 316, in <module> main()
File \"/tmp/ansible_I4llL5/ansible_module_k8s_v1_config_map.py\", line 310, in main module.execute_module()
File \"/tmp/ansible_I4llL5/ansible_modlib.zip/ansible/module_utils/k8s_common.py\", line 183, in execute_module
File \"/tmp/ansible_I4llL5/ansible_modlib.zip/ansible/module_utils/k8s_common.py\", line 235, in _create
File \"/usr/lib/python2.7/site-packages/openshift-1.0.0_snapshot-py2.7.egg/openshift/helper/base.py\", line 242, in create_object
return_obj = self._wait_for_response(name, namespace, 'create')
File \"/usr/lib/python2.7/site-packages/openshift-1.0.0_snapshot-py2.7.egg/openshift/helper/base.py\", line 493, in _wait_for_response
elif obj and obj.status and hasattr(obj.status, 'phase'):\nAttributeError: 'V1ConfigMap' object has no attribute 'status'\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 0
}