Bug 1257853 - "--resource-version" doesn't work for `oc annotate`
Summary: "--resource-version" doesn't work for `oc annotate`
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Juan Vallejo
QA Contact: Yan Du
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-28 09:12 UTC by Wei Sun
Modified: 2016-09-19 13:52 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-19 13:52:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Wei Sun 2015-08-28 09:12:49 UTC
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 07:44:39 UTC
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 21:30:46 UTC
Related PR: https://github.com/openshift/origin/pull/9917

Comment 3 Xingxing Xia 2016-07-26 02:58:00 UTC
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-26 03:00:12 UTC
# 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.