Creating custom grammars
The BMC Server Automation product uses a system of grammars to parse configuration files. Typically a grammar examines each line in a configuration file, and if a line matches rules set up in the grammar, the grammar generates a configuration file record. When you create a grammar, you can choose to create configuration file records from multiple lines, which is required for some types of configuration files.
After configuration file records are created, you can use grammars to browse, snapshot and audit them. You can also run Compliance Jobs on them and deploy configuration files like other server objects. Using these standard procedures, you can manipulate the contents of configuration files with great precision, down to their individual lines. You can monitor configuration files on servers throughout your system and, if necessary, correct inconsistencies without synchronizing those servers' configuration files so that they are exactly alike.
Creating custom grammars is advanced functionality. Only experienced users of BMC Server Automation should attempt to create custom grammars. Be aware of the following considerations:
- BMC does not provide support for the creation of custom grammars.
- Always develop custom grammars on a development system until you are certain that the grammar can parse configuration files reliably. When you can reliably parse a configuration file, test deploying and rolling back the configuration file. Only when the grammar performs reliably for all aspects of configuration file usage should you promote the grammar file to a production system. In older versions of the Application Server, an incorrectly defined grammar can crash an Application Server.
- BMC does not recommend editing an existing grammar. If you must edit an existing grammar, you will need to recreate any BLPackages that use the grammar, to ensure that the BLPackages continue to work and all changes are applied. In addition, after editing the grammar file in the <installDirectory>/scripts directory, restart the BMC Server Application Server for the changes to take effect.
The following topics explain how to create grammar files and how to integrate a grammar file into the BMC Server Automation system.
- Types of grammar files
- Syntax for grammar files
- Recommendations when writing a grammar
- Sample configuration file and its grammar
- Integrating configuration grammars into BMC Server Automation
Syntax for grammar files describes the required syntax when you write a grammar file. After you have created a grammar, see Integrating configuration grammars into BMC Server Automation for a description of how to add the grammar file to BMC Server Automation.