Condition - createPropertyConditionCLI


Condition - createPropertyConditionCLI

Description :

This command creates a condition based on one property. It returns a condition DBKey that you can use with commands such as GenericObject : getBlObjectsByPropertyCondition and GenericObject : getResultCountByPropertyCondition .

If you want to retrieve objects based on more than one property, you can use the createGroup and addCondition commands in the smart group namespaces: SmartComponentGroup, SmartDepotGroup, SmartJobGroup, SmartServerGroup, SmartTemplateGroup.

You can use one of the following values for the operator argument:

Boolean operators

  • "NOT"
  • "AND"
  • "OR"

String operators

  • "starts with"
  • "does not start with"
  • "ends with"
  • "does not end with"
  • "contains"
  • "is substring of"
  • "does not contain"
  • "is not substring of"
  • "matches"
  • "does not match"
  • "equals (case sensitive)"
  • "starts with (case sensitive)"
  • "does not start with (case sensitive)"
  • "ends with (case sensitive)"
  • "does not end with (case sensitive)"
  • "contains (case sensitive)"
  • "is substring of (case sensitive)"
  • "does not contain (case sensitive)"
  • "is not substring of (case sensitive)"

Integer operators

  • "less than"
  • "less than or equal to"
  • "greater than"
  • "greater than or equal to"
  • "between"
  • "less than"
  • "less than or equal to"
  • "greater than"
  • "greater than or equal to"
  • "between"

Date operators

  • "before"
  • "after"
  • "between"
  • "older than days"
  • "newer than days"

For more information about formatting the RHS property value for the various types of LHS properties and operators, see Formats for specifying property values in conditions in the BMC Server Automation online documentation.

Return type : com.bladelogic.om.infra.model.base.keys.SConditionKey

Command Input :

Variable Name

Variable Type

Description

fullyQualifiedName

String

Fully qualified name of the model object.

propName

String

Property name to be used in the smart group condition.

operator

String

Operator string to be used in the smart group condition.

propValue

String

Property value to be used in the smart group condition.

Example

The following example shows how to create a condition that describes servers whose DESCRIPTION property is not set to null.

Script

CONDITION_DBKEY=`blcli Condition createPropertyConditionCLI "Class://SystemObject/Server" "DESCRIPTION" "does not equal" ""`

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Server Automation Command Line Interface 8.7