Created attachment 1020084 [details] snapshot Description of problem: Version-Release number of selected component (if applicable): 5.4.0.0.23.20150423131011_69b48fd How reproducible: 100% Steps to Reproduce: 1.Navigate to Control->Import/Export 2.upload an invalid file 3. Actual results: "Error during 'Policy Import': undefined method `collect' for "test 'as da ad":String" displayed in UI. see attached screenshot. Expected results: Better flash message for invalid files. Additional info: evm.log [----] I, [2015-04-29T07:37:07.165582 #2391:e27ea8] INFO -- : MIQ(MiqServer.populate_queue_messages) Fetched 4 miq_queue rows for queue_name=generic, wcount=4, priority=200 [----] E, [2015-04-29T07:37:07.839105 #2642:123bea4] ERROR -- : MIQ(miq_policy_controller-export): Error during 'Policy Import': undefined method `collect' for "test 'as da ad":String
production.log [----] I, [2015-05-15T05:45:08.782255 #2350:11e5ea0] INFO -- : Started POST "/miq_policy/upload?dbtype=pp&type=import" for 127.0.0.1 at 2015-05-15 05:45:08 -0400 [----] I, [2015-05-15T05:45:08.792402 #2350:11e5ea0] INFO -- : Processing by MiqPolicyController#upload as HTML [----] I, [2015-05-15T05:45:08.792616 #2350:11e5ea0] INFO -- : Parameters: {"utf8"=>"✓", "authenticity_token"=>"/Xbh9nz268Gtkt1Q5C49msOIGlrNlbi9MUmu3lN7iz0=", "upload"=>{"file"=>#<ActionDispatch::Http::UploadedFile:0x000000119a7340 @original_filename="code", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"upload[file]\"; filename=\"code\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<Tempfile:/tmp/RackMultipart20150515-2350-1y8mfaz>>}, "commit"=>"Upload", "dbtype"=>"pp", "type"=>"import"} [----] I, [2015-05-15T05:45:08.842534 #2350:11e5ea0] INFO -- : Redirected to https://10.16.6.208/miq_policy/export?dbtype=pp&flash_error=true&flash_msg=Error+during+%27Policy+Import%27%3A+undefined+method+%60collect%27+for+%22%22%3AString [----] I, [2015-05-15T05:45:08.862349 #2350:11e5ea0] INFO -- : Completed 302 Found in 69.6ms (ActiveRecord: 1.2ms) [----] I, [2015-05-15T05:45:09.223942 #2350:11e5ea0] INFO -- : Started GET "/miq_policy/export?dbtype=pp&flash_error=true&flash_msg=Error+during+%27Policy+Import%27%3A+undefined+method+%60collect%27+for+%22%22%3AString" for 127.0.0.1 at 2015-05-15 05:45:09 -0400 [----] I, [2015-05-15T05:45:09.243060 #2350:11e5ea0] INFO -- : Processing by MiqPolicyController#export as HTML [----] I, [2015-05-15T05:45:09.243214 #2350:11e5ea0] INFO -- : Parameters: {"dbtype"=>"pp", "flash_error"=>"true", "flash_msg"=>"Error during 'Policy Import': undefined method `collect' for \"\":String"} [----] I, [2015-05-15T05:45:09.271442 #2350:11e5ea0] INFO -- : Rendered layouts/_flash_msg.html.haml (0.4ms)
Aziza - Can you provide the file you were testing with? The import should displays a flash error message "Error during 'Policy Import: Invalid YAML file". I validated that the error message is still showing for files I tested so it sounds like it is data related.
Greg, I have attached the file "test" used for testing. ~Aziza
Created attachment 1026576 [details] test file
New commit detected on manageiq/master: https://github.com/ManageIQ/manageiq/commit/ffc8bba4304a68ed3f7ce77d47f19f88cca33845 commit ffc8bba4304a68ed3f7ce77d47f19f88cca33845 Author: Erik Clarizio <eclarizi> AuthorDate: Tue Jun 23 08:03:33 2015 -0700 Commit: Erik Clarizio <eclarizi> CommitDate: Wed Jun 24 13:14:15 2015 -0700 Added a clearer message to an error when MiqPolicy import fails https://bugzilla.redhat.com/show_bug.cgi?id=1217002 vmdb/app/services/miq_policy_import_service.rb | 4 ++ .../services/miq_policy_import_service_spec.rb | 52 ++++++++++++++-------- 2 files changed, 37 insertions(+), 19 deletions(-)
Verified in 5.5.0.1-alpha1.20150915151429_2230bd4.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:2551