def find_impl(cls, executor): '''Finds implementation of vital_product_data.Discoverer for current destination @param param: a command executor instance @type executor: command.Executor @return: implementation of vpd discoverer applicable for current destination @rtype: vital_product_data.Discoverer @raise service_loader.NoImplementationException: if no implementation found ''' p = os_platform_discoverer.discover_platform_by_shell(executor.shell) vpd_impls = service_loader.global_lookup[Discoverer] for vpd_impl in vpd_impls: if Sfn(vpd_impl.is_applicable)(p, executor): return vpd_impl raise service_loader.NoImplementationException('No lsdev impl found')
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)