Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch ios default config is defaults is enabled #39741

Merged
merged 1 commit into from
May 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/ansible/modules/network/ios/ios_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,13 @@ def load_banners(module, banners):
run_commands(module, ['\n'])


def get_running_config(module, current_config=None):
def get_running_config(module, current_config=None, flags=None):
contents = module.params['running_config']

if not contents:
if not module.params['defaults'] and current_config:
contents, banners = extract_banners(current_config.config_text)
else:
flags = get_defaults_flag(module) if module.params['defaults'] else []
contents = get_config(module, flags=flags)
contents, banners = extract_banners(contents)
return NetworkConfig(indent=1, contents=contents), banners
Expand Down Expand Up @@ -445,9 +445,10 @@ def main():
result['warnings'] = warnings

config = None
flags = get_defaults_flag(module) if module.params['defaults'] else []

if module.params['backup'] or (module._diff and module.params['diff_against'] == 'running'):
contents = get_config(module)
contents = get_config(module, flags=flags)
config = NetworkConfig(indent=1, contents=contents)
if module.params['backup']:
result['__backup__'] = contents
Expand All @@ -460,7 +461,7 @@ def main():
candidate, want_banners = get_candidate(module)

if match != 'none':
config, have_banners = get_running_config(module, config)
config, have_banners = get_running_config(module, config, flags=flags)
path = module.params['parents']
configobjs = candidate.difference(config, path=path, match=match, replace=replace)
else:
Expand Down