def execute(self): self.customize(self.options) connection = None try: connection = Overthere.getConnection(CifsConnectionBuilder.CIFS_PROTOCOL, self.options) connection.setWorkingDirectory(connection.getFile(self.remotePath)) # upload the script and pass it to powershell targetFile = connection.getTempFile("uploaded-powershell-script", ".ps1") OverthereUtils.write(String(self.script).getBytes(), targetFile) targetFile.setExecutable(True) scriptCommand = CmdLine.build( "powershell", "-NoLogo", "-NonInteractive", "-InputFormat", "None", "-ExecutionPolicy", "Unrestricted", "-Command", targetFile.getPath(), ) return connection.execute(self.stdout, self.stderr, scriptCommand) except Exception, e: stacktrace = StringWriter() writer = PrintWriter(stacktrace, True) e.printStackTrace(writer) self.stderr.handleLine(stacktrace.toString()) return 1
def execute(self): self.customize(self.options) connection = None try: connection = Overthere.getConnection(CifsConnectionBuilder.CIFS_PROTOCOL, self.options) connection.setWorkingDirectory(connection.getFile(self.TestPath)) # upload the ResultName and pass it to csResultName.exe ResultNameCommand = CmdLine.build(WlrunExe, "-Run", "-TestPath", TestPath, "-ResultName", ResultName) return connection.execute(self.stdout, self.stderr, ResultNameCommand) except Exception, e: stacktrace = StringWriter() writer = PrintWriter(stacktrace, True) e.printStackTrace(writer) self.stderr.handleLine(stacktrace.toString()) return 1
def execute(self): self.customize(self.options) connection = None try: connection = Overthere.getConnection(SshConnectionBuilder.CONNECTION_TYPE, self.options) # upload the script and pass it to python exeFile = connection.getTempFile('f5_disable', '.py') OverthereUtils.write(String(self.script).getBytes(), targetFile) exeFile.setExecutable(True) # run cscript in batch mode scriptCommand = CmdLine.build( '/usr/bin/python', exeFile.getPath() ) return connection.execute(self.stdout, self.stderr, scriptCommand) except Exception, e: stacktrace = StringWriter() writer = PrintWriter(stacktrace, True) e.printStackTrace(writer) self.stderr.handleLine(stacktrace.toString()) return 1
def execute(self): self.customize(self.options) connection = None try: connection = Overthere.getConnection(CifsConnectionBuilder.CIFS_PROTOCOL, self.options) connection.setWorkingDirectory(connection.getFile(self.remotePath)) # upload the script and pass it to cscript.exe targetFile = connection.getTempFile('uploaded-script', '.vbs') OverthereUtils.write(String(self.script).getBytes(), targetFile) targetFile.setExecutable(True) # run cscript in batch mode scriptCommand = CmdLine.build(cscriptExecutable, '//B', '//nologo', targetFile.getPath()) return connection.execute(self.stdout, self.stderr, scriptCommand) except Exception, e: stacktrace = StringWriter() writer = PrintWriter(stacktrace, True) e.printStackTrace(writer) self.stderr.handleLine(stacktrace.toString()) return 1
def execute(self): self.customize(self.options) connection = None try: connection = Overthere.getConnection( CifsConnectionBuilder.CIFS_PROTOCOL, self.options) connection.setWorkingDirectory(connection.getFile(self.remotePath)) # upload the script and pass it to cscript.exe targetFile = connection.getTempFile('uploaded-script', '.vbs') OverthereUtils.write(String(self.script).getBytes(), targetFile) targetFile.setExecutable(True) # run cscript in batch mode scriptCommand = CmdLine.build(cscriptExecutable, '//B', '//nologo', targetFile.getPath()) return connection.execute(self.stdout, self.stderr, scriptCommand) except Exception, e: stacktrace = StringWriter() writer = PrintWriter(stacktrace, True) e.printStackTrace(writer) self.stderr.handleLine(stacktrace.toString()) return 1
def execute(self): self.customize(self.options) connection = None try: connection = Overthere.getConnection(CifsConnectionBuilder.CIFS_PROTOCOL, self.options) connection.setWorkingDirectory(connection.getFile(self.remotePath)) # upload the script and pass it to cscript.exe targetFile = connection.getTempFile('parameters', '.txt') OverthereUtils.write(String(self.script).getBytes(), targetFile) targetFile.setExecutable(True) exeFile = connection.getTempFile('HpToolsLauncher', '.exe') sysloader = ClassLoader.getSystemClassLoader() OverthereUtils.write(sysloader.getResourceAsStream("HpTools/HpToolsLauncher.exe"), exeFile) exeFile.setExecutable(True) # run cscript in batch mode scriptCommand = CmdLine.build(exeFile.getPath(), '-paramfile', targetFile.getPath()) return connection.execute(self.stdout, self.stderr, scriptCommand) except Exception, e: stacktrace = StringWriter() writer = PrintWriter(stacktrace, True) e.printStackTrace(writer) self.stderr.handleLine(stacktrace.toString()) return 1
def getConnection(self): if (self.connectionType): return Overthere.getConnection("ssh", self.options) else: return LocalConnection.getLocalConnection()
def getConnection(self): """ :return: a new com.xebialabs.overthere.OverthereConnection """ return Overthere.getConnection(self._options.protocol, self._options.build())