コード例 #1
0
def to_commands(module, commands):
    if not isinstance(commands, list):
        raise AssertionError('argument must be of type <list>')

    transform = EntityCollection(module, _COMMAND_SPEC)
    commands = transform(commands)
    return commands
コード例 #2
0
def run_commands(module, commands, check_rc=True):
    connection = get_connection(module)
    transform = EntityCollection(module, command_spec)
    commands = transform(commands)

    responses = list()

    for cmd in commands:
        out = connection.get(**cmd)
        responses.append(to_text(out, errors='surrogate_then_replace'))

    return responses
コード例 #3
0
ファイル: ironware.py プロジェクト: anhdoan-ntt/cisco-aci
def to_commands(module, commands):
    if not isinstance(commands, list):
        raise AssertionError('argument must be of type <list>')

    transform = EntityCollection(module, command_spec)
    commands = transform(commands)

    for index, item in enumerate(commands):
        if module.check_mode and not item['command'].startswith('show'):
            module.warn('only show commands are supported when using check '
                        'mode, not executing `%s`' % item['command'])

    return commands