What about Group.getName?
thanks for your input - unfortunately it returns a "ClassCastException" as "Group" is not a "SJobDeviceGroup" :-(
Is this new in v8.5? Could not find it in the "BLCLI enhancements" list and in my 8.3SP2 test environment there are no such methods (of course even no unreleased ;-) )
looks like it.
1 of 1 people found this helpful
Recently I found another way to get closer to the Job's target groups - as I'm still on v8.2/v8.3. The only drawback is: you need Jython to get further. Here is how it starts (of course the script has to make a connection to BL first ;-) ):
"runCmd" is just a small function to call the jli.run(...)-command and returns the "returnObject.returnValue" from this.
jobGroupIdRoot = runCmd(["JobGroup", "groupNameToId", "/"]) jobList = runCmd(["Job", "findAllByGroupId", jobGroupIdRoot, "true"]) for job in jobList: # the nice thing that Jython (somehow?) is Java let me use the # object-reference "job" deviceGroupList = job.getSJobDeviceGroupList() # this print statment just shows the way I proceeded # it returns the type "java.util.ArrayList" - thus I can iterate # through it print "DeviceGroupList.type: %s" % type(deviceGroupList) for deviceGroup in deviceGroupList: # here again I got some type; in this case # "com.bladelogic.om.infra.model.base.SJobDeviceGroup" # which - unfortunately - is no namespace in blcli and so I had # to try a bit to get the "getDBKey" method which is not # documented anywhere (but obviously it is there ;-) ) print "DeviceGroup.type: %s" % type(deviceGroup) # the next one e.g. (getName()) isn't available - just for reference # deviceGroupName = deviceGroup.getName() deviceGroupId = deviceGroup.getGroupId() # as you can see, it's a "normal" ID ;-) print "Group ID: %i" % deviceGroupId deviceGroup = runCmd(["Group", "findById", deviceGroupId]) # and finally here is my group name print "DeviceGroupName: %s" % deviceGroup.getName()
Starting with my "deviceGroup"-object I can use all methods (at least all that in "pure blcli" would work on the context) from the DeviceGroup-namespace.