Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Browse to the SAMPLESRV directory, and edit the metainfo.xml file that describes the service. For example, adding a custom command to the SAMPLESRV_CLIENT:

    Code Block
                    <component>
                        <name>SAMPLESRV_CLIENT</name>
                        <displayName>Sample Srv Client</displayName>
                        <category>CLIENT</category>
                        <cardinality>1+</cardinality>
                        <commandScript>
                            <script>scripts/sample_client.py</script>
                            <scriptType>PYTHON</scriptType>
                            <timeout>600</timeout>
                        </commandScript>
                        <customCommands>
                          <customCommand>
                            <name>SOMETHINGCUSTOM</name>
                            <commandScript>
                              <script>scripts/sample_client.py</script>
                              <scriptType>PYTHON</scriptType>
                              <timeout>600</timeout>
                            </commandScript>
                          </customCommand>
                        </customCommands>
                    </component>
                </components>
  2. Next, let's create that command script by editing the package/scripts/sample_client.py file that we designated in the service metainfo.

    Code Block
    import sys
    from resource_management import *
    
    class SampleClient(Script):
      def install(self, env):
        print 'Install the Sample Srv Client';
      def configure(self, env):
        print 'Configure the Sample Srv Client';
      def somethingcustom(self, env):
        print 'Something custom';
    
    if __name__ == "__main__":
      SampleClient().execute()

...

Adding Configs to the Custom Service

...

In this example, we will add a configuration type "test-config" to our SAMPLESRV.

...