This documentation supports the 21.05 (12.2) version of BMC Discovery.To view an earlier version of the product, select the version from the Product version menu.

Pattern Configuration


It is sometimes useful to permit the end-user to modify certain characteristics of a pattern, such as whether to enable features that might be costly, or to change a set of default paths or package names. This is enabled with pattern configuration blocks. Pattern configuration is new in TPL 1.2.

Warning

Changes in the pattern configuration block revision number may reset the pattern configuration changes to the default values.

If you install a Technology Knowledge Update (TKU) which contains an update to a pattern configuration block that requires its major revision number to be incremented, any end-user configuration changes to that pattern (made through the pattern configuration block) are lost and the default pattern values are restored.

Configuration block definition

configuration blocks are top-level elements. Like other elements, they have a name and a version number. Pattern modules can import configuration blocks from other modules, using the usual version numbering conventions.

The form of a configuration block is:

*configuration* _name_ _version_
 """
 _Description of configuration block to show in UI_
 """

 "_Description of first configuration item_"
 _config_name_ := _config_value_;

  ...
*end configuration*;

Configuration items are given a human-readable description to be shown in the user interface, an identifier to use in patterns, and a default value. The default value is the value used if the configuration item has not been changed by the user. It also determines the type of the configuration item — the user interface will only allow the user to change the setting to a value with the same type. The valid types for configuration items are text string, integer, boolean, list of strings, and list of integers.

This example shows a number of configuration settings:

*configuration* MyConfig 1.0
 """
 An example configuration block.
 """

 "A boolean flag"
 a_flag := true;

 "Command to run"
 command := "sudo rm -rf /";

 "Port for the service"
 port := 12345;

 "Paths to look in"
 paths := [ "/usr/bin", "/usr/local/bin" ];

*end configuration*;

Using configuration settings

Configuration settings are used in patterns by giving the scoped name of the configuration block, followed by the configuration setting name:

*if* MyConfig.a_flag *then*
 result := discovery.runCommand(host, MyConfig.command);
*end if*

Types of default empty lists

The types of configurations items can usually be inferred from the type of the default value. However, if the default value of a configuration item is an empty list, the system cannot know whether it is a list of text strings or a list of integers. To tell the system the type of such a configuration item, an example of the type should be provided in parentheses after the empty list:

"This is a list of strings that's empty by default"
empty_string_list := [ ] ("");

"This is a list of integers that's empty by default"
empty_number_list := [ ] (0);

 

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