I search the Internet for answers to computer technical problems that I encounter. When the Internet does not supply me with an answer, I research one on my own. Then, I document the answer here so others can find it.
Also, for your benefit, this stupid blog name makes a great mnemonic.

2008-10-24

[Opsware] Bad Configuration Markup Language (CML) examples in docs

In the PDF Opsware SAS 7.0 Policy Setter's Guide, in "Appendix A: CML Tutorial and Reference", the following example is given.RejectResponseUrl = @reject_response_url;string;r'(HTTP_URLSCAN_STATUS_HEADER)|(HTTP_URLSCAN_ORIGINAL_VERB)|(HTTP_URLSCAN_ORIGINAL_URL)';optional@

You'll find at least the following two errors, and both problems are with the range specification.

The subtle but annoying error is that single quotes are not allowed, only double-quotes. If you use single quotes, then Opsware Client will give you an error dialog with the message "Invalid range found on line:" and the detail "com.opsware.acm.CMLTemplateSyntaxException".

The obvious problem is the terrible regular expression. The entire thing should be in parenthesis, not each string. If you parenthesize each string, Opsware will really not be happy. You will get an error dialog with the message "An internal runtime error has occured" and the detail "java.lang.NullPointerException".

However, I just noticed that this is not always the case. This line, for example, will cause the null pointer exception.LogLevel @log_level;string;r"(emerg)|(alert)|(crit)|(error)|(warn)|(notice)|(info)|(debug)"@

But this one will not.ServerTokens @server_tokens;string;r"(Major)|(Minor)|(Min)|(Prod)|(OS)|(Full)"@

If I'm missing something obvious, feel free to swat me with a newspaper.