
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,041 Views
When I try to modify this resource I always get the following error; for instance if I want to add htpasswd:
[student@workstation ~]$ oc replace -f oauth-htpasswd.yaml
Error from server (Conflict): error when replacing "oauth-htpasswd.yaml": Operation cannot be fulfilled on oauths.config.openshift.io "cluster": the object has been modified; please apply your changes to the latest version and try again
[student@workstation ~]$
Any idea how to achieve it?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,005 Views
Hi there! I wonder if the metadata in the oauth.yaml file is what's causing the conflict. When I create that file with the oc get command, my file includes the creationTimestamp, generation, resource version, and UID fields. I was able to use the oc replace command with this file without experiencing the error, but I did that quickly after generating the YAML file. I found this KB article regarding a similar error with the oc apply command and it suggests that outdated metadata prevents the YAML file from being applied. https://access.redhat.com/solutions/6428441
Manager - Technical Training, OpenShift Platforms
Product & Technical Learning

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,035 Views
I'm not sure about that error, I will have to do a little digging. However, it is easier just to edit that resource in place. if you type "oc edit oauth" you can edit the content directly on the server. They actually do that in step 9.3 of the lab.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,018 Views
'oc edit oauth' works
but it would be nice to understand why 'oc replace -f oauth-htpasswd.yaml' doesn't work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 2,006 Views
Hi there! I wonder if the metadata in the oauth.yaml file is what's causing the conflict. When I create that file with the oc get command, my file includes the creationTimestamp, generation, resource version, and UID fields. I was able to use the oc replace command with this file without experiencing the error, but I did that quickly after generating the YAML file. I found this KB article regarding a similar error with the oc apply command and it suggests that outdated metadata prevents the YAML file from being applied. https://access.redhat.com/solutions/6428441
Manager - Technical Training, OpenShift Platforms
Product & Technical Learning

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 722 Views
Yes, After removing CreationTimeStamp, geration, resource version & UUID field we can able to replave the file.