示例#1
0
def find(executor, alternatives=None):
    '''Finds lscfg binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: lscfg command implementation
    @rtype: lscfg_aix.Cmd
    @raise command.NotFoundException: in case if `lscfg`
                                        command is not available
    @raise service_loader.NoImplementationException: in case if no
                                                    `lscfg` wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)
    if not bin:
        raise command.NotFoundException('No lscfg binary found')

    lscfg_impls = [Cmd, ]
    for lscfg_impl in lscfg_impls:
        if lscfg_impl.is_applicable(bin, executor):
            return partial(lscfg_impl, bin=bin)
    raise service_loader.NoImplementationException('No lscfg impl found')
示例#2
0
def find(executor, alternatives=None):
    '''Finds lsdev binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: lsdev command implementation
    @rtype: lsdev.Cmd
    @raise command.NotFoundException: in case if `lsdev` command is not available
    @raise service_loader.NoImplementationException: in case if no `lsdev` wrapper available
    '''
    alternatives = alternatives or bin_alternatives

    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)

    if not bin:
        raise command.NotFoundException(
            'No lsdev binary found among provided path alternatives.')

    lsdev_impls = service_loader.global_lookup[Cmd]
    for lsdev_impl in lsdev_impls:
        if Sfn(lsdev_impl.is_applicable)(bin, executor):
            return partial(lsdev_impl, bin=bin)
    raise service_loader.NoImplementationException('No lsdev impl found')
示例#3
0
def find(executor, alternatives=None):
    '''Finds vmkmgmt_keyval binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: vmkmgmt_keyval command implementation
    @rtype: vmkmgmt_keyval.Cmd
    @raise command.NotFoundException: in case if `vmkmgmt_keyval` command is not available
    @raise service_loader.NoImplementationException: in case if no `vmkmgmt_keyval` wrapper available
    '''
    alternatives = alternatives or bin_alternatives

    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)

    if not bin:
        raise command.NotFoundException(
            'No vmkmgmt_keyval binary found among provided path alternatives')

    vmkmgmt_keyval_impls = (Cmd, )
    for vmkmgmt_keyval_impl in vmkmgmt_keyval_impls:
        if Sfn(vmkmgmt_keyval_impl.is_applicable)(bin, executor):
            return partial(vmkmgmt_keyval_impl, bin=bin)
    raise service_loader.NoImplementationException(
        'No vmkmgmt_keyval impl found')
示例#4
0
def find(executor, alternatives=None):
    '''Finds vmkmgmt_keyval binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: vmkmgmt_keyval command implementation
    @rtype: vmkmgmt_keyval.Cmd
    @raise command.NotFoundException: in case if `vmkmgmt_keyval` command is not available
    @raise service_loader.NoImplementationException: in case if no `vmkmgmt_keyval` wrapper available
    '''
    alternatives = alternatives or bin_alternatives

    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)

    if not bin:
        raise command.NotFoundException('No vmkmgmt_keyval binary found among provided path alternatives')

    vmkmgmt_keyval_impls = (Cmd, )
    for vmkmgmt_keyval_impl in vmkmgmt_keyval_impls:
        if Sfn(vmkmgmt_keyval_impl.is_applicable)(bin, executor):
            return partial(vmkmgmt_keyval_impl, bin=bin)
    raise service_loader.NoImplementationException('No vmkmgmt_keyval impl found')
示例#5
0
def find(executor, alternatives=None):
    '''Finds lsdev binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: lsdev command implementation
    @rtype: lsdev.Cmd
    @raise command.NotFoundException: in case if `lsdev` command is not available
    @raise service_loader.NoImplementationException: in case if no `lsdev` wrapper available
    '''
    alternatives = alternatives or bin_alternatives

    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)

    if not bin:
        raise command.NotFoundException('No lsdev binary found among provided path alternatives.')

    lsdev_impls = service_loader.global_lookup[Cmd]
    for lsdev_impl in lsdev_impls:
        if Sfn(lsdev_impl.is_applicable)(bin, executor):
            return partial(lsdev_impl, bin=bin)
    raise service_loader.NoImplementationException('No lsdev impl found')
def find(executor, alternatives=None):
    '''Finds lsdev binary and creates vio lsdev wrapper on success

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: lsdev command implementation
    @rtype: lsdev_aix_vio_server_impl.Cmd
    @raise command.NotFoundException: in case if `lsdev` command
                                        is not available
    @raise service_loader.NoImplementationException: in case if no `lsdev`
                                                        wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)

    if not bin:
        raise command.NotFoundException('No lsdev binary found')

    lsdev_impl = Cmd
    if lsdev_impl.is_applicable(bin, executor):
        return partial(lsdev_impl, bin=bin)
    raise service_loader.NoImplementationException('No lsdev impl found')
示例#7
0
def find(executor, alternatives=None):
    '''Finds fcinfo binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: fcinfo command implementation
    @rtype: fcinfo_solaris.Cmd
    @raise command.NotFoundException: in case if `fcinfo`
                                        command is not available
    @raise service_loader.NoImplementationException: in case if no
                                                    `fcinfo` wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)
    if not bin:
        raise command.NotFoundException('No fcinfo binary found')

    fcinfo_impls = [Cmd, ]
    for fcinfo_impl in fcinfo_impls:
        if fcinfo_impl.is_applicable(bin, executor):
            return partial(fcinfo_impl, bin=bin)
    raise service_loader.NoImplementationException('No fcinfo impl found')
示例#8
0
def find(executor, alternatives=None):
    '''Finds lsdev binary and creates vio lsdev wrapper on success

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: lsdev command implementation
    @rtype: lsdev_aix_vio_server_impl.Cmd
    @raise command.NotFoundException: in case if `lsdev` command
                                        is not available
    @raise service_loader.NoImplementationException: in case if no `lsdev`
                                                        wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)

    if not bin:
        raise command.NotFoundException('No lsdev binary found')

    lsdev_impl = Cmd
    if lsdev_impl.is_applicable(bin, executor):
        return partial(lsdev_impl, bin=bin)
    raise service_loader.NoImplementationException('No lsdev impl found')
示例#9
0
def find(executor, alternatives=None):
    '''Finds fcinfo binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: fcinfo command implementation
    @rtype: fcinfo_solaris.Cmd
    @raise command.NotFoundException: in case if `fcinfo`
                                        command is not available
    @raise service_loader.NoImplementationException: in case if no
                                                    `fcinfo` wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)
    if not bin:
        raise command.NotFoundException('No fcinfo binary found')

    fcinfo_impls = [
        Cmd,
    ]
    for fcinfo_impl in fcinfo_impls:
        if fcinfo_impl.is_applicable(bin, executor):
            return partial(fcinfo_impl, bin=bin)
    raise service_loader.NoImplementationException('No fcinfo impl found')
示例#10
0
def find(executor, alternatives=None):
    '''Finds fcstat binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: fcstat command implementation
    @rtype: fcstat.Cmd
    @raise command.NotFoundException: in case if `fcstat` command is not available
    @raise service_loader.NoImplementationException: in case if no `fcstat` wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)
    if not bin:
        raise command.NotFoundException('No fcstat binary found among provided path alternatives.')

    if Sfn(Cmd.is_applicable)(bin, executor):
        return partial(Cmd, bin)
    else:
        raise service_loader.NoImplementationException('No fcstat impl found')
示例#11
0
def find(executor, alternatives=None):
    '''Finds fcstat binary and appropriate wrapper implementation

    @param executor: a command executor instance
    @type executor: command.Executor
    @return: fcstat command implementation
    @rtype: fcstat.Cmd
    @raise command.NotFoundException: in case if `fcstat` command is not available
    @raise service_loader.NoImplementationException: in case if no `fcstat` wrapper available
    '''
    alternatives = alternatives or bin_alternatives
    try:
        bin = is_command_available.find_first(alternatives, executor)
    except service_loader.NoImplementationException:
        bin = first(alternatives)
    if not bin:
        raise command.NotFoundException(
            'No fcstat binary found among provided path alternatives.')

    if Sfn(Cmd.is_applicable)(bin, executor):
        return partial(Cmd, bin)
    else:
        raise service_loader.NoImplementationException('No fcstat impl found')