Skip to content

secret object doesn't have "status" attribute #98

@sterburg

Description

@sterburg

Task definition

- name: "Define OpenShift Git Secret"
  k8s_v1_secret:
    namespace: "{{ namespace }}"
    verify_ssl: False
    resource_definition:
      type: kubernetes.io/basic-auth
      metadata:
        annotations:
          build.openshift.io/source-secret-match-uri-1: "{{ vstsGitRepo.json.remoteUrl }}/*"
        creationTimestamp: null
        name: git
      data:
        username: "{{ vsts_username | b64encode }}"
        password: "{{ vsts_password | b64encode }}"
      status:
        dockerImageRepository: ""
  ignore_errors: true
  tags:
  - openshift

playbook run result

TASK [provision-visualstudio-project : Define OpenShift Git Secret] ************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'V1Secret' object has no attribute 'status'
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_gxhcA4/ansible_module_k8s_v1_secret.py\", line 342, in <module>\n    main()\n  File \"/tmp/ansible_gxhcA4/ansible_module_k8s_v1_secret.py\", line 336, in main\n    module.execute_module()\n  File \"/tmp/ansible_gxhcA4/ansible_modlib.zip/ansible/module_utils/k8s_common.py\", line 199, in execute_module\n  File \"/tmp/ansible_gxhcA4/ansible_modlib.zip/ansible/module_utils/k8s_common.py\", line 251, 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: 'V1Secret' object has no attribute 'status'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

remarks

oc get secret git -o yaml doesn't show any "status" attribute.
I guess you are assuming every object has a "status" attribute.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions