Bug 1267428 - oc patch cannot use yaml format
oc patch cannot use yaml format
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: David Eads
Wei Sun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-29 22:05 EDT by Xingxing Xia
Modified: 2016-01-04 04:13 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-23 16:14:22 EST
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 Xingxing Xia 2015-09-29 22:05:25 EDT
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 12:00:13 EDT
See https://github.com/kubernetes/kubernetes/pull/14831
Comment 2 David Eads 2015-10-02 09:07:48 EDT
picked downstream into https://github.com/openshift/origin/pull/4910
Comment 3 Xingxing Xia 2015-10-09 04:35:27 EDT
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.