Description of problem:
Searching for a report with a name that contains a '>' like 'VMs with Free Space > 50% by Department' fails with a '400 - Bad Request'
REST API Request:
----------------------
http://my_cf_appliance/api/reports?filter[]=name='VMs%20with%20Free%20Space%20%3E%2050%25%20by%20Department'&limit=1&expand=resources
from production.log:
-----------------------
[----] I, [2016-08-02T16:33:19.605148 #29533:9b7e90] INFO -- : Started GET "/api/reports?filter[]=name='VMs%20with%20Free%20Space%20%3E%2050%25%20by%20Department'&limit=1&expand=resources" for 127.0.0.1 at 2016-08-02 16:33:19 -0400
[----] I, [2016-08-02T16:33:19.634327 #29533:9b7e90] INFO -- : Processing by ApiController#show as JSON
[----] I, [2016-08-02T16:33:19.634415 #29533:9b7e90] INFO -- : Parameters: {"filter"=>["name='VMs with Free Space > 50% by Department'"], "limit"=>"1", "expand"=>"resources", "suffix"=>"reports"}
[----] I, [2016-08-02T16:33:20.668993 #29533:9b7e90] INFO -- : CONNECTION RETRY: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter retry #0.
[----] I, [2016-08-02T16:33:20.694171 #29533:9b7e90] INFO -- : Completed 400 Bad Request in 1059.6ms (Views: 0.5ms | ActiveRecord: 1045.8ms)
from evm.log:
-----------------
[----] E, [2016-08-02T16:44:48.233809 #29533:9b7e90] ERROR -- : MIQ(abstract_adapter) Name: [], Message: [PGError: ERROR: column miq_reports.name='VMs with Free Space does not exist
LINE 1: ...0000 AND "miq_reports".id <= 10999999999999) AND ("miq_repor...
^
...: SELECT COUNT(*) FROM "miq_reports" WHERE ("miq_reports".id >= 10000000000000 AND "miq_reports".id <= 10999999999999) AND ("miq_reports"."name='VMs with Free Space" > '50% by Department''')...]
Version-Release number of selected component (if applicable):
cfme-5.4.4.2-1.el6cf.x86_64
How reproducible:
Always
Steps to Reproduce:
HTTP GET request for a report:
https://my_cf_appliance/api/reports?filter[]=name=VMs with Free Space > 50% by Department
Actual results:
400 - Bad Request
Expected results:
HTTP api get request should process the special characters and give report details.
I do not see this bug on following versions on CloudForms:
5.6.1.2.20160810181333_8ba817b
5.7.2.1.20170406142927_0a1ad0e
5.8.0.17.20170525183055_6317a22
Please close this bug
I've created a PR here that addresses the issue in the description here: https://github.com/ManageIQ/manageiq/pull/15534
However, you have a distinct separate issue in the example you provided. '%' acts as a wildcard, so may give you unexpected results (though I'd expect your query to still work). We should probably create a new issue for this. Currently there's no way for us to tell if you meant a literal percent sign of wildcard (we assume wildcard in all cases).