def _sshPDisk(self, cmd, errorMsg, dontRaiseOnError=False): cmd_str = ' '.join(cmd) printStep("Executing: %s" % cmd_str) retCode, output = sshCmdWithOutput(cmd_str, self.pdisk.persistentDiskIp, user=getuser(), sshKey=self.pdisk.persistentDiskPrivateKey.replace('.pub', '')) if not dontRaiseOnError and retCode != 0: raise Exception('%s\n: Error: %s' % (errorMsg, output)) return output
def _sshCmdWithOutput(self, cmd, throwOnError=True, **kwargs): rc, output = sshCmdWithOutput(cmd, self.vmAddress, sshKey=self.userPrivateKeyFile, verboseLevel=self.verboseLevel, verboseThreshold=Util.VERBOSE_LEVEL_DETAILED, **kwargs) if rc and throwOnError: raise ExecutionException('Error executing command: %s\n%s' % (cmd, output)) return rc, output
def _sshDst(self, cmd, errorMsg, dontRaiseOnError=False): retCode, output = sshCmdWithOutput( ' '.join(cmd), self.diskDstHost, user=getuser(), sshKey=sshPublicKeyLocation.replace('.pub', '')) if not dontRaiseOnError and retCode != 0: raise Exception('%s\n: Error: %s' % (errorMsg, output)) return output