Use control tasks
Control tasks are actions that you can perform on middleware or middleware resources. For example, checking the connection to a host is a control task. When you trigger a control task, Deploy starts a task that executes the steps associated with the control task.
To view a list of control task in the GUI:
- Click Monitoring.
- Click Control Tasks. Note: By default, Monitoring only shows the tasks that are assigned to you. To see all tasks, click All tasks.
To trigger a control task on a configuration item (CI) in the GUI:
- In the top navigation bar, click Explorer.
- Locate the CI on which you want to trigger a control task. Click to see the control tasks that are available.
- Select the control task to trigger it. Note: Some control tasks will require you to provide values for parameters before Deploy executes the task.
You can execute control tasks from the Deploy command-line interface (CLI). You can find the control tasks that are available in the CI reference documentation for each plugin. For example, the
glassfish.StandaloneServer CI includes a
start control task that starts a GlassFish server.
To execute it:
deployit> server = repository.read('Infrastructure/demoHost/demoServer') deployit> deployit.executeControlTask('start', server)
Some control tasks include parameters that you can set. For example:
deployit> server = repository.read('Infrastructure/demoHost/demoServer') deployit> control = deployit.prepareControlTask(server, 'methodWithParams') deployit> control.parameters.values['paramA'] = 'value' deployit> taskId = deployit.createControlTask(control) deployit> deployit.startTaskAndWait(taskId)
To add a control task to an existing CI type such as
Host, you can extend the Generic plugin as follows:
Define a custom container that extends the generic container. The custom container should define the control task and the associated script to run. The script is a FreeMarker template that is rendered, copied to the target host, and executed. For example, in
<type type="mycompany.ConnectionTest" extends="generic.Container"> <!-- inherited hidden --> <property name="startProcessScript" default="mycompany/connectiontest/start" hidden="true"/> <property name="stopProcessScript" default="mycompany/connectiontest/stop" hidden="true"/> <!-- control tasks --> <method name="start" description="Start some process"/> <method name="stop" description="Stop some process"/> </type>
- In the Deploy Library, create the container under the host that you want to test.
- Execute the control task.
For information on writing your own Deploy control task, see Create a custom control task.