ansible / ansible-kubernetes-modules

DEPRECATED Ansible role containing pre-release K8s modules
Apache License 2.0
73 stars 39 forks source link

AttributeError: 'V1ConfigMap' object has no attribute 'status' #1

Closed jcpowermac closed 7 years ago

jcpowermac commented 7 years ago

When using the current the most current version of the apb-base container

docker.io/ansibleplaybookbundle/apb-base   latest              70252c2680a6        7 days ago          444.9 MB

I get a failure when using the k8s_v1_config_map module. Even though it fails the object is created along with the appropriate data. If I try to create a configmap without data it will succeed.

(venv) > $ oc get configmap orgfolder
NAME        DATA      AGE
orgfolder   5         5m

This is error also is occurring in k8s_v1_secret.

Ansible Version

bash-4.2$ ansible-playbook --version
ansible-playbook 2.3.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

OpenShift Version

(venv) > $ oc version
oc v1.5.0-rc.0+49a4a7a
kubernetes v1.5.2+43a9be4
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://openshift.virtomation.com:8443
openshift v3.5.5.5
kubernetes v1.5.2+43a9be4

Playbook

- name: Create ConfigMap
  k8s_v1_config_map:
    debug: False
    name: orgfolder
    namespace: '{{ namespace }}'
    data:
      name: "{{ jenkins_org_folder_name }}"
      displayName: "{{ jenkins_org_folder_name }}"
      repoOwner: "{{ jenkins_github_owner }}"
      pattern: "{{ jenkins_github_repo }}"
      credentialsId: "{{ jenkins_github_cred_id }}"

Task Failure

TASK [provision-openshift-pipeline : Create ConfigMap] ***********************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. 
See: https://urllib3.readthedocs.org/en/latest/security.html\n  InsecureRequestWarning)\n/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. 
See: https://urllib3.readthedocs.org/en/latest/security.html\n  InsecureRequestWarning)\n/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. 
See: https://urllib3.readthedocs.org/en/latest/security.html\n  InsecureRequestWarning)\n/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. 
See: https://urllib3.readthedocs.org/en/latest/security.html\n  InsecureRequestWarning)\n

Traceback (most recent call last):\n  File \"/tmp/ansible_sKHT8x/ansible_module_k8s_v1_config_map.py\", line 316, in <module>\n    main()\n  File \"/tmp/ansible_sKHT8x/ansible_module_k8s_v1_config_map.py\", line 310, in main\n    module.execute_module()\n  File \"/tmp/ansible_sKHT8x/ansible_modlib.zip/ansible/module_utils/k8s_common.py\", line 183, in execute_module\n  File \"/tmp/ansible_sKHT8x/ansible_modlib.zip/ansible/module_utils/k8s_common.py\", line 235, in _create\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/base.py\", line 242, in create_object\n    return_obj = self._wait_for_response(name, namespace, 'create')\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/base.py\", line 493, in _wait_for_response\n    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}
jcpowermac commented 7 years ago

Should be resolved with https://github.com/openshift/openshift-restclient-python/pull/61