removes state argument from ops_config module
this removes the state argument from ops_config. The state argument should not have been there
This commit is contained in:
parent
c071273fbf
commit
8eab599ade
1 changed files with 2 additions and 25 deletions
|
@ -141,15 +141,6 @@ options:
|
||||||
default: no
|
default: no
|
||||||
choices: ['yes', 'no']
|
choices: ['yes', 'no']
|
||||||
version_added: "2.2"
|
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 = """
|
EXAMPLES = """
|
||||||
|
@ -207,11 +198,6 @@ from ansible.module_utils.openswitch import NetworkModule, NetworkError
|
||||||
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
from ansible.module_utils.netcfg import NetworkConfig, dumps
|
||||||
from ansible.module_utils.netcli import Command
|
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):
|
def check_args(module, warnings):
|
||||||
if module.params['parents']:
|
if module.params['parents']:
|
||||||
if not module.params['lines'] or module.params['src']:
|
if not module.params['lines'] or module.params['src']:
|
||||||
|
@ -253,7 +239,7 @@ def load_config(module, commands, result):
|
||||||
result['changed'] = module.params['update'] != 'check'
|
result['changed'] = module.params['update'] != 'check'
|
||||||
result['updates'] = commands.split('\n')
|
result['updates'] = commands.split('\n')
|
||||||
|
|
||||||
def present(module, result):
|
def run(module, result):
|
||||||
match = module.params['match']
|
match = module.params['match']
|
||||||
replace = module.params['replace']
|
replace = module.params['replace']
|
||||||
|
|
||||||
|
@ -282,11 +268,6 @@ def present(module, result):
|
||||||
if module.params['save'] and not module.check_mode:
|
if module.params['save'] and not module.check_mode:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
|
|
||||||
def absent(module, result):
|
|
||||||
if not module.check_mode:
|
|
||||||
module.cli('erase startup-config')
|
|
||||||
result['changed'] = True
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
|
@ -313,8 +294,6 @@ def main():
|
||||||
|
|
||||||
save=dict(type='bool', default=False),
|
save=dict(type='bool', default=False),
|
||||||
|
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
|
||||||
|
|
||||||
# ops_config is only supported over Cli transport so force
|
# ops_config is only supported over Cli transport so force
|
||||||
# the value of transport to be cli
|
# the value of transport to be cli
|
||||||
transport=dict(default='cli', choices=['cli'])
|
transport=dict(default='cli', choices=['cli'])
|
||||||
|
@ -327,8 +306,6 @@ def main():
|
||||||
mutually_exclusive=mutually_exclusive,
|
mutually_exclusive=mutually_exclusive,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
state = module.params['state']
|
|
||||||
|
|
||||||
if module.params['force'] is True:
|
if module.params['force'] is True:
|
||||||
module.params['match'] = 'none'
|
module.params['match'] = 'none'
|
||||||
|
|
||||||
|
@ -341,7 +318,7 @@ def main():
|
||||||
result['__backup__'] = module.config.get_config()
|
result['__backup__'] = module.config.get_config()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
invoke(state, module, result)
|
run(module, result)
|
||||||
except NetworkError:
|
except NetworkError:
|
||||||
exc = get_exception()
|
exc = get_exception()
|
||||||
module.fail_json(msg=str(exc))
|
module.fail_json(msg=str(exc))
|
||||||
|
|
Loading…
Reference in a new issue