Get ANY/ALL-setting from SmartGroups (before v8.5) in blcli/jython

Version 1
    Share:|

    Have you ever wondered how to get this "any/all-flag" from a SmartGroup-definition in your blcli/jython-scripts?

     

    For setting(!) this value we have "SmartGroup.setSignatureMatchAll". But the corresponding function starting with "get..." is absent.

     

    The right one is - ConditionBean.getOperator - which is misleading/counter intuitive at first as getOperator is used in the conditions themselves also, e.g. "agent_status" - "is_one_of" - "agent_is_alive", where "is_one_of" is the operator.

     

    If this ConditionBean.getOperator returns AND, we have the ALL-selection and if getOperator returns OR, we have - you may have guessed it - the ANY-selection of the SmartGroup definition.

    It get's clearer in v8.5 where indeed this any/all is replace by AND or OR between the conditions.

     

    Here is the blcli-example:

    blcli_execute SmartServerGroup groupNameToDBKey "/Workspace/TestSmartGroupAll"

    blcli_execute Utility storeTargetObject SmartGroup1

    blcli_execute SmartGroup createSmartGroupBean NAMED_OBJECT=SmartGroup1

    blcli_execute Utility setTargetObject

    blcli_execute SmartGroupBean getSmartGroupCondition

    blcli_execute Utility setTargetObject

    blcli_execute ConditionBean getOperator

     

    The Jython one is much simpler:

    smartGroup = jli.run(["Group", "getGroupByQualifiedName", 5007, \

                      "/Workspace/TestSmartGroupAll"]).returnValue

    smartGroupCondition = smartGroup.getSmartGroupCondition()

    smartGroupOperator = smartGroupCondition.getOperator()

    print "ANY/ALL: %s" % smartGroupOperator.toString()

    For infos how to get the jli-object see BL-documentation https://docs.bmc.com/docs/display/public/bsa83/Installing+and+configuring+Jython(refer to 7.)

     

    This document was generated from the following discussion: Get ANY/ALL-setting from SmartGroups (before v8.5) in blcli/jython