Bug 767328 - cannot edit a template with more than 1 definition attached
Summary: cannot edit a template with more than 1 definition attached
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: drift
Version: 4.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: RHQ 4.3.0
Assignee: John Sanda
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: jon30-sprint10, rhq43-sprint10 785968
TreeView+ depends on / blocked
 
Reported: 2011-12-13 19:53 UTC by John Mazzitelli
Modified: 2013-08-31 10:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 785968 (view as bug list)
Environment:
Last Closed: 2013-08-31 10:12:53 UTC
Embargoed:


Attachments (Terms of Use)

Description John Mazzitelli 2011-12-13 19:53:43 UTC
1) Create a drift template.
2) Go to resource #1 and create a drift definition from that template
3) Go to resource #2 and create a drift definition from that template
   (I'm not sure, but I think if you just create two definitions from the same template, even on the same resource, the same bug shows up, but I used two resources)
4) Edit the drift template (change the enabled flag, or the interval) and save

boom.

Comment 1 John Mazzitelli 2011-12-13 19:54:35 UTC
git commit 9b42a3a83b51bdce587b6841774e373b25343e5a doesn't fix this bug, but it fixes another bug that shows up when basedir is null (which is the real problem - basedir should not be null). See the diff of that commit for details.

Comment 2 John Sanda 2011-12-13 22:27:21 UTC
Template updates are propagated to attached definitions. This means that DriftManagerBean.updateDriftDefinition is invoked for each attached definition. Note that this all occurs within the same transaction. updateDriftDefinition sends a request to the agent to add/update the definition. To avoid hibernate proxy issues on the agent, we flush and clear the persistence context before calling the agent. When updateDriftDefinition is called for the second definition, the proxy for DriftDefinition.configuration has been cleared and we wind up with the following exception,

Caused by: java.lang.NullPointerException
        at org.rhq.enterprise.server.drift.DriftManagerBean.validateDriftDefinition(DriftManagerBean.java:804)
        at org.rhq.enterprise.server.drift.DriftManagerBean.updateDriftDefinition(DriftManagerBean.java:720)

The short term, temporary solution is to reload each definition before we call updateDriftDefinition.

master commit hash: ee66d10c7c3dee5a9c9bd102d9ea2db347e0e769

I was talking with mazz and jshaughn about a longer term solution that involves sending requests to agents out of band using quartz. The solution ought to be generic as it would have applicability in other places outside of drift code.

Comment 3 Sunil Kondkar 2011-12-14 11:58:45 UTC
Verified on master build#833 (Version: 4.3.0-SNAPSHOT Build Number: ee66d10)

Imported two EAP5.x servers and created a drift template on JBossAS5 server. Created drift definitions from that template on both the EAP servers.
   
Verified that editing and saving the drift template does not throw any exception and the attached drift definitions are updated successfully.

Also verified by creating two definitions from the same template on the same resource and updating the template.

Comment 4 Charles Crouch 2012-01-31 03:13:37 UTC
Setting the Target Release version correctly to match where the issue was tested.

Comment 5 Mike Foley 2012-02-09 20:54:37 UTC
verified JON 3.01 RC3

Comment 6 Heiko W. Rupp 2013-08-31 10:12:53 UTC
Bulk close of old bugs in VERIFIED state.


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