Merge pull request #4698 from privateip/ios_config

removes state argument from ios_config
This commit is contained in:
Peter Sprygada 2016-09-04 09:23:24 -04:00 committed by GitHub
commit eae87e21d9

View file

@ -174,15 +174,6 @@ options:
default: no
choices: ['yes', 'no']
version_added: "2.2"
state:
description:
- This argument specifies whether or not the running-config is
present on the remote device. When set to I(absent) the
running-config on the remote device is erased.
required: false
default: no
choices: ['yes', 'no']
version_added: "2.2"
"""
EXAMPLES = """
@ -247,11 +238,6 @@ from ansible.module_utils.ios import NetworkModule, NetworkError
from ansible.module_utils.netcfg import NetworkConfig, dumps
from ansible.module_utils.netcli import Command
def invoke(name, *args, **kwargs):
func = globals().get(name)
if func:
return func(*args, **kwargs)
def check_args(module, warnings):
if module.params['parents']:
if not module.params['lines'] or module.params['src']:
@ -304,7 +290,7 @@ def load_config(module, commands, result):
result['changed'] = module.params['update'] != 'check'
result['updates'] = commands.split('\n')
def present(module, result):
def run(module, result):
match = module.params['match']
replace = module.params['replace']
@ -341,11 +327,6 @@ def present(module, result):
if module.params['save'] and not module.check_mode:
module.config.save_config()
def absent(module, result):
if not module.check_mode:
module.cli('write erase')
result['changed'] = True
def main():
argument_spec = dict(
@ -371,8 +352,6 @@ def main():
default=dict(type='bool', default=False),
save=dict(type='bool', default=False),
state=dict(choices=['present', 'absent'], default='present')
)
mutually_exclusive = [('lines', 'src')]
@ -382,8 +361,6 @@ def main():
mutually_exclusive=mutually_exclusive,
supports_check_mode=True)
state = module.params['state']
if module.params['force'] is True:
module.params['match'] = 'none'
@ -396,7 +373,7 @@ def main():
result['__backup__'] = module.config.get_config()
try:
invoke(state, module, result)
run(module, result)
except NetworkError:
load_backup(module)
exc = get_exception()