def getSystemInfo(self, address, port): handlers = (lambda result: result.output, fptools.partiallyApply(_buildDocumentForXpath, fptools._, 0) ) return command.Cmd(self._SYSTEM_INFO_URL_PATTERN % {'address': address, 'port': port}, command.ChainedCmdlet(*map(command.FnCmdlet, handlers)))
def get_executor(self, shell): system32_location = self.system32_location or '%SystemRoot%\\system32' cmd_location = "\"%s\\%s\"" % (system32_location, 'cmd') powershell_location = "powershell" if shell.is64BitMachine() and self.is64bit: powershell_location = "\"%s\\%s\"" % (system32_location, '\\WindowsPowerShell\\v1.0\\%s' % powershell_location) return command.ChainedCmdlet(IISPowerShellScriptCmd(), EchoCmd(), WinCmd(cmdline=cmd_location), PowerShellCmd(cmdline=powershell_location).command_stdin(), command.cmdlet.executeCommand(shell), command.cmdlet.produceResult)
def wrapper(executor, *args, **kwargs): db2_home_path = kwargs.get('db2_home_path') cmdline = None if db2_home_path: bin_path = compose_db2_bin_path(db2_home_path) bin_name = Db2Cmd.BIN_NAME cmdline = shell_interpreter.normalizePath(bin_path + bin_name) db2cmd = Db2Cmd(cmdline).c.w.i executor = command.ChainedCmdlet(db2cmd, executor) return original_fn(executor, *args, **kwargs)
def getVersionCmd(self): r''' Get command to discover SAP Web Disp command @types: -> command.Cmd @command: sapwebdisp -v ''' return command.Cmd("%s -v" % self.cmdline, command.ChainedCmdlet( command.RaiseWhenOutputIsNone(), command.RaiseWhenReturnCodeIsNotZero(), command.FnCmdlet(self.parseVersionInfo) ))
def __get_produce_result_executor(self, shell): return command.ChainedCmdlet(command.cmdlet.executeCommand(shell), command.cmdlet.produceResult)
def get_command_executor(shell): return command.ChainedCmdlet(command.getExecutor(shell), command.cmdlet.produceResult)