Define a command

From ControlTier

Jump to: navigation, search
Workflows
no pages or subcategories


See a short screencast

Commands are defined within the type definition file: type.xml. Commands wrap the known command or procedure and once defined, become exposed to the automation framework for broad use. These commands can later evolve to follow conventions supporting virtualized administration.

Contents

Create or choose a type

You can add commands to an existing type definition or you can create a new type.

To create a new type run:

$ ctl -m ProjectBuilder -c create-type

The create-type command will generate a type.xml file where you can define your command.

Edit type.xml

Open the type.xml in an editor and locate the "<commands>" tag. Notice the "salute" command definition, simply a wrapper around the bash interpreter.

<type name="hello" role="concrete" 
        uniqueInstances="true">
 <description> Says hello. </description>

 <supertype>
      <typereference name="Managed-Entity"/>
 </supertype>
 <command-settings>
      <notification notify="false"/>
      <template-directory></template-directory>
      <dependency-view parents="false" children="true" proximity="1"/>
     <logger name="hello"/>
 </command-settings>
 <commands>
  <command name="salute" description="offer a salutation"
           command-type="Command" is-static="true">
   <execution-string>bash</execution-string>
   <argument-string>echo hello</argument-string>
  </command>
 </commands>
</type>

When a user runs this command the echo command will print "hello" to the console.

Build the type

Use the "build-type" command to generate the command files.

$ ctl -m ProjectBuilder -c build-type -- -type hello -upload -deploy

The -upload and -deploy flag cause the generated type to be uploaded to Workbench and then deployed to the local client.

Run the command

The hello module is now deployed and the new command run:

$ ctl -m hello -c salute
hello
Personal tools
Namespaces
Variants
Actions
Navigation
Communication
Development
Toolbox
Print/export