minor bug fixes in eos_template

* fixes issue where configuration was not being loaded (#4704)
* fixes issue where defaults were not included when argument was set to True

tested on EOS 4.15.4F
This commit is contained in:
Peter Sprygada 2016-09-06 22:51:40 -04:00
parent 8e0cc9d370
commit e464599632

View file

@ -122,8 +122,9 @@ from ansible.module_utils.eos import NetworkModule
def get_config(module): def get_config(module):
config = module.params.get('config') config = module.params.get('config')
defaults = module.params['include_defaults']
if not config and not module.params['force']: if not config and not module.params['force']:
config = module.config.get_config() config = module.config.get_config(include_defaults=defaults)
return config return config
def filter_exit(commands): def filter_exit(commands):
@ -198,7 +199,12 @@ def main():
commands = filter_exit(commands) commands = filter_exit(commands)
if commands: if commands:
if not module.check_mode: if not module.check_mode:
response = module.config(commands, replace=replace) response = module.config.load_config(commands,
replace=replace,
session='eos_template',
commit=True)
module.cli('no configure session eos_template')
result['responses'] = response result['responses'] = response
result['changed'] = True result['changed'] = True