|
|
|
@ -149,18 +149,11 @@ def map_params_to_obj(module):
|
|
|
|
def load_config(module, config, commit=False):
|
|
|
|
def load_config(module, config, commit=False):
|
|
|
|
conn = get_connection(module)
|
|
|
|
conn = get_connection(module)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
resp = conn.edit_config(to_list(config) + ['top'])
|
|
|
|
resp = conn.edit_config(to_list(config) + ['top'], commit)
|
|
|
|
except ConnectionError as exc:
|
|
|
|
except ConnectionError as exc:
|
|
|
|
module.fail_json(msg=to_text(exc, errors='surrogate_then_replace'))
|
|
|
|
module.fail_json(msg=to_text(exc, errors='surrogate_then_replace'))
|
|
|
|
|
|
|
|
|
|
|
|
diff = resp.get('diff', '')
|
|
|
|
diff = resp.get('diff', '')
|
|
|
|
if diff:
|
|
|
|
|
|
|
|
if commit:
|
|
|
|
|
|
|
|
commit_configuration(module)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
discard_changes(module)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return to_text(diff, errors='surrogate_then_replace').strip()
|
|
|
|
return to_text(diff, errors='surrogate_then_replace').strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|