Bug 1139576 - creating/updating activation-key with long integer value under content-host limit raises PGError: integer out of range
Summary: creating/updating activation-key with long integer value under content-host l...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: WebUI
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: Unspecified
Assignee: Christine Fouant
QA Contact: Sachin Ghai
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-09 08:52 UTC by Sachin Ghai
Modified: 2017-02-23 20:58 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:16:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
complete logs from production.log (46.51 KB, text/plain)
2014-09-09 08:52 UTC, Sachin Ghai
no flags Details
PGError: ERROR: integer out of range : On updating content-host limit to long integer value (46.36 KB, application/octet-stream)
2014-09-09 08:55 UTC, Sachin Ghai
no flags Details
error thrown twice and with unknown range, is is expected range ? (23.71 KB, image/png)
2015-02-13 08:39 UTC, Sachin Ghai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 8220 0 None None None 2016-04-22 16:27:18 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

Description Sachin Ghai 2014-09-09 08:52:02 UTC
Created attachment 935588 [details]
complete logs from production.log

Description of problem:
I defined a long integer value under content-host limit field, while creating activation-key and nothing happens on save. The form neither submitted nor UI raised any error. But production.log filled with a long traceback.
Similar issue on update, but on update, UI raises error.

production.log on create:

---
Processing by Katello::Api::V2::ActivationKeysController#create as JSON
  Parameters: {"unlimited_content_hosts"=>false, "name"=>"test_key", "max_content_hosts"=>1.1111111111111111e+42, "environment"=>{"id"=>244, "name"=>"Library", "selected"=>true}, "content_view_id"=>255, "organization_id"=>"209", "api_version"=>"v2", "activation_key"=>{"name"=>"test_key", "organization_id"=>"209", "max_content_hosts"=>1.1111111111111111e+42, "content_view_id"=>255, "unlimited_content_hosts"=>false}}
PGError: ERROR:  value "1111111111111111126596901884379344347856896" is out of range for type integer
: INSERT INTO "katello_activation_keys" ("content_view_id", "cp_id", "created_at", "description", "environment_id", "max_content_hosts", "name", "organization_id", "release_version", "unlimited_content_hosts", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id" (ActiveRecord::StatementInvalid)
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1171:in `get_last_result'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1171:in `exec_cache'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:665:in `block in exec_query'
---

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

How reproducible:
always

Steps to Reproduce:
1. define long integer value (11111111111111) under content-host limit field while creating/updating a activation-key
2.
3.

Actual results:
PGError: ERROR:  value "1111111111111111126596901884379344347856896" is out of range for type integer

Expected results:
UI should throw proper validation error or Content-Host limit field should be highlighted with red border.

Additional info:

Comment 2 Sachin Ghai 2014-09-09 08:55:39 UTC
Created attachment 935589 [details]
PGError: ERROR: integer out of range : On updating content-host limit to long integer value

Comment 3 Christine Fouant 2014-10-30 15:36:27 UTC
Created redmine issue http://projects.theforeman.org/issues/8220 from this bug

Comment 4 Bryan Kearney 2014-11-06 17:04:09 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/8220 has been closed
-------------
Christine Fouant
Applied in changeset commit:katello|d2bcce043c3057700d92e1f0e2b0389f4fb8539c.

Comment 7 Sachin Ghai 2015-02-13 08:37:22 UTC
Verified with:
Satellite-6.1.0-RHEL-6-20150210.0
Sat6.1.0 beta snap2


On creating actvation-key with below content-host limit:
"1111111111111111126596901884379344347856896", error thrown on UI:

must be less than 2147483648

This error appears twice. Also with long traceback in production.log. Is this message expected ?

Processing by Katello::Api::V2::ActivationKeysController#create as JSON
  Parameters: {"unlimited_content_hosts"=>false, "max_content_hosts"=>1.1111111111111111e+42, "name"=>"ak1", "environment"=>{"id"=>5, "name"=>"Library", "label"=>"Library", "description"=>nil, "organization"=>{"name"=>"testorg", "label"=>"testorg", "id"=>3}, "created_at"=>"2015-02-13T01:13:49Z", "updated_at"=>"2015-02-13T01:13:49Z", "library"=>true, "prior"=>nil, "successor"=>nil, "counts"=>{"content_hosts"=>0, "content_views"=>0, "packages"=>0, "puppet_modules"=>0, "errata"=>{"security"=>0, "bugfix"=>0, "enhancement"=>0, "total"=>0}, "yum_repositories"=>2, "docker_repositories"=>0, "products"=>2}, "permissions"=>{"view_lifecycle_environments"=>true, "edit_lifecycle_environments"=>true, "destroy_lifecycle_environments"=>false, "promote_or_remove_content_views_to_environments"=>true}, "selected"=>true}, "content_view_id"=>3, "organization_id"=>"3", "api_version"=>"v2", "activation_key"=>{"name"=>"ak1", "organization_id"=>"3", "max_content_hosts"=>1.1111111111111111e+42, "content_view_id"=>3, "unlimited_content_hosts"=>false}}
Validation failed: Max content hosts must be less than 2147483648 (ActiveRecord::RecordInvalid)
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:56:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `block in save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0/app/lib/katello/lazy_accessor.rb:102:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0/app/lib/actions/katello/activation_key/create.rb:19:in `plan'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.7.3/lib/dynflow/action.rb:398:in `block (3 levels) in execute_plan'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.7.3/lib/dynflow/middleware/stack.rb:26:in `call'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.7.3/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/rh/ruby193/root/usr/share/gems/gems/dynflow-0.7.3/lib/dynflow/middleware.rb:16:in `pass'

Comment 8 Sachin Ghai 2015-02-13 08:39:05 UTC
Created attachment 991252 [details]
error thrown twice and with unknown range, is is expected range ?

Comment 9 Bryan Kearney 2015-02-18 23:05:11 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/8220 has been closed
-------------
Christine Fouant
Applied in changeset commit:katello|d2bcce043c3057700d92e1f0e2b0389f4fb8539c.

Comment 11 jcallaha 2015-02-26 18:27:36 UTC
Verified in Satellite 6.1.0 snap 4 compose 2.

Version tested:
RHEL 66
RHEL 71

Comment 12 Bryan Kearney 2015-08-11 13:24:00 UTC
This bug is slated to be released with Satellite 6.1.

Comment 13 errata-xmlrpc 2015-08-12 05:16:10 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


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