Bug 1331682

Summary: [userinterface_public_546]Should not prompt 'already exists' when resource metadata.name is not given
Product: OKD Reporter: Xingxing Xia <xxia>
Component: Management ConsoleAssignee: Jakub Hadvig <jhadvig>
Status: CLOSED CURRENTRELEASE QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, mmccomas, trankin
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-19 13:55:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Xingxing Xia 2016-04-29 09:06:08 UTC
Description of problem:
In From File tab of create page, upload a resource file with json format (but metadata.name is not given), then Create, it pops up a small window wrongly saying:
pod '' already exists
Do you want to replace with the new content?

Version-Release number of selected component (if applicable):
fork_ami_openshift3_userinterface_public_546_222

How reproducible:
Always

Steps to Reproduce:
1. oc login and create project
2. Prepare resource file with json format in local PC
$ wget https://raw.githubusercontent.com/openshift/origin/master/examples/hello-openshift/hello-pod.json

Then remove the "name" line under metadata from the file.

3. Login to Openshift web console, click Add to project --> From File --> Browse, select the json file and Create
4. oc create -f hello-pod.json


Actual results:
3. It pops up small window saying:
pod '' already exists
Do you want to replace with the new content?
                        Replace     Cancel

4. It prompts (it is expected):
The Pod "" is invalid.
metadata.name: Required value: name or generateName is required

Expected results:
3. Should prompt the resource is invalid, as same as CLI in step 4

Additional info:
The result should be same as missing other required field:
E.g. remove only spec.containers[0].name, then repeat above steps, both CLI and web console can show correct message:
Pod "hello-openshift" is invalid: spec.containers[0].name: Required value

Comment 1 Jakub Hadvig 2016-05-04 07:44:25 UTC
The PR has been merged, please use the master for testing.

Comment 2 Yadan Pei 2016-05-04 09:23:37 UTC
Checked against devenv-rhel7_4087

1. oc login and create project
2. Prepare resource file with json format in local PC
$ wget https://raw.githubusercontent.com/openshift/origin/master/examples/hello-openshift/hello-pod.json

Then remove the "name" line under metadata from the file.

3. Login to Openshift web console, click Add to project --> From File --> Browse, select the json file and Create

pod is not created, and give error message "Failed to process the resource.
Resource name is missing in metadata field"

Comment 3 Yadan Pei 2016-05-04 09:40:34 UTC
For scenario described in this bug, it works well now, move to VERIFIED