Bug #7038
closedPGError when hostgroup name exceeds 245 characters
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1129202
Description of problem:
I was trying to validate the hostgroup form and found that if we enter more than 245 chars in 'Name' field of hostgroup, It raises PGError:
--
Processing by HostgroupsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"8YKMIr6xgzHyJpwH0LC3VbHzoQSwOk+VOG2XoH0FhiE=", "hostgroup"=>{"name"=>"SSTQOPqJiwFllLmBmDRZoWsarPNwQhcEypKFfTozMHnmPtTqkgebNCMSMxBdywiWmEbraUdMnjnSIvdKFeioxAgvPTutMitBTTRExegkJRTzxlAHDIasfjwEAabNhzvevKiTDbYXbaqVFArexnApWfavHFpPSoDothzHwKVZOYrqGtSicQxHHrBoLcuNwrANGduNLMCurtGjlrkweKZNVqDaxmOPfvHBQjwapFpfbhLxGPksMwxGn1", "environment_id"=>"", "content_source_id"=>"", "puppet_ca_proxy_id"=>"", "puppet_proxy_id"=>"", "domain_id"=>"", "realm_id"=>"", "architecture_id"=>"", "root_pass"=>"[FILTERED]", "location_ids"=>[""], "organization_ids"=>[""]}, "kt_environment_id"=>"", "kt_activation_keys"=>"", "commit"=>"Submit", "id"=>"16-sstqopqjiwflllmbmdrzowsarpnwqhceypkfftozmhnmpttqkgebncmsmxbdywiwmebraudmnjnsivdkfeioxagvptutmitbttrexegkjrtzxlahdiasfjweaabnhzvevkitdbyxbaqvfarexnapwfavhfppsodothzhwkvzoyrqgtsicqxhhrbolcunwrangdunlmcurtgjlrkwekznvqdaxmopfvhbqjwapfpfbhlxgpksmwxgn"}
Operation FAILED: PGError: ERROR: value too long for type character varying(255)
: UPDATE "lookup_values" SET "match" = 'hostgroup=SSTQOPqJiwFllLmBmDRZoWsarPNwQhcEypKFfTozMHnmPtTqkgebNCMSMxBdywiWmEbraUdMnjnSIvdKFeioxAgvPTutMitBTTRExegkJRTzxlAHDIasfjwEAabNhzvevKiTDbYXbaqVFArexnApWfavHFpPSoDothzHwKVZOYrqGtSicQxHHrBoLcuNwrANGduNLMCurtGjlrkweKZNVqDaxmOPfvHBQjwapFpfbhLxGPksMwxGn1' WHERE "lookup_values"."match" = 'hostgroup=SSTQOPqJiwFllLmBmDRZoWsarPNwQhcEypKFfTozMHnmPtTqkgebNCMSMxBdywiWmEbraUdMnjnSIvdKFeioxAgvPTutMitBTTRExegkJRTzxlAHDIasfjwEAabNhzvevKiTDbYXbaqVFArexnApWfavHFpPSoDothzHwKVZOYrqGtSicQxHHrBoLcuNwrANGduNLMCurtGjlrkweKZNVqDaxmOPfvHBQjwapFpfbhLxGPksMwxGn'
Rendered common/500.html.erb within layouts/application (5.7ms)
Rendered layouts/base.html.erb (1.4ms)
Completed 500 Internal Server Error in 67ms (Views: 9.7ms | ActiveRecord: 8.1ms)
---
Version-Release number of selected component (if applicable):
sat6 GA snap4
How reproducible:
always
Steps to Reproduce:
1. create hostgroup with more than 245 char in name
2.
3.
Actual results:
Operation FAILED: PGError: ERROR: value too long for type character varying(255)
Expected results:
User should be allowed to enter 255 char in name field and if it exceeds 255 char then UI should throw a clean validation error instead of PGError
Additional info: