Bug 1205496

Summary: Database statement error encountered [miq_policy/action_edit] while adding policy action
Product: Red Hat CloudForms Management Engine Reporter: Nandini Chandra <nachandr>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED ERRATA QA Contact: Nandini Chandra <nachandr>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4.0CC: hkataria, jhardy, mpovolny, obarenbo, rananda
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-16 12:54:47 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:

Description Nandini Chandra 2015-03-25 04:08:30 UTC
Description of problem:
------------------------
I ran into this issue while adding a custom policy action.

Error text:

Database statement error encountered [miq_policy/action_edit]


Snippet from production.log
---------------------------
[----] I, [2015-03-24T23:56:27.217887 #20208:ddfea0]  INFO -- : Started POST "/miq_policy/action_edit?button=add" for 127.0.0.1 at 2015-03-24 23:56:27 -0400
[----] I, [2015-03-24T23:56:27.222286 #20208:ddfea0]  INFO -- : Processing by MiqPolicyController#action_edit as JS
[----] I, [2015-03-24T23:56:27.222390 #20208:ddfea0]  INFO -- :   Parameters: {"button"=>"add"}
[----] I, [2015-03-24T23:56:28.453849 #20208:ddfea0]  INFO -- : CONNECTION RETRY: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter retry #0.
[----] F, [2015-03-24T23:56:28.885314 #20208:ddfea0] FATAL -- : Error caught: [ActiveRecord::StatementInvalid] Database statement error encountered
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1327:in `async_exec'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1327:in `block in exec_no_cache'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1265:in `with_auto_reconnect'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1326:in `exec_no_cache'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:736:in `block in exec_query'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:287:in `block in log'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:282:in `log'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:735:in `exec_query'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/relation/calculations.rb:184:in `pluck'
/var/www/miq/vmdb/app/controllers/miq_policy_controller/miq_actions.rb:441:in `action_get_info'
/var/www/miq/vmdb/app/controllers/miq_policy_controller/miq_actions.rb:47:in `action_edit'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/abstract_controller/base.rb:167:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/action_controller/metal/rendering.rb:10:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/callbacks.rb:557:in `_run__3174775895718838758__process_action__4319359673823330028__callbacks'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/abstract_controller/callbacks.rb:17:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/action_controller/metal/rescue.rb:29:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/notifications.rb:123:in `block in instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activesupport/lib/active_support/notifications.rb:123:in `instrument'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/activerecord/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/abstract_controller/base.rb:121:in `process'
/opt/rh/cfme-gemset/bundler/gems/rails-8f014fba21f9/actionpack/lib/abstract_controller/rendering.rb:45:in `process


Version-Release number of selected component (if applicable):
-----------------------
5.4.0.0.13

How reproducible:
----------------
Always


Steps to Reproduce:
------------------
1.Control->Explorer->Actions
2.Configuration->Add a new action

I've observed that the first action can be added without any issues,but subsequent attempts to add more actions result in this error.

Actual results:
----------------
Database statement error while adding a custom policy action.


Expected results:
----------------
There should be no errors while adding a custom policy action.


Additional info:
----------------

Comment 3 CFME Bot 2015-04-07 21:15:45 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/485835c5e0bf66123a6cccc519e0f6b65fd029b6

commit 485835c5e0bf66123a6cccc519e0f6b65fd029b6
Author:     Martin Hradil <mhradil>
AuthorDate: Wed Mar 25 18:23:41 2015 +0000
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Apr 7 11:26:36 2015 +0000

    Fix adding policy action of type remove or inherit tags
    
    Classification has custom find_by_name that looks up tag by name and classification by tag id
    That got broken by the rails4 rewrite, this commit restores the same logic but on the caller side
    
    Also the label for remove_tags should not say Inherit Tags
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1205496

 vmdb/app/controllers/miq_policy_controller/miq_actions.rb |  5 +++--
 vmdb/app/models/classification.rb                         | 10 +++++++---
 vmdb/app/views/miq_policy/_action_details.html.haml       |  2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

Comment 5 Ramesh A 2015-04-27 09:23:54 UTC
Good to go.  Verified and working fine in 5.4.0.0.23.20150423131011_69b48fd

Comment 7 errata-xmlrpc 2015-06-16 12:54:47 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://rhn.redhat.com/errata/RHBA-2015-1100.html