Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1355703 - Better to make messy error messages tidy when multiple fields are invalid
Summary: Better to make messy error messages tidy when multiple fields are invalid
Keywords:
Status: ASSIGNED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Greg Blomquist
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-12 09:55 UTC by Xingxing Xia
Modified: 2019-03-30 07:03 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)

Description Xingxing Xia 2016-07-12 09:55:32 UTC
Description of problem:
Better to make messy error messages tidy when multiple fields are invalid. See below

Version-Release number of selected component (if applicable):
oc v1.3.0-alpha.2-1021-g11997a9
kubernetes v1.3.0-alpha.3-599-g2746284

How reproducible:
Always

Steps to Reproduce:
1. Example 1 of messy error
1> $ oc run hello --image=openshift/hello-openshift 
deploymentconfig "hello" created
2> $ oc set probe dc/hello --liveness --get-url="www.baidu.com:80"
error: DeploymentConfig "hello" is invalid: [spec.template.spec.containers[0].livenessProbe.httpGet.port: Invalid value: "": must be an IANA_SVC_NAME (at most 15 characters, matching regex [a-z0-9]([a-z0-9-]*[a-z0-9])*, it must contain at least one letter [a-z], and hyphens cannot be adjacent to other hyphens): e.g. "http", spec.template.spec.containers[0].livenessProbe.httpGet.scheme: Invalid value: "WWW.BAIDU.COM": must be one of [HTTP HTTPS]]

2. Example 2 of messy error
1> $ cat pod_simple_no_scc.yaml
apiVersion: v1
kind: Pod
metadata:
  name: hello-openshift
spec:
  containers:
  - image: openshift/hello-openshift
    name: hello-openshift
    ports:
    - containerPort: 8080
      protocol: TCP
    securityContext:
      privileged: true
  hostIPC: true

2> $ oc create -f pod_simple_no_scc.yaml
Error from server: error when creating "pod_simple_no_scc.yaml": pods "hello-openshift" is forbidden: unable to validate against any security context constraint: [spec.securityContext.hostIPC: Invalid value: true: Host IPC is not allowed to be used spec.containers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed spec.containers[0].securityContext.hostIPC: Invalid value: true: Host IPC is not allowed to be used]

3. Example of tidy messages
1> $ cat svc-test.yaml 
apiVersion: v1
kind: Service
metadata:
  name: svc-test
spec:
  ports:
  - targetPort: 8080
    port: 8080
    name: web1
    protocol: TCP
  selector:
    name: database

2> $ oc create -f svc-test.yaml

3> $ oc patch svc svc-test -p '
spec:
  ports:
  - port: 8080
    name: web1_abc
    protocol: notgood
'
The Service "svc-test" is invalid.

* spec.ports[0].name: Invalid value: "web1_abc": must be a DNS label (at most 63 characters, matching regex [a-z0-9]([-a-z0-9]*[a-z0-9])?): e.g. "my-name"
* spec.ports[0].protocol: Unsupported value: "notgood": supported values: TCP, UDP

Actual results:
In steps 1 and 2, the output complains multiple invalid fields, but the messy messages for the multiple invalid fields are crowed in one big [ ].
While in step 3, it has separate paragraphs for the message for each invalid field.

Expected results:
Steps 1 and 2 should be make messy error messages tidy, like step 3

Additional info:

Comment 1 Juan Vallejo 2016-09-16 20:05:35 UTC
Related PR: https://github.com/openshift/origin/pull/10965

Comment 2 Xingxing Xia 2016-11-01 08:21:01 UTC
Tested with oc/openshift v1.4.0-alpha.0+f69b28e-909.
For step 1, now actual result is:
$ oc set probe dc/hello --liveness --get-url="www.baidu.com:80"
error: DeploymentConfig "hello" is invalid

* spec.template.spec.containers[0].livenessProbe.httpGet.port: Invalid value: "": must contain only alpha-numeric characters (a-z, 0-9), and hyphens (-)
* spec.template.spec.containers[0].livenessProbe.httpGet.port: Invalid value: "": must contain at least one letter (a-z)
* spec.template.spec.containers[0].livenessProbe.httpGet.scheme: Unsupported value: "WWW.BAIDU.COM": supported values: HTTP, HTTPS

Though it is not messy now, it has 2 messages of livenessProbe.httpGet.port, the 2 seem to conflict. In fact, I tried:
$ oc set probe dc/hello --liveness --get-url="http://www.baidu.com:80"
deploymentconfig "hello" updated
$ oc set probe dc/hello --liveness --get-url="http://www.baidu.com:web"
deploymentconfig "hello" updated

So the 1st message is correct, the 2nd message 'must contain at least one letter (a-z)' is not correct.


For step 2, the messages are still the same mess.

Comment 3 Juan Vallejo 2016-11-01 18:32:47 UTC
Related PR: https://github.com/openshift/origin/pull/11710

Comment 4 Juan Vallejo 2016-11-04 19:48:01 UTC
Fixed in https://github.com/kubernetes/kubernetes/pull/35990, will be picked up in a future rebase with kubernetes

Comment 6 Xingxing Xia 2017-07-05 10:17:49 UTC
QE is checking many Modified bugs that if they're verifiable.
Checked again in latest OCP v3.6.133, got same result as comment 2

Comment 7 Xingxing Xia 2017-07-06 14:51:50 UTC
(In reply to Xingxing Xia from comment #6)
> Checked again in latest OCP v3.6.133, got same result as comment 2
Sorry the statement was not precise.
Paste the result in OCP v3.6.133 to make preciseness:
$ oc version
oc v3.6.133
kubernetes v1.6.1+5115d708d7

For step 1, https://github.com/kubernetes/kubernetes/pull/35990 was picked in kubernetes v1.6.1+5115d708d7. The message of the second line is fixed to "at least one letter or number", which is correct now:
$ oc set probe dc/hello --liveness --get-url="www.baidu.com:80"
error: DeploymentConfig "hello" is invalid

* spec.template.spec.containers[0].livenessProbe.httpGet.port: Invalid value: "": must contain only alpha-numeric characters (a-z, 0-9), and hyphens (-)
* spec.template.spec.containers[0].livenessProbe.httpGet.port: Invalid value: "": must contain at least one letter or number (a-z, 0-9)
* spec.template.spec.containers[0].livenessProbe.httpGet.scheme: Unsupported value: "WWW.BAIDU.COM": supported values: HTTP, HTTPS
...

So the message issue in step 1 looks good now.

But the message of step 2 is still messy:
$ oc create -f pod_simple_no_scc.yaml
Error from server (Forbidden): error when creating "pod_simple_no_scc.yaml": pods "hello-openshift" is forbidden: unable to validate against any security context constraint: [provider restricted: .spec.securityContext.hostIPC: Invalid value: true: Host IPC is not allowed to be used provider restricted: .spec.containers[0].securityContext.privileged: Invalid value: true: Privileged containers are not allowed provider restricted: .spec.containers[0].securityContext.hostIPC: Invalid value: true: Host IPC is not allowed to be used]

Seems all PRs so far given in the bug are not for this mess, so moving back to Assigned. Thanks


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