Routines for local ruby scripts
This topic provides a list of routines or functions that you can use while creating or updating a script. Routines are required at run time when executing the script. Routines are set directives that you can use to add or modify objects such as applications, components, servers, and properties in the context of the step that is running.
Routines are interpreted only at step completion. Routines are not recognized in the test-mode automation mode. To test them, you must save them in a script, use the script in a step, and run the step or request. The database is updated with relevant information about routines only when the last step in the request is completed, as the automation engine needs a request context.
The automation engine searches the database for each item specified for creation on a case-sensitive basis, and then creates items if there is no match. Since the automation script is run from a step, it has an application, environment and component context. The created items are assigned to the application (or component) and environment (or servers) of the running step.
Routines described in the following table are Ruby-based and therefore can be used for local ruby scripts.
List of routines for adding in a script
Routine | Description |
---|---|
set_property_flag | Updates a property in a step of a request in BMC Release Process Management. If the property name specified in the step is not present in the database, error should be sent. Note: Only for Ruby-based automation scripts. Example: # Creating and Updating an existing environment component property in the step: # Creating a new global property: |
set_component_flag | Creates or updates application components in BMC Release Process Management. Note: Only for Ruby-based automation scripts. Example: myComponents = "name, version, environment, application\n" |
set_servers_flag | Creates or updates servers in BMC Release Process Management. Note: Only for Ruby-based automation scripts. Example: servers += "serverName1, Environment1\n" |
set_application_version | Updates a version of an application in BMC Release Process Management. You can use this routine to update only one version at a time. Example: setApp = "App 01" |
pack_response | Updates values for output arguments. You can use this routine for updating only one output argument value at a time. Note: This routine can be used in remote shell and local shell scripts with the echo command. You can specify this routine in the following format:
Example: For Ruby-based scripts: pack_response 'jira_tickets' 'JPET-1: Add Link, JPET-2: Add Fish Icon' For remote shell and local shell scripts: echo "pack_response 'jira_tickets' 'JPET-1: Add Link, JPET-2: Add Fish Icon'" |
strip_private_flag(params) | Decrypts all the parameters which are marked as private and update the hash map. Example: strip_private_flag(params) |
decrypt_string_with_prefix(val) | Decrypts parameter values which are marked as private. By using this routine, you can return to the original plain text value of the parameter. Example: decrypt_string_with_prefix(SS_integration_password_enc) |
run_command(..) | Runs a specified command on the command-line of the target server. The target server refers to your local computer where BMC Release Process Management is installed and running. Example: cmd = "ruby #{params["SS_script_support_path"]\}/amazon_control.rb" |
get_server_list(params) | Lists the various servers selected in the step. |
write_to(string) | Prints the given string value (string) in the output file for debugging and troubleshooting purposes. This information is also available on the Notes tab of the step after the automation is successfully completed. Example: write_to "Command_Failed - term not found: [#{params["success"]}]\n" |
Related topic