Exemplo n.º 1
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  resolve configuration variables in the given input
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addOptionHost(self._oArgumentParser)
        self._addOptionResource(self._oArgumentParser)
        self._addOptionBootstrap(self._oArgumentParser)
        self._oArgumentParser.add_argument(
            'input',
            type=str,
            metavar='<input-file>',
            nargs='?',
            help='input file (default: standard input)')
        self._oArgumentParser.add_argument(
            'output',
            type=str,
            metavar='<output-file>',
            nargs='?',
            help='output file (default: standard output)')
Exemplo n.º 2
0
Arquivo: config.py Projeto: idiap/KiSC
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self,
            _sCommand,
            textwrap.dedent('''
                synopsis:
                  configuration management

                sub-commands:
                  show
                    show the cluster configuration
                  list
                    list configured hosts or resources (IDs)
                  resolve
                    resolve configuration variables in the given input
            ''')
        )

        # Additional arguments
        self._oArgumentParser.add_argument(
            'subcommand', type=str, metavar='<sub-command>'
        )
Exemplo n.º 3
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self,
            _sCommand,
            textwrap.dedent('''
                synopsis:
                  display help on the given resource type
            ''')
        )

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionBootstrap(self._oArgumentParser)
        self._oArgumentParser.add_argument(
            '--type', action='store_true',
            help='consider specified resource as resource type rather than ID'
        )
        self._addArgumentResource(self._oArgumentParser)
Exemplo n.º 4
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self,
            _sCommand,
            textwrap.dedent('''
                synopsis:
                  cluster management

                sub-commands:
                  status
                    show hosts or resources status
            ''')
        )

        # Additional arguments
        self._oArgumentParser.add_argument(
            'subcommand', type=str, metavar='<sub-command>'
        )
Exemplo n.º 5
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  show hosts or resources status
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addOptionHost(self._oArgumentParser)
        self._addOptionResource(self._oArgumentParser)
        self._oArgumentParser.add_argument(
            'what',
            type=str,
            choices=['hosts', 'resources'],
            metavar='{hosts|resources}',
        )
Exemplo n.º 6
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  query the host status; exit codes are:
                    0: started
                    1: stopped
                    2: error
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionSilent(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._oArgumentParser.add_argument(
            '--local',
            action='store_true',
            help=
            'query the host local status (in addition to its global status)')
        self._addArgumentHost(self._oArgumentParser)
Exemplo n.º 7
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  show the resource configuration and runtime status
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addOptionBootstrap(self._oArgumentParser)
        self._oArgumentParser.add_argument(
            '--local',
            action='store_true',
            help=
            'query the resource local status (in addition to its global status)'
        )
        self._addArgumentResource(self._oArgumentParser)
Exemplo n.º 8
0
Arquivo: host.py Projeto: idiap/KiSC
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  host management

                sub-commands:
                  start
                    start the host (and its bootstrap resources)
                  stop
                    stop the host (and its bootstrap resources)
                  status
                    query the host status
                  runtime
                    show the host configuration and runtime status
            '''))

        # Additional arguments
        self._oArgumentParser.add_argument('subcommand',
                                           type=str,
                                           metavar='<sub-command>')
Exemplo n.º 9
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  start the host (and its bootstrap resources)
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addArgumentHost(self._oArgumentParser)
Exemplo n.º 10
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  list resources running on (local) host
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addOptionBootstrap(self._oArgumentParser)
Exemplo n.º 11
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  show the host configuration and runtime status
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addArgumentHost(self._oArgumentParser)
Exemplo n.º 12
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  list configured hosts or resources
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionBootstrap(self._oArgumentParser)
        self._oArgumentParser.add_argument(
            '-X',
            '--exclude',
            type=str,
            nargs='*',
            metavar='key{=value|~=regexp}',
            default=list(),
            help='exclude hosts/resources with matching setting(s) key/value')
        self._oArgumentParser.add_argument(
            '-I',
            '--include',
            type=str,
            nargs='*',
            metavar='key{=value|~=regexp}',
            default=list(),
            help=
            'include (only) hosts/resources with matching setting(s) key/value'
        )
        self._oArgumentParser.add_argument(
            'what',
            type=str,
            choices=['hosts', 'resources'],
            metavar='{hosts|resources}',
        )
Exemplo n.º 13
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self, _sCommand,
            textwrap.dedent('''
                synopsis:
                  show the cluster configuration
            '''))

        # Arguments
        self._addOptionConfig(self._oArgumentParser)
        self._addOptionVerbose(self._oArgumentParser)
        self._addOptionHost(self._oArgumentParser)
        self._addOptionResource(self._oArgumentParser)
        self._addOptionBootstrap(self._oArgumentParser)
Exemplo n.º 14
0
    def _initArgumentParser(self, _sCommand=None):
        """
        Create the arguments parser (and help generator)

        @param str _sCommand  Command name
        """

        # Parent
        KiscCli_kisc._initArgumentParser(
            self,
            _sCommand,
            textwrap.dedent('''
                synopsis:
                  resource management

                sub-commands:
                  start
                    start the resource
                  suspend
                    suspend the (started) resource
                  resume
                    resume the (suspended) resource
                  stop
                    stop the resource
                  status
                    query the resource status
                  runtime
                    show the resource configuration and runtime status
                  list
                    list resources (IDs) running on (local) host
                  help
                    display help on the given resource type
            ''')
        )

        # Additional arguments
        self._oArgumentParser.add_argument(
            'subcommand', type=str, metavar='<sub-command>'
        )