Defining a rule in the Rule Editor
This topic explains how to define a rule in the Rule Editor. It includes the following sections:
About compliance rules
Compliance rules give you great flexibility when analyzing component parts or properties. You can test for the presence or absence of template parts, or you can evaluate characteristics of component properties, such as equivalence, inequality, membership in a list, or inclusion in a range of values. If necessary, comparisons can be case sensitive. Compliance rules based on parts can examine a wide range of part attributes. For example, a compliance rule can examine an application's installation date, a registry key's permissions, or a file's content.
The Rule Definition tab lets you create or edit an individual compliance rule for association with the component template. Compliance rules may vary in complexity, and each rule can contain any number of the following types of conditions:
- basic conditions that use various comparison operators to
- check for the existence or number of occurrences of a configuration object (a cardinality condition)
- compare configuration object properties or component properties with defined values or with other such properties
- conditional constructs for organizing conditions in an if-then-else logical sequence
loops for iterative analysis of conditions
The Rule Definition tab of the Compliance Rule Editor also lets you test whether particular components satisfy the compliance rule that you have defined through the Compliance Rule Editor. This procedure does not actually run the compliance rule on the components. To perform that procedure see Creating-Compliance-Jobs or Compliance-results.
To create or edit a rule
- On the Rule Definitiontab, do one of the following:
- To add the first condition to an empty rule, click the New Condition
icon for a basic condition, or click the drop-down arrow beside this icon and select from the full range of available condition types.
- Basic Condition for a basic condition
- If... Then... End, Elseif, or Else for a conditional construct or block within it
- Foreach Loop, Count Loop, or Exists Loop for the loop of your choice
- To add a new condition to a rule that already contains other conditions, select the line above where you want the condition to appear before using the New Condition icon.
- To edit an existing condition, double-click the line that you want to edit. The text within the selected line is displayed in editable fields.
- To copy conditions from another location, select the relevant lines in the current rule or in a different rule, and click either Copy selected conditions
or Cut selected conditions
. Then place your cursor in the line above where you want to paste the conditions and click Paste conditions
.
- To add the first condition to an empty rule, click the New Condition
- In the displayed fields, provide the necessary input (such as operands and operators), as discussed separately for each type of condition in the following sections:
- Repeat the previous steps for all of the conditions that you want to include in the rule.
- To modify the logical organization of multiple conditions, you can use any of the following additional options:
- Set logical operators between conditions (either AND or OR) through the last drop-down box at the end of each line. Within one block of conditions, all conditions on the same level must be connected using the same logical operator.
- To rearrange the order of conditions in the rule, select the relevant lines and click either Move up selected conditions
or Move down selected conditions
.
- Use the Not icon to add the NOT logical operator to a selected line. This logically reverses the TRUE/FALSE outcome of the full expression.
- Add parentheses to a selected line.
To delete a condition, select the relevant line and click Delete Selected Condition
.
- Click Save
.
- To test the rule, see Testing-a-compliance-rule.