Exemplo n.º 1
0
    def _execute_ssh_command(self, cmdstr):
        """
        Executes a command in the hardware using ssh

        @type command: C{string}
        @param command: Command string to execute
        @return ots.common.command
        """
        cmd = Command(cmdstr, soft_timeout = self.command_timeout,
                      hard_timeout = self.command_timeout + 5)

        try:
            cmd.execute_in_shell()
        except (SoftTimeoutException, HardTimeoutException):
            LOG.warning("Failed to execute ssh command. (command %s " \
                        "timed out)" % (cmdstr))
        except CommandFailed:
            # Print debug on command failure. It still might be ok.
            LOG.debug("Failed to execute ssh command. (command %s " \
                        "returned %s)" % (cmdstr, \
                        cmd.return_value))
        else:
            LOG.debug("Command executed successfully!")

        return cmd
Exemplo n.º 2
0
    def _execute_ssh_command(self, cmdstr):
        """
        Executes a command in the hardware using ssh

        @type command: C{string}
        @param command: Command string to execute
        @return ots.common.command
        """
        cmd = Command(cmdstr,
                      soft_timeout=self.command_timeout,
                      hard_timeout=self.command_timeout + 5)

        try:
            cmd.execute_in_shell()
        except (SoftTimeoutException, HardTimeoutException):
            LOG.warning("Failed to execute ssh command. (command %s " \
                        "timed out)" % (cmdstr))
        except CommandFailed:
            # Print debug on command failure. It still might be ok.
            LOG.debug("Failed to execute ssh command. (command %s " \
                        "returned %s)" % (cmdstr, \
                        cmd.return_value))
        else:
            LOG.debug("Command executed successfully!")

        return cmd
Exemplo n.º 3
0
def _start_process(command):
    """
    Starts the specified process

    @type command: C{str}
    @param command: The CL params for the Process to be run as a Task 
    """
    task = Command(command)
    task.execute_in_shell()
Exemplo n.º 4
0
def _start_process(command):
    """
    Starts the specified process

    @type command: C{str}
    @param command: The CL params for the Process to be run as a Task 
    """
    task = Command(command)
    task.execute_in_shell()