Red Hat Bugzilla – Full Text Bug Listing
|Summary:||subject argument is removed from SubjectManager.findSubjectsByCriteria() which doesn't allow to use the method for specific (logged) in user|
|Product:||[Other] RHQ Project||Reporter:||Armine Hovsepyan <ahovsepy>|
|Component:||CLI||Assignee:||RHQ Project Maintainer <rhq-maint>|
|Status:||CLOSED CURRENTRELEASE||QA Contact:||Mike Foley <mfoley>|
|Version:||4.5||CC:||hrupp, lkrejci, mfoley|
|Target Release:||RHQ 4.10|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2014-04-23 08:29:42 EDT||Type:||Bug|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
Description Armine Hovsepyan 2012-07-19 11:45:07 EDT
Comment 1 Lukas Krejci 2012-07-19 12:07:18 EDT
This is not specific to the SubjectManager.findSubjectByCriteria method. When we are generating our scripting API, we generated new methods from the remote API methods by removing the first "Subject" parameter from them and then at runtime supplating that argument with the currently logged in user. I.e. SubjectManager.findSubjectByCriteria(criteria) would be translated automagically into SubjectManager.findSubjectByCriteria(subject, criteria) where "subject" is the currently logged in user in the CLI. Now in the past we actually kept the original methods (i.e. the ones with Subject as their first parameter) in the scripting API and only added the new "simplified" methods. We then explicitly *hid* the original methods from code completion so that the user didn't have an idea about their existence. After the refactoring brought forth to support the script modularity, the original methods are no longer available on the scripting APIs and the code completion doesn't have to "hide" anything. But for the script to be able to act as two users simultaneously is potentially useful feature - as Armine showed. I am not fond of bringing the original methods back and adding the "special handling" back to the code completion - that is (and always has been) just an ugly hack. So my proposal is (after getting this idea from Jay) to introduce a new property on the "rhq" implicit object called "subjectOverride". When this property would be null, the currently logged in user would be used to do the remote calls. If the property would not be null, the subject assigned to this property would be used to do the remote calls regardless of the current logged in user for all the remote API calls. So in the above example one would: cli> rhq.login("rhqadmin", password) cli> .... create test role and testuser with some permissions cli> var testUserSubject = SubjectManager.login("testuser", password) cli> rhq.subjectOverride = testUserSubject cli> SubjectManager.findSubjectsByCriteria(crit) this would call the last line with the testUserSubject as the subject.
Comment 2 Mike Foley 2012-07-20 13:47:41 EDT
targetting for RH 4.5. existing scripts need to continue to work after the fix. based on lukas' comments it is not related to JON.
Comment 3 Mike Foley 2013-11-21 13:08:24 EST
This bug blocks about 15 automated CLI tests which have needed to be disabled because of this bug. so because these tests are not running, the automation which is not running could be masking additional issues which are not currently being detected. increasing the priority and targetting for an RHQ release
Comment 4 Mike Foley 2013-11-21 13:26:21 EST
is this a breaking change for existing CLI scripts that customers may have in JON 3.2?
Comment 5 Lukas Krejci 2013-11-21 13:29:55 EST
The automation scripts were exploiting an undocumented behavior of the previous implementation of the CLI remoting. This has been chagend to strictly conform to the documented behavior and the undocumented methods are no longer available.
Comment 6 Heiko W. Rupp 2013-12-09 04:57:24 EST
After Lukas' last comment I think this is solved and could be closed?
Comment 7 Armine Hovsepyan 2013-12-09 08:15:46 EST
@Libor Zoubek added updated existing tests to run those without a need of subject param. Taking into account comment from Lukas, we can close this bug as "won't fix" or "not a bug".
Comment 8 Heiko W. Rupp 2014-04-23 08:29:42 EDT
Bulk closing of 4.10 issues. If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.