Bug 1121536

Summary: Template: PGError: when comments in "audit comment" exceeds 255 characters
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: WebUIAssignee: orabin
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.4CC: bbuckingham, cwelton, dcleal, jmontleo, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7020
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:10:51 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: 1120181    
Bug Blocks:    
Attachments:
Description Flags
PGError when comments in "audit comment" exceeds 255 chars none

Description Sachin Ghai 2014-07-21 07:36:51 UTC
Created attachment 919546 [details]
PGError when comments in "audit comment" exceeds 255 chars

Description of problem:
while creating a template, I filled the audit comments with more than 255 characters and UI raised following error.

Error
PGError: ERROR: value too long for type character varying(255) : INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "user_id", "user_type", "username", "version") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING "id"

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

How reproducible:
always

Steps to Reproduce:
1. while creating  a New template  fill the audit comments with more than 255 char.


Actual results:
PGError: ERROR: value too long for type character varying(255) : INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "user_id", "user_type", "username", "version") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING "id"


Expected results:
A proper validation error should be raised

Additional info:

production.log:

Processing by ConfigTemplatesController#create as */*
  Parameters: {"utf8"=>"✓", "search"=>"", "authenticity_token"=>"CLZgGQh3Z80gTOE6iG1eaDPvDAf4ISpF73pxHLoz0K4=", "config_template"=>{"name"=>"testtemp", "template"=>"test", "audit_comment"=>"ojJELjrEfavaKHSkSDTncoiqjwik12345yyteyNSBmqcshsFlNcAsGExwayeTXjFOQmXTuVNWCotNUBMbiJmDKtsPtLnXqYJSjTUyNIlSNAAucqVkKXGFrViwyGLTRnqqBaLuGskexxWkYHTLHdLFMEXTmRLiGZgvkTGGmqGEKpGwzEOerEAbVJWBLaKytzydTwJcIQOUdBxowqKqIUSJKZkYHwUzkPWGjQMkpdpadzBctjvjBMDmpfPYurKybz1", "snippet"=>"0", "template_kind_id"=>"1", "operatingsystem_ids"=>["", "", "", ""]}, "keybinding"=>"Default"}
Operation FAILED: PGError: ERROR:  value too long for type character varying(255)
: INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "user_id", "user_type", "username", "version") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING "id"
  Rendered common/500.html.erb (7.2ms)
Completed 500 Internal Server Error in 30ms (Views: 7.9ms | ActiveRecord: 2.7ms)

Comment 2 orabin 2014-08-05 15:38:54 UTC
see 1120199

Comment 4 sthirugn@redhat.com 2014-08-08 14:22:55 UTC
Failed. Got the same error again.

Version Tested:
GA Snap 4 - Satellite-6.0.4-RHEL-6-20140806.0

* apr-util-ldap-1.3.9-3.el6_0.1.x86_64
* candlepin-0.9.19-1.el6_5.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.9.19-1.el6_5.noarch
* candlepin-tomcat6-0.9.19-1.el6_5.noarch
* elasticsearch-0.90.10-4.el6sat.noarch
* foreman-1.6.0.38-1.el6sat.noarch
* foreman-compute-1.6.0.38-1.el6sat.noarch
* foreman-gce-1.6.0.38-1.el6sat.noarch
* foreman-libvirt-1.6.0.38-1.el6sat.noarch
* foreman-ovirt-1.6.0.38-1.el6sat.noarch
* foreman-postgresql-1.6.0.38-1.el6sat.noarch
* foreman-proxy-1.6.0.23-1.el6sat.noarch
* foreman-selinux-1.6.0.4-1.el6sat.noarch
* foreman-vmware-1.6.0.38-1.el6sat.noarch
* katello-1.5.0-28.el6sat.noarch
* katello-ca-1.0-1.noarch
* katello-certs-tools-1.5.6-1.el6sat.noarch
* katello-installer-0.0.57-1.el6sat.noarch
* openldap-2.4.23-34.el6_5.1.x86_64
* pulp-katello-0.3-3.el6sat.noarch
* pulp-nodes-common-2.4.0-0.30.beta.el6sat.noarch
* pulp-nodes-parent-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-puppet-tools-2.4.0-0.30.beta.el6sat.noarch
* pulp-rpm-plugins-2.4.0-0.30.beta.el6sat.noarch
* pulp-selinux-2.4.0-0.30.beta.el6sat.noarch
* pulp-server-2.4.0-0.30.beta.el6sat.noarch
* python-ldap-2.3.10-1.el6.x86_64
* ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
* ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch
* sssd-ldap-1.11.5.1-3.el6.x86_64

Comment 5 orabin 2014-08-10 09:05:48 UTC
Can you please run `foreman-rake db:migrate:status | grep 20140716140436` and check that the status is up?
The migration fixes the audit table and it looks like it was merged

Comment 6 sthirugn@redhat.com 2014-08-10 14:02:54 UTC
(In reply to orabin from comment #5)
> Can you please run `foreman-rake db:migrate:status | grep 20140716140436`
> and check that the status is up?
> The migration fixes the audit table and it looks like it was merged

# foreman-rake db:migrate:status | grep 20140716140436
   up     20140716140436  Change auditable name column to text

Comment 7 orabin 2014-08-11 14:17:14 UTC
Created redmine issue http://projects.theforeman.org/issues/7020 from this bug

Comment 8 orabin 2014-09-24 12:18:03 UTC
moving to POST because upstream bug http://projects.theforeman.org/issues/7020 has been closed

Comment 9 jcallaha 2014-10-10 19:27:54 UTC
*** This bug is verified in upstream.  This fix should eventually land in future downstream builds ***

Verified in RHEL6/RHEL7

* candlepin-0.9.32-1.el7.noarch
* candlepin-common-1.0.8-1.el7.noarch
* candlepin-selinux-0.9.32-1.el7.noarch
* candlepin-tomcat-0.9.32-1.el7.noarch
* elasticsearch-0.90.10-7.el7.noarch
* foreman-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-compute-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-gce-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-libvirt-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-ovirt-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-postgresql-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-proxy-1.7.0-0.develop.201410081229git52f0bac.el7.noarch
* foreman-release-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* foreman-selinux-1.7.0-0.develop.201409301113git2f345de.el7.noarch
* foreman-vmware-1.7.0-0.develop.201410091913git35b6fb9.el7.noarch
* katello-2.1.0-1.201410091752gitc9c45c1.el7.noarch
* katello-certs-tools-2.0.1-1.el7.noarch
* katello-default-ca-1.0-1.noarch
* katello-installer-2.1.0-1.201410021645git304e036.el7.noarch
* katello-repos-2.1.1-1.el7.noarch
* katello-server-ca-1.0-1.noarch
* openldap-2.4.39-3.el7.x86_64
* pulp-docker-plugins-0.2.1-0.2.beta.el7.noarch
* pulp-katello-0.3-3.el7.noarch
* pulp-nodes-common-2.5.0-0.7.beta.el7.noarch
* pulp-nodes-parent-2.5.0-0.7.beta.el7.noarch
* pulp-puppet-plugins-2.5.0-0.7.beta.el7.noarch
* pulp-puppet-tools-2.5.0-0.7.beta.el7.noarch
* pulp-rpm-plugins-2.5.0-0.7.beta.el7.noarch
* pulp-selinux-2.5.0-0.7.beta.el7.noarch
* pulp-server-2.5.0-0.7.beta.el7.noarch
* python-ldap-2.4.6-6.el7.x86_64
* ruby193-rubygem-ldap_fluff-0.3.1-1.el7.noarch
* ruby193-rubygem-net-ldap-0.3.1-2.el7.noarch
* ruby193-rubygem-runcible-1.2.0-1.el7.noarch
* rubygem-hammer_cli-0.1.3-1.201409240954gitf3c47c7.el7.noarch
* rubygem-hammer_cli_foreman-0.1.3-1.201409191432gitc38f9c8.el7.noarch
* rubygem-hammer_cli_foreman_tasks-0.0.3-2.201409091410git163c264.git.0.988ca80.el7.noarch
* rubygem-hammer_cli_import-0.10.4-1.el7.noarch
* rubygem-hammer_cli_katello-0.0.6-1.201410091836gitf7ca881.git.0.4d3b99d.el7.noarch

Comment 10 Bryan Kearney 2015-08-11 13:36:57 UTC
This bug is slated to be released with Satellite 6.1.

Comment 11 errata-xmlrpc 2015-08-12 05:10:51 UTC
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:1592