Bug 808220

Summary: with CLI, programmatically creating a group and putting 1 member in it creates a mixed group instead of a compatible group
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: CLIAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4CC: hrupp, jshaughn
Target Milestone: ---   
Target Release: RHQ 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-01 10:12:59 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:
Attachments:
Description Flags
CLI script reproducing the issue none

Description Mike Foley 2012-03-29 20:52:50 UTC
Created attachment 573795 [details]
CLI script reproducing the issue

Description of problem:  with CLI, programmatically creating a group and putting 1 member in it creates a mixed group instead of a compatible group


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


How reproducible:
100%

Steps to Reproduce:
1. ./rhq-cli.sh -u rhqadmin -p rhqadmin -f attachment1 [details].js
2. verify thru the UI that a mixed group was created and that it contains the platform  
3. verify through SQL (SELECT NAME, RECURSIVE, CATEGORY FROM RHQ_RESOURCE_GROUP;)  that the group is a non-recursive mixed group
  
Actual results:  non-recursive mixed group


Expected results:  the expectation is that this creates a compatible group.  this is required for 2 reasons:  1) CLI Automation, 2) CLI scripts a customer may write to do bundle deployments programmatically thru the CLI.


Additional info:

Comment 1 Mike Foley 2012-03-29 20:53:34 UTC
error message


[mfoley@foleymonsterbox1 bin]$ ./rhq-cli.sh -u rhqadmin -p rhqadmin -f /home/mfoley/automation2/automatjon/jon//clitest/resources/js-files/bundlemanager.js 
Remote server version is: 4.4.0-SNAPSHOT (969ed45)
Login successful
Exception in thread "main" org.rhq.enterprise.client.script.CLIScriptException: javax.script.ScriptException: sun.org.mozilla.javascript.WrappedException: Wrapped javax.ejb.EJBException: [Warning] java.lang.IllegalArgumentException: Invalid groupId [10013]. It must be an existing compatible group whose members must be able to support bundle deployments (<Unknown source>#51) in <Unknown source> at line number 51
	at org.rhq.enterprise.client.commands.ScriptCommand.executeScriptFile(ScriptCommand.java:298)
	at org.rhq.enterprise.client.commands.ScriptCommand.execute(ScriptCommand.java:108)
	at org.rhq.enterprise.client.ClientMain$StartupConfiguration.process(ClientMain.java:142)
	at org.rhq.enterprise.client.ClientMain.main(ClientMain.java:162)
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.WrappedException: Wrapped javax.ejb.EJBException: [Warning] java.lang.IllegalArgumentException: Invalid groupId [10013]. It must be an existing compatible group whose members must be able to support bundle deployments (<Unknown source>#51) in <Unknown source> at line number 51

Comment 2 Jay Shaughnessy 2012-03-30 21:13:58 UTC
master commit daec885053b6679e4bb6a80c7c8dc86c75868a4b

The following ResourceGroupManager API methods now recalculate group type
when they are done:

- addResourceToGroup()
- removeResourcesFromGroup()
- updateGroup() // when using the updateMembers option

Comment 3 Heiko W. Rupp 2013-09-01 10:12:59 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.