Bug 1375587 - CLI examples for creating and editing Dynagroup definitions are incorrect
Summary: CLI examples for creating and editing Dynagroup definitions are incorrect
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Documentation
Version: JON 3.3.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: ---
Assignee: mmurray
QA Contact: Vojta Prusa
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-13 13:50 UTC by dsteigne
Modified: 2019-12-16 06:44 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-16 03:43:41 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2620071 0 None None None 2016-09-13 13:50:53 UTC

Description dsteigne 2016-09-13 13:50:20 UTC
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:

Comment 5 Vojta Prusa 2017-02-06 15:36:29 UTC
Suggested changes match the stage doc.


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