Bug 877073

Summary: Failed plugin installation should not install plugin JAR in database
Product: [Other] RHQ Project Reporter: John Sanda <jsanda>
Component: Core Server, PluginsAssignee: RHQ Project Maintainer <rhq-maint>
Status: NEW --- QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.5CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=857189
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description John Sanda 2012-11-15 11:20:24 EST
Description of problem:
During plugin installation, persisting the plugin jar file and persisting the plugin meta data are done in two, separate transactions. The jar file is persisted followed by the meta data. If an error occurs while installing the meta data that transaction is rolled back, but the newer jar file is still in the database.

A common example of how this might happen is deploying a plugin where a field in the descriptor excedes its max length. This is somewhat related to bug 857189 in that it is another case where we need support for application level rollback.

If it a completely new plugin, then we could delete the row from the rhq_plugin table and log an appropriate message. If it is an upgrade situation, then we should copy the original plugin from the database, and if an error occurs while persisting meta data, then we can re-insert the original plugin and log an appropriate message.

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

How reproducible:

Steps to Reproduce:
1. Modify the name of a resource type in a plugin descriptor so that the length exceeds 100 characters.
2. Install the plugin.
3. You should see error messages in the server log about a database constraint violoation.
4. Query the rhq_plugin table and you will find the plugin there, but it should not be.
Actual results:

Expected results:

Additional info: