Bug 1267454 - It's better to show additional prompt when 'oc patch' non-existing fields of resource
It's better to show additional prompt when 'oc patch' non-existing fields of ...
Status: NEW
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: David Eads
Wei Sun
Depends On:
  Show dependency treegraph
Reported: 2015-09-30 01:56 EDT by Xingxing Xia
Modified: 2017-06-30 06:52 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Xingxing Xia 2015-09-30 01:56:15 EDT
Description of problem:
When apply 'oc patch' to update resource with fields that are non-existing, i.e. not defined by the resource specification, the result should give prompt, telling us the patch doesn't take effect.

Version-Release number of selected component (if applicable):
openshift v1.0.6-266-gcfbe4fb
oc v1.0.6-266-gcfbe4fb
kubernetes v1.1.0-alpha.1-653-g86b4e77

How reproducible:

Steps to Reproduce:
1.Launch openshift
2.Login, create a project and create applications
3.Use oc patch to update non-existing fields to resource
1 > Check dc resource
$ oc get dc
2> $ oc patch dc database -p '{"nothisfield": {"replicas": 2}}'
3> $ oc get dc/database -t '{{ .nothisfield }}' | grep '.'

Actual results:
"database" patched
3> In fact, we can see it is not patched
<no value>

Expected results:
2> We suggest the output give prompt, like:
patch canceled, no changes made
<no value>

Additional info:
If do not give prompt, then operation mistake may be omitted. e.g. I intend to patch dc, but mistakenly apply it to bc:
oc patch bc ruby-sample-build -p '{"spec": {"replicas": 2}}'
But the result is it is patched
Comment 1 David Eads 2015-09-30 12:06:38 EDT
This is a more general problem with CLI mutations not validating their changes.  Create, edit, and update have this same problem when specifying fields that don't exist.

I suspect that this will remain as a limitation for some time.  Adding Jordan and Clayton so they have a chance to disagree.
Comment 2 Xingxing Xia 2017-01-04 22:07:12 EST
https://bugzilla.redhat.com/show_bug.cgi?id=1409225#c3 Singular "annotation" in bug 1409925 is kind of not-existing field which causes UX problem and makes user confusion because of the prompt "... patched"
Comment 3 Xingxing Xia 2017-06-30 06:52:11 EDT
Again, occurrences of similar confusion appear in bug 1466671 and bug 1466664

Note You need to log in before you can comment on or make changes to this bug.