| 81 | raise internalError("SSH Connection Failed") |
| 82 | |
| 83 | def execute(self, command): |
| 84 | stdin, stdout, stderr = self.ssh.exec_command(command) |
| 85 | output = stdout.readlines() |
| 86 | errors = stderr.readlines() |
| 87 | results = [] |
| 88 | if output is not None and len(output) == 0: |
| 89 | if errors is not None and len(errors) > 0: |
| 90 | for error in errors: |
| 91 | results.append(error.rstrip()) |
| 92 | |
| 93 | else: |
| 94 | for strOut in output: |
| 95 | results.append(strOut.rstrip()) |
| 96 | self.logger.debug("{Cmd: %s via Host: %s} {returns: %s}" % |
| 97 | (command, str(self.host), results)) |
| 98 | return results |
| 99 | |
| 100 | def createConnection(self): |
| 101 | ''' |