Bug 1037878 - CSV system import validation
Summary: CSV system import validation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: general
Version: develop
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 0.15.3
Assignee: Amit Saha
QA Contact: tools-bugs
URL:
Whiteboard:
: 1021738 (view as bug list)
Depends On:
Blocks: 1021738
TreeView+ depends on / blocked
 
Reported: 2013-12-04 01:25 UTC by Amit Saha
Modified: 2018-02-06 00:41 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-03 04:51:40 UTC
Embargoed:


Attachments (Terms of Use)
keyvalue (8.82 KB, text/plain)
2014-01-28 02:16 UTC, xjia
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1021737 0 unspecified CLOSED Adding a system with no data leads to 500 Internal server error 2021-02-22 00:41:40 UTC

Internal Links: 1021737

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


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