New Custom Button Functionality
Last updated
Last updated
Invoking services and automation workflows from custom buttons has been a very useful feature of CloudForms and ManageIQ for many versions. CloudForms 4.6 (ManageIQ Gaprindashvili) has expanded the capabilities of custom buttons in several ways.
Custom buttons can now be placed on a wider range of object types in the WebUI (see screenshot Object Types Supported).
Icons for both button groups and buttons can be selected from three different icon sets, and can be given a custom colour (see screenshots Selecting the Icon and Selecting the Icon Colour).
Many services or workflows triggered by custom buttons are only applicable to a certain sub-type of object that the button is displayed on. For example a button that registers a Red Hat Enterprise Linux VM with a Satellite server is not applicable to a VM running Windows, or Ubuntu Linux.
The new button functionality allows for a conditional visibility filter, that only displays the button in the button group if the visibility expression match is successful (see screenshot Setting a Visibility Expression).
The workflows or services triggered by some custom buttons often require the object to be in a particular state - for example a VM must be powered on to be able to run an Ansible playbook. Conditional enablement allows an expression to be defined, such that if the expression does not evaluate to true for an object, the button is greyed out (see screenshot Setting a Conditional Enablement Expression).
This can be illustrated with a VM that has been evaluated by CloudForms as non-compliant, and requires a package to be installed to restore the compliance status. A button is available on the VM to install a package using an Ansible playbook, but the playbook requires the VM to be on.
If the VM is powered off, the Install a Package button is greyed out and cannot be used (see screenshot Button Greyed Out When VM is Off).
When the VM is powered on, the Install a Package button becomes enabled, and the package can be installed (see screenshot Button Enabled When VM is On).
The only display option for custom buttons in previous versions of CloudForms and ManageIQ was on the details page of a single instance of the object type. With CloudForms 4.6 (ManageIQ Gaprindashvili) custom buttons can now be displayed for multiple instances of an object type (see screenshot Multiple Instances Selected for a Button).
Note
Buttons that run on multiple objects must have no dialog associated with them
If a button is run against multiple objects in this way the button method can be either run once for all objects, or run individually for each object. If it is run once for all objects (Submit all in the WebUI), the button method will receive a list of object IDs along with a target_object_type
attribute, as follows:
The method will not have a $evm.root['vmdb_object_type']
attribute and will have to perform a $evm.vmdb
lookup of each object ID to perform actions on the selected object.
If the button method is run separately for each object selected (One by one in the WebUI), each method's invocation will have a $evm.root['vmdb_object_type']
attribute, and a root object of that type (for example $evm.root['vm']
).
To define a button's display options the Display for and Submit drop-downs are used (see screenshot 'Display for' and 'Submit' Selections).
The custom button definition page includes a small Open URL checkbox. If this is ticked for a button assigned to a VM, the button method can open a new browser window by assigning a valid URL to the VM's remote_console_url=
method.
The following button method example opens a new browser window to the corresponding RHV-Manager page for the VM on which the button is displayed:
The Open URL functionality allows an automate method to perform potentially complex tasks before a web page is displayed. An example might be setting up proxy servers for a VNC connection, so that the CloudForms or ManageIQ WebUI can open an HTML5 VNC client that connects through the tunnel.
This chapter has described the new custom button functionality that comes with CloudForms 4.6 (ManageIQ Gaprindashvili).