Status Message Variables for Custom Policy Checks

The status message appears at the conclusion of a custom policy check's execution. Your Python script can contain variables to provide information specific to the custom check. This guide shows where those are set up within a Python script and how Liquibase can expand those variables into useful values.

The Checks extension, which includes all Custom Policy Check functionality, is available to Liquibase Pro 4.29.0+ users.

Note: Review this set of Python script examples and search for liquibase_status.message to see example set ups of status messages with replaceable strings.

Prerequisites

This guide picks up the Option for advanced users step on the Custom Policy Checks page. Refer to that page for setting up custom policy checks.

Step-by-step guide

  1. In the CLI, at the 'Set SCRIPT_MESSAGE' prompt enter a message which will display when the check triggers. In this example we will set the message which includes a variable:
  2. Identifier __ID_NAME__ should not include quotes.
  3. Your Python script also contains the status message with a replaceable variable. In this example, the replacable string is __ID_NAME__. Liquibase replaces that variable with the Python script's value.

    status_message = Identifier __ID_NAME__ should not include quotes.
    status_message = str(script_helper.git_gitscript_message()).replace(__ID_NAME__, identifier)
    liquibase_status.message = status_message