Bug 1037878

Summary: CSV system import validation
Product: [Retired] Beaker Reporter: Amit Saha <asaha>
Component: generalAssignee: Amit Saha <asaha>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: developCC: aigao, asaha, dcallagh, ebaak, llim, qwan, rmancy, xjia
Target Milestone: 0.15.3   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-03 04:51:40 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1021738    
Attachments:
Description Flags
keyvalue none

Description Amit Saha 2013-12-04 01:25:25 UTC
Description of problem:

Currently there is no validation in the CSV importer being performed to check against empty and invalid FQDNs (for system import) and perhaps others as well. Thus it is possible to import gibberish.


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:

Validation similar to the Web UI should be performed.  

Additional info:

Comment 2 Nick Coghlan 2013-12-06 01:26:05 UTC
This suggests we're currently doing the data validation in the wrong place (in the view code rather than the model code). Rather than duplicating the existing validation logic in the CSV import, we should move the validation lower in the stack and use the bkr.server.flask_util.convert_internal_exceptions helper to translate from ValueError back to the appropriate HTTP error code.

Comment 3 Amit Saha 2013-12-16 03:32:11 UTC
On gerrit: http://gerrit.beaker-project.org/#/c/2617/2

Comment 5 Nick Coghlan 2013-12-20 05:21:04 UTC
*** Bug 1021738 has been marked as a duplicate of this bug. ***

Comment 6 xjia 2013-12-20 05:48:19 UTC
Verify:
1. invalid FQDNs
Import CSV file:
csv_type,fqdn,deleted,lender,location,mac_address,memory,model,serial,vendor,arch,lab_controller,owner,secret,status,type,cc
system,,False,,Nay,00:21:9B:4F:DB:68,7742,OptiPlex 780,,Red Hat,"i386,x86_64",beaker,beaker,False,Broken,Machine,

Error Log
Error importing system on line 2: System must have an associated FQDN

2. invalid Lab-controller.
Import CSV file:
csv_type,fqdn,deleted,lender,location,mac_address,memory,model,serial,vendor,arch,lab_controller,owner,secret,status,type,cc
system,hss,False,,Nay,,7742,OptiPlex 780,,Red Hat,"i386,x86_64",beaker,beaker,False,Broken,Machine,

Error Log
hss: Invalid lab controller beaker

Comment 10 Nick Coghlan 2014-01-28 02:12:00 UTC
To help me assess the significance of this: can a new system still be uploaded using a CSV that has *no* system column at all?

Comment 11 xjia 2014-01-28 02:16:24 UTC
Created attachment 856341 [details]
keyvalue

Fresh install beaker environment, and upload this file

Comment 12 xjia 2014-01-28 02:52:00 UTC
Well, seems #comment 8 is a different bug, so open a bug for it.https://bugzilla.redhat.com/show_bug.cgi?id=1058549 

And move this bug to "VERIFIED"

Comment 13 Nick Coghlan 2014-02-03 04:51:40 UTC
This change is included in the Beaker 0.15.3 maintenance release:

http://beaker-project.org/docs/whats-new/release-0.15.html#beaker-0-15-3