def getShellDiscoverer(shell, fs, pathTool, userName, installationPath, sid): executor = ChainedCmdlet(command.getExecutor(shell), command.cmdlet.produceResult) is_command_exist_cmd = hana_shell_command.get_is_command_exist_cmd(shell) layout_cls = getFileSystemLayoutClass(shell) layout = layout_cls(fs, executor, is_command_exist_cmd, installationPath) hdbsqlpath = layout.getHdbsqlPath(sid) hdbsqlCmd = getHdbsqlCommandClass(shell)(hdbsqlpath, userName) executor = ChainedCmdlet(hdbsqlCmd, executor) return Discoverer(executor, pathTool)
def get_remote_fc_hba_descriptors(shell, device_filename): r''' Discovers fibre channel info using ioscan and fcmsutil commands shellutils.Shell, str -> tuple[fcmsutil.RemoteOptionDescriptor]] @raise ValueError: if no shell passed @raise command.ExecutionException: on command execution failure @raise com.hp.ucmdb.discovery.library.clients.protocols.command.TimeoutException: on command timeout ''' executor = ChainedCmdlet(command.getExecutor(shell), command.cmdlet.produceResult) fcmsutil_cmd = fcmsutil.Cmd(device_filename=device_filename) return fcmsutil_cmd.remote() | executor
def _discoverVersion(process, shell, serverOsh): r'@types: Process, Shell, osh -> sap.VersionInfo?' logger.info("Discover dispatcher version") binPath = (process.executablePath or SF(getExecutablePath)(shell, process.getPid())) versionInfo = None if binPath: sapwebdispCmd = sap_webdisp_discoverer.SapwebdispCmd(binPath) versionInfo = (sapwebdispCmd.getVersionCmd() | command.getExecutor(shell) | command.SafeProcessor()) logger.info("Version is %s" % versionInfo) # a) report server version information if versionInfo: logger.debug("report version information: %s" % versionInfo) softwareBuilder = sap.WebDispatcherBuilder() softwareBuilder.updateVersionInfo(serverOsh, versionInfo) return versionInfo logger.warn("Failed to discover version. Executable path is absent")
def get_fc_hba_descriptors(shell): r''' Discovers fibre channel info using ioscan and fcmsutil commands shellutils.Shell -> tuple[tuple[ioscan.fOptionDescriptor, fcmsutil.FcmsutilDescriptor, fcmsutil.FcmsutilVpdOptionDescriptor]] @raise ValueError: if no shell passed @raise command.ExecutionException: on command execution failure @raise com.hp.ucmdb.discovery.library.clients.protocols.command.TimeoutException: on command timeout ''' executor = ChainedCmdlet(command.getExecutor(shell), command.cmdlet.produceResult) cmd = ioscan.Cmd().fnC('fc') ioscan_result = cmd | executor result = [] for ioscan_result_descriptor in ioscan_result: device_filename = ioscan_result_descriptor.device_filename fcmsutil_cmd = fcmsutil.Cmd(device_filename=device_filename) fc_descriptor = fcmsutil_cmd | executor fc_vpd_descriptor = fcmsutil_cmd.vpd() | executor result.append((ioscan_result_descriptor, fc_descriptor, fc_vpd_descriptor)) return tuple(result)
def get_fc_hba_descriptors(shell): r''' Discovers fibre channel info using ioscan and fcmsutil commands shellutils.Shell -> tuple[tuple[ioscan.fOptionDescriptor, fcmsutil.FcmsutilDescriptor, fcmsutil.FcmsutilVpdOptionDescriptor]] @raise ValueError: if no shell passed @raise command.ExecutionException: on command execution failure @raise com.hp.ucmdb.discovery.library.clients.protocols.command.TimeoutException: on command timeout ''' executor = ChainedCmdlet(command.getExecutor(shell), command.cmdlet.produceResult) cmd = ioscan.Cmd().fnC('fc') ioscan_result = cmd | executor result = [] for ioscan_result_descriptor in ioscan_result: device_filename = ioscan_result_descriptor.device_filename fcmsutil_cmd = fcmsutil.Cmd(device_filename=device_filename) fc_descriptor = fcmsutil_cmd | executor fc_vpd_descriptor = fcmsutil_cmd.vpd() | executor result.append( (ioscan_result_descriptor, fc_descriptor, fc_vpd_descriptor)) return tuple(result)
def find_discoverer_by_shell(shell, protocol_name=None): os_platform_ = os_platform_discoverer.discover_platform_by_shell(shell) executor = command.getExecutor(shell) return find_discoverer_by_os_platform(os_platform_, executor=executor, protocol_name=protocol_name)
def get_command_executor(shell): return command.ChainedCmdlet(command.getExecutor(shell), command.cmdlet.produceResult)
def get_executor(self, shell): return ChainedCmdlet(wmic.Cmd(), getExecutor(shell))