|
|
|
@ -166,17 +166,18 @@ def parse_commands(module, warnings):
|
|
|
|
|
commands = command(module.params['commands'])
|
|
|
|
|
for item in list(commands):
|
|
|
|
|
configure_type = re.match(r'conf(?:\w*)(?:\s+(\w+))?', item['command'])
|
|
|
|
|
if module.check_mode and not item['command'].startswith('show'):
|
|
|
|
|
if module.check_mode:
|
|
|
|
|
if configure_type and configure_type.group(1) not in ('confirm', 'replace', 'revert', 'network'):
|
|
|
|
|
module.fail_json(
|
|
|
|
|
msg='ios_command does not support running config mode '
|
|
|
|
|
'commands. Please use ios_config instead'
|
|
|
|
|
)
|
|
|
|
|
if not item['command'].startswith('show'):
|
|
|
|
|
warnings.append(
|
|
|
|
|
'only show commands are supported when using check mode, not '
|
|
|
|
|
'executing `%s`' % item['command']
|
|
|
|
|
)
|
|
|
|
|
commands.remove(item)
|
|
|
|
|
elif configure_type and configure_type.group(1) not in ('confirm', 'replace', 'revert', 'network'):
|
|
|
|
|
module.fail_json(
|
|
|
|
|
msg='ios_command does not support running config mode '
|
|
|
|
|
'commands. Please use ios_config instead'
|
|
|
|
|
)
|
|
|
|
|
return commands
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|