add common argument save_config to vyos_argument_spec

This commit is contained in:
Peter Sprygada 2016-07-11 05:56:42 -07:00
parent 7960aa92ed
commit f0c8c9e55c

View file

@ -20,8 +20,8 @@
import itertools import itertools
import re import re
from ansible.module_utils.network import NetworkError, get_module, get_exception from ansible.module_utils.network import NetworkModule, NetworkError
from ansible.module_utils.network import register_transport, to_list from ansible.module_utils.network import register_transport, to_list, get_exception
from ansible.module_utils.network import Command, NetCli from ansible.module_utils.network import Command, NetCli
from ansible.module_utils.netcfg import NetworkConfig from ansible.module_utils.netcfg import NetworkConfig
from ansible.module_utils.shell import Shell, ShellError, HAS_PARAMIKO from ansible.module_utils.shell import Shell, ShellError, HAS_PARAMIKO
@ -30,14 +30,14 @@ DEFAULT_COMMENT = 'configured by vyos_config'
def argument_spec(): def argument_spec():
return dict( return dict(
config=dict(), running_config=dict(aliases=['config']),
comment=dict(default=DEFAULT_COMMENT), comment=dict(default=DEFAULT_COMMENT),
save=dict(type='bool') save_config=dict(type='bool', aliases=['save'])
) )
vyos_argument_spec = argument_spec() vyos_argument_spec = argument_spec()
def get_config(module): def get_config(module):
contents = module.params['config'] contents = module.params['running_config']
if not contents: if not contents:
contents = str(module.config.get_config()).split('\n') contents = str(module.config.get_config()).split('\n')
module.params['config'] = contents module.params['config'] = contents
@ -74,7 +74,7 @@ def load_candidate(module, candidate):
updates = diff_config(candidate, config) updates = diff_config(candidate, config)
comment = module.params['comment'] comment = module.params['comment']
save = module.params['save'] save = module.params['save_config']
result = dict(changed=False) result = dict(changed=False)