Bug 694660

Summary: AS5 Plugin: unset does not work for certain properties on Datasources and other types of Profile Service backed Resources
Product: [Other] RHQ Project Reporter: Charles Crouch <ccrouch>
Component: PluginsAssignee: Charles Crouch <ccrouch>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: ccrouch, hbrock, hrupp, loleary, mfoley
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 726130 (view as bug list) Environment:
Last Closed: 2013-09-03 17:00:05 UTC Type: ---
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:    
Bug Blocks: 725852, 585306, 678340, 705059, 715334    

Description Charles Crouch 2011-04-07 21:18:04 UTC
The problem is detailed in 

https://issues.jboss.org/browse/EMBJOPR-350
https://issues.jboss.org/browse/JBPAPP-5285

There could potentially be multiple problem here:
1) Handling of unset option in Embedded Console UI
2) Handling of unset option in JON UI
3) Handling of unset option in jboss-as5 plugin

First of all lets make sure that 2) and 3) are addressed in rhq master from there we can see if any changes are required in Embedded Jopr.

Comment 1 Ian Springer 2011-04-14 16:35:49 UTC
This is an issue with the as5 plugin and the profile service. Properties that were unset would eventually revert back to their previous values. [master 10dfbb1] improves things - now properties that are unset will revert to the default value defined by the profile service MO, if any. If no default is defined, its value will remain unset (null). Ideally, all properties that were unset would remain unset (null), but it currently doesn't look like this is possible due to limitations on the JBAS side.

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=10dfbb14b4e20f42e49acce301d4162b16dee9a2

Comment 2 Mike Foley 2011-05-02 17:19:42 UTC
verified setting/unsetting properties in jboss plugin.  RHQ 4.0 release candidate #2.

Comment 3 Larry O'Leary 2011-05-03 19:43:21 UTC
We need to get this addressed and tested in Embedded Jopr now. I originally attempted to use the updated AS5 plug-in from master with Embedded Jopr but the problem still existed. Which means that an additional fix is needed for Embedded JOPR or the AS5 plug-in, with the fix applied, didn't work in my test case.

Comment 4 Ian Springer 2011-05-09 14:16:02 UTC
Larry,

What is your test case and exactly what behavior do you see? 

As described in my comment, my "fix" improves the situation a bit but doesn't completely fix it. Properties that you unset will still end up reverting back to some internal default value in some cases. This is due to how things work on the AS side, and I don't see any way to work around it.

Comment 5 Larry O'Leary 2011-05-09 16:40:01 UTC
See the steps listed in the description of the upstream bug - https://issues.jboss.org/browse/JBPAPP-5285. 

Basically, the behavior is the exact same as it was pre-patch. When I test in RHQ, your fix works as expected. I understand you say "partial fix" but I think really this is the expected behavior. The goal from a user's perspective is to "unset" it (reverting it to its default). In RHQ, I see this. When I set the SQL to something and later change my mind, I see it gets unset in the AS instance or returns to its default.

But, using your patch in admin-console, there is no change. If I set the SQL, I can see the SQL set on the datasource in AS. If I unset the SQL (expecting it to revert to its default) I still see the SQL that was originally set after applying the "unset".

So, this either means that we need to do something more for admin-console or I was very naive in thinking that I could apply your patch to admin-console for testing.

Comment 6 Ian Springer 2011-05-09 21:22:49 UTC
No, I don't think you were being naive. The code for updating configs in the as5 plugin is the same code, whether the plugin is inside an RHQ Agent or inside the managed AS instance. The only difference is that when inside an Agent, the profile service is looked up from local JNDI, but when inside the managed AS instance, the profile service is looked up from remote JNDI over a JNP connection. It's possible there's a bug in the profile service where, when it was looked up locally, setting managed properties to null does not work correctly. In any case, I can't think what else we can do differently on the RHQ plugin side.

Comment 7 Ian Springer 2011-05-13 15:08:23 UTC
Argh, actually this is still broken for certain properties (I think ones that do not have default in the corresponding profile service managed properties). For example, the Check Valid Connection SQL and Query Timeout properties on Datasources. Such properties revert back to their previous values after being unset...

Comment 8 Ian Springer 2011-05-13 20:50:18 UTC
I have tried all of the following methods of setting a ManagedProperty to null in the jboss-as-5 plugin, to no avail:

1) managedProperty.getValue().setValue(null)
2) managedProperty.setValue(null)
3) managedPropertyMap.remove(managedProperty.getName())
4) managedProperty.setRemoved(true)

In all cases, for the problematic properties (e.g. Query Timeout), after setting the property to null and updating the corresponding ManagedComponent, the JBAS side revert the property back to the value it had just prior to setting it to null.

I don't know what else to try. I think this needs to be fixed on the AS/EAP side.

Comment 9 Larry O'Leary 2011-05-14 02:03:52 UTC
Can you provide me the class names that you are invoking and/or a sample showing how we are invoking this? I originally suspected it was on the EAP side when the ticket was opened but what made me think it wasn't was the configuration  parser. It seemed that the property got set to null (unset) but after parser, the property was somehow removed because the parser seems to ask EAP for the base configuration which does not include the property because in EAP these properties are undefined to begin with. However, if you are invoking the managed component in EAP directly and setting one of its properties to null and it is having to affect, then it has to be an EAP problem.

Comment 10 Ian Springer 2011-05-16 17:10:28 UTC
This ended up being several bugs in the as5 plugin after all. [master 4e72ffc] should put this one to bed.

Comment 11 Larry O'Leary 2011-05-16 19:44:40 UTC
I tested the original use case of setting Check Valid Connection SQL and then attempting to unset it using admin-console along with the proposed fixes from this BZ and the JIRA and everything tested okay. The unset worked and it is truly unset from a ProfileService perspective. 

Now we will just need to await the results from QA.

Comment 12 Mike Foley 2011-05-24 19:22:18 UTC
verified.  did view, edit, save operations on AS5 datasource.

Comment 14 Heiko W. Rupp 2013-09-03 17:00:05 UTC
Bulk closing of old issues that are in VERIFIED state.