Bug 1257853 - "--resource-version" doesn't work for `oc annotate`
"--resource-version" doesn't work for `oc annotate`
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Juan Vallejo
Yan Du
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-28 05:12 EDT by Wei Sun
Modified: 2016-09-19 09:52 EDT (History)
5 users (show)

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


Attachments (Terms of Use)

  None (edit)
Description Wei Sun 2015-08-28 05:12:49 EDT
Description of problem:
Updated the annotation for one pod with --resource-version the command is `oc annotate pods nodejs-ex-1-mh39j description='my frontend running nginx' --resource-version=947` , but always got the prompt "error: --resource-version may only be used with a single resource".
But in my command,I was updating the annotation on one resource.

Version-Release number of selected component (if applicable):
$ oc version 
oc v1.0.5-49-gf7b6723
kubernetes v1.1.0-alpha.0-1605-g44c91b1

How reproducible:
Always

Steps to Reproduce:
1.Get the resourceVersion of the pod
$oc get pods nodejs-ex-1-mh39j -o yaml |grep resource
    kubernetes.io/created-by: '{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"wsuntest","name":"nodejs-ex-1","uid":"8f251832-4d5a-11e5-861c-22000baa04f0","apiVersion":"v1","resourceVersion":"809"}}'
  resourceVersion: "947"
    resources: {}

2.Update the annotation on one pod with --resource-version
$ oc annotate pods nodejs-ex-1-mh39j description='my frontend running nginx' --resource-version=947

Actual results:
2.$ oc annotate pods nodejs-ex-1-mh39j description='my frontend running nginx' --resource-version=947
error: --resource-version may only be used with a single resource
see 'oc annotate -h' for help.

Expected results:
2.Should work well when I update the annotation on one pod with --resource-version.

Additional info:
Run `oc annotate -h`,could see:
// Update pod 'foo' only if the resource is unchanged from version 1.
  $ oc annotate pods foo description='my frontend running nginx' --resource-version=1

--resource-version='': If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.
Comment 1 Xingxing Xia 2016-05-26 03:44:39 EDT
FYI, though the bug is a problem, it is found that the Type/Name format works:
$ oc annotate pod --resource-version=1820 database-1-fi08h description='my anno'
error: --resource-version may only be used with a single resource
See 'oc annotate -h' for help and examples.
$ oc annotate pod/database-1-fi08h --resource-version=1820  description='my anno'
pod "database-1-fi08h" annotated
$ oc get pod database-1-fi08h -o yaml | grep description
    description: my anno
Comment 2 Juan Vallejo 2016-07-18 17:30:46 EDT
Related PR: https://github.com/openshift/origin/pull/9917
Comment 3 Xingxing Xia 2016-07-25 22:58:00 EDT
Verified in:
# openshift version
openshift v1.3.0-alpha.2+0369166
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git

# oc annotate pod/hello-openshift --resource-version=1530 desc='my anno'
pod "hello-openshift" annotated

Issue is fixed.
Comment 4 Xingxing Xia 2016-07-25 23:00:12 EDT
# oc annotate pod hello-openshift --resource-version=1662 description='my anno'
pod "hello-openshift" annotated

Both formats "Type/Name" and "Type Name" work in oc annotate.

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