Hide Forgot
Document URL: https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Operations_Network/3.3/html/Writing_JON_Command-Line_Scripts/sect-Resources_and_Groups.html#Creating_and_Editing_Dynagroups Section Number and Name: 12.4.3. Creating and Editing Dynagroups Describe the issue: On the create script setExpression replaces the existing, so will only use the last one, it should be something more like: // create the new dynagroup var dynaGroupDef = new GroupDefinition("Linux Group"); var expr = "resource.type.name=Linux" + "\n" + "resource.type.category=Platform" dynaGroupDef.setExpression(expr); var def = GroupDefinitionManager.createGroupDefinition(dynaGroupDef); // calculate the group members GroupDefinitionManager.calculateGroupMembership(def.getId()); For the editing script, the get is incorrect and errors and the setExpression needs to be the desired full expression not just the additional, for example: // search for the dynagroup criteria = new ResourceGroupDefinitionCriteria() criteria.addFilterName("Linux Group"); var orig = GroupDefinitionManager.findGroupDefinitionsByCriteria(criteria) // get the dynagroup entry var originalGroupDef = orig.get(0) // add the new expression var expr = "resource.type.name=Linux" + "\n" + "resource.type.category=Platform" + "\n" + "resource.availability=UP" originalGroupDef.setExpression(expr); var def = GroupDefinitionManager.updateGroupDefinition(originalGroupDef); // calculate the group members GroupDefinitionManager.calculateGroupMembership(def.getId()); Suggestions for improvement: Additional information:
Suggested changes match the stage doc.
Fix live on customer portal: https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Operations_Network/3.3/html/Writing_JON_Command-Line_Scripts/sect-Resources_and_Groups.html#Creating_and_Editing_Dynagroups Marking bug closed.