Bug 1267428 - oc patch cannot use yaml format
Summary: oc patch cannot use yaml format
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: David Eads
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-30 02:05 UTC by Xingxing Xia
Modified: 2016-01-04 09:13 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-23 21:14:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xingxing Xia 2015-09-30 02:05:25 UTC
Description of problem:
oc patch cannot use yaml format

Version-Release number of selected component (if applicable):
oc v1.0.6-202-ga195624
openshift v1.0.6-202-ga195624
kubernetes v1.1.0-alpha.0-1605-g44c91b1


How reproducible:
Always

Steps to Reproduce:
1. oc login
2. Create a project and create applications
$ oc new-project newprj
$ oc new-app -f origin/examples/sample-app/application-template-stibuild.json
3. Check dc field before oc patch:
1> $ oc get dc
2> $ oc get dc/database -t '{{ .spec.replicas }}' | grep '.'
4. Apply oc patch. For comparison, use json first:
1> $ oc patch dc database -p '{"spec": {"replicas": 2}}'
2> $ oc get dc/database -t '{{ .spec.replicas }}' | grep '.'
5. Use yaml
1> $ oc patch dc/database -p '
spec:
  replicas: 3
'
2> $ oc get dc/database -t '{{ .spec.replicas }}' | grep '.'

Actual results:
5
2>
Error from server: invalid character 's' looking for beginning of value

Expected results:
4
1> Outputs:
"database" patched
2> Outputs:
2

5
1> Outputs:
"database" patched
2> Outpus:
3

Additional info:
`oc help patch' says:
-p, --patch='': The patch to be applied to the resource JSON file
But it also says:
JSON and YAML formats are accepted.

A link of YAML example: https://github.com/openshift/origin/blob/9185d680f64acd9d24f1846ef8a0472f5e0fcd01/docs/cli.md#oc-patch

Comment 1 David Eads 2015-09-30 16:00:13 UTC
See https://github.com/kubernetes/kubernetes/pull/14831

Comment 2 David Eads 2015-10-02 13:07:48 UTC
picked downstream into https://github.com/openshift/origin/pull/4910

Comment 3 Xingxing Xia 2015-10-09 08:35:27 UTC
Checked with the latest code (oc/openshift version v1.0.6-466-g72df0dc), and the issue has been fixed


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