Bug 1773266 - [Bug] `oc set resources` returns "error: info:" when no changes are applied
Summary: [Bug] `oc set resources` returns "error: info:" when no changes are applied
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.4.0
Assignee: Sally
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks: 1818763
TreeView+ depends on / blocked
 
Reported: 2019-11-17 04:01 UTC by Priyanka Kanthale
Modified: 2020-05-04 11:16 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1818763 (view as bug list)
Environment:
Last Closed: 2020-05-04 11:15:36 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:0581 0 None None None 2020-05-04 11:16:14 UTC

Description Priyanka Kanthale 2019-11-17 04:01:53 UTC
Description of problem:

The exit code returned by the `oc set resources` when changes are not applied to an OpenShift object appears erroneous. Message return text starts with "error: info: ..." which is rather confusing followed by an exit status of 1.


Version-Release number of selected component (if applicable):

$ oc version
oc v3.11.141
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://xxxxxxxxxx:443
openshift v3.11.141
kubernetes v1.11.0+d4cacc0


How reproducible:

Steps to Reproduce:

Setting resources to unique values:
---------------------------------------------------------
$ oc set resources dc/abc --limits=cpu=0,memory=100 --requests=cpu=0,memory=0
deploymentconfig.apps.openshift.io/abc resource requirements updated
$ echo $?
0
---------------------------------------------------------

Re-run previously execute command a 2nd time:
---------------------------------------------------------
$ oc set resources dc/abc --limits=cpu=0,memory=100 --requests=cpu=0,memory=0
error: info: {apps.openshift.io v1 deploymentconfigs} "abc" was not changed
$ echo $?
1


Actual results:

error: info: {apps.openshift.io v1 deploymentconfigs} "abc" was not changed

Expected results:

 The`oc` client code to be consistent with the exit codes when no changes are performed on a given OpenShift object.

Comment 1 Maciej Szulik 2019-11-19 20:01:20 UTC
Sally pls double check this works fine in the latest release and change target to 4.3 if it doesn't work still and you'll need to clone back if this requires backports. 
If 3.11 only is affected fix there.

Comment 2 Sally 2019-11-20 14:06:10 UTC
I see this is affecting latest release as well, will get a fix for this for 4.3. Changing target to 4.3

Comment 4 Sally 2019-11-20 15:34:46 UTC
Maciej, this is from upstream.  The output is consistent with kubectl (https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/set/set_resources.go#L268-#L272) Should I submit an upstream PR or is there any reason you know of that this should be an error not just INFO?

Comment 6 Sally 2019-11-21 00:56:55 UTC
I've opened an upstream PR for this: https://github.com/kubernetes/kubernetes/pull/85490

Comment 11 Yuxiang Zhu 2019-11-21 12:56:45 UTC
Re: https://coreos.slack.com/archives/CEKNRGF25/p1574339500253300

If the bug fix is not merged or not ready for QA, it should be changed back to ASSIGNED, not MODIFIED.
According to the OpenShift Bugzilla Process (https://mojo.redhat.com/docs/DOC-1093603).

Comment 14 Maciej Szulik 2019-11-25 07:36:41 UTC
This is going to merge to k8s 1.18 so ocp 4.4 is the soonest we'll get it.

Comment 15 Maciej Szulik 2020-02-24 13:52:17 UTC
This was brought with k8s 1.17, moving to modified.

Comment 18 zhou ying 2020-02-25 05:21:10 UTC
Can't reproduce the issue now: 
[yinzhou@localhost ~]$ oc version -o yaml
clientVersion:
  buildDate: "2020-02-21T10:22:28Z"
  compiler: gc
  gitCommit: 9353dc4631653a8de08d4b2508f1820a1fd0f15e
  gitTreeState: clean
  gitVersion: v4.4.0
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64


[yinzhou@localhost ~]$ oc  set resources dc/hello-openshift  --limits=cpu=0,memory=100 --requests=cpu=0,memory=0
deploymentconfig.apps.openshift.io/hello-openshift resource requirements updated
[yinzhou@localhost ~]$ oc  set resources dc/hello-openshift  --limits=cpu=0,memory=100 --requests=cpu=0,memory=0
[yinzhou@localhost ~]$ echo $?
0

Comment 20 errata-xmlrpc 2020-05-04 11:15:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0581


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