openshift/openshift-restclient-python

`generateName` not supported

thoraxe opened this issue · 7 comments

Given:

      apiVersion: operators.coreos.com/v1
      kind: OperatorGroup
      metadata:
        generateName: openshift-logging-
        namespace: openshift-logging
      spec:
        targetNamespaces:
        - openshift-logging

You get this error:

fatal: [54.167.84.227]: FAILED! => changed=false 
  module_stderr: |-
    Shared connection to 54.167.84.227 closed.
  module_stdout: |-
    Traceback (most recent call last):
      File "/home/ec2-user/.ansible/tmp/ansible-tmp-1554305107.0657294-129560095264473/AnsiballZ_k8s.py", line 113, in <module>
        _ansiballz_main()
      File "/home/ec2-user/.ansible/tmp/ansible-tmp-1554305107.0657294-129560095264473/AnsiballZ_k8s.py", line 105, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/ec2-user/.ansible/tmp/ansible-tmp-1554305107.0657294-129560095264473/AnsiballZ_k8s.py", line 48, in invoke_module
        imp.load_module('__main__', mod, module, MOD_DESC)
      File "/tmp/ansible_k8s_payload_e3pqqy/__main__.py", line 171, in <module>
      File "/tmp/ansible_k8s_payload_e3pqqy/__main__.py", line 167, in main
      File "/tmp/ansible_k8s_payload_e3pqqy/ansible_k8s_payload.zip/ansible/module_utils/k8s/raw.py", line 98, in execute_module
      File "/tmp/ansible_k8s_payload_e3pqqy/ansible_k8s_payload.zip/ansible/module_utils/k8s/raw.py", line 223, in perform_action
      File "/tmp/ansible_k8s_payload_e3pqqy/ansible_k8s_payload.zip/ansible/module_utils/k8s/raw.py", line 241, in patch_resource
      File "/usr/lib/python2.7/site-packages/openshift/dynamic/client.py", line 71, in inner
        resp = func(self, resource, *args, **kwargs)
      File "/usr/lib/python2.7/site-packages/openshift/dynamic/client.py", line 268, in patch
        raise ValueError("name is required to patch {}.{}".format(resource.group_version, resource.kind))
    ValueError: name is required to patch operators.coreos.com/v1.OperatorGroup
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

Driven by ansible

It looks as though you were able to create the OperatorGroup, but this failure was on a subsequent run of the role/playbook. Is that right?

I wonder what it would take to support idempotency when using generateName.

I don't think the OperatorGroup already existed... I was under the impression that it wouldn't create it at all because name was not specified.

I was able to recreate the issue and it wasn't previously created. Seeing patch in the error threw me off.

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.