This example illustrates how the agent plugin can be used to execute an operation at a remote Pineapple agent.
Pineapple's unit of work is modules. A module is a self contained unit which can contain models, scripts and binaries. Models serves to specify test cases, deployment of applications, configuration of devices or execution of scripts.
The default directory for modules is ${user.home}/.pineapple/modules so we will create a module named agent-execute-module there. The module for this example will end up with the structure:
agent-execute-module | +--- models +--- local.xml
The model file for execution of the module planet-violet-001:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <mmd:models xmlns:mmd="http://pineapple.dev.java.net/ns/module_model_1_0" xmlns:pap="http://pineapple.dev.java.net/ns/plugin/agent_1_0" > <mmd:model target-resource="agent-node1"> <mmd:content> <pap:agent> <pap:execute-operation module="planet-violet-001" operation"deploy-configuration" environment="linux-vagrant" /> </pap:agent> </mmd:content> </mmd:model> </mmd:models>
Two schema are used in the model file. The http://pineapple.dev.java.net/ns/module_model_1_0 is used to define the namespace mmd which defines the general infrastructure for models. The http://pineapple.dev.java.net/ns/plugin/agent_1_0 schema is used to define the namespace pap which is used to define the model for the agent plugin. Since multiple schemas are used to define the model file, the elements are qualified.
The target-resource attribute defines a reference to the resource which is targeted when the model executed. In this case, the value agent-node1 is a reference to a resource which defines a Pineapple agent.
The pap:agent element defines the root of model for the agent plugin. The pap:execute-operation element defines command to execute the module at the remote Pineapple agent: