mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use merge operation for load configuration in junos modules (#28369)
* Change load configuration operation from replace to merge
This commit is contained in:
parent
bc66faa328
commit
ceef4f97ed
11 changed files with 12 additions and 10 deletions
|
@ -161,7 +161,7 @@ def main():
|
||||||
ele = map_obj_to_ele(module, want, top)
|
ele = map_obj_to_ele(module, want, top)
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
diff = load_config(module, tostring(ele), warnings, action='replace')
|
diff = load_config(module, tostring(ele), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -184,7 +184,7 @@ def main():
|
||||||
diff = None
|
diff = None
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
for req in requests:
|
for req in requests:
|
||||||
diff = load_config(module, tostring(req), warnings, action='replace')
|
diff = load_config(module, tostring(req), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -327,7 +327,7 @@ def main():
|
||||||
diff = None
|
diff = None
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
for req in requests:
|
for req in requests:
|
||||||
diff = load_config(module, tostring(req), warnings, action='replace')
|
diff = load_config(module, tostring(req), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -184,7 +184,7 @@ def main():
|
||||||
ele = map_obj_to_ele(module, want, top, param=item)
|
ele = map_obj_to_ele(module, want, top, param=item)
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
diff = load_config(module, tostring(ele), warnings, action='replace')
|
diff = load_config(module, tostring(ele), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -145,7 +145,7 @@ def main():
|
||||||
ele = map_obj_to_ele(module, want, top, param=item)
|
ele = map_obj_to_ele(module, want, top, param=item)
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
diff = load_config(module, tostring(ele), warnings, action='replace')
|
diff = load_config(module, tostring(ele), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -267,7 +267,7 @@ def main():
|
||||||
diff = None
|
diff = None
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
for req in requests:
|
for req in requests:
|
||||||
diff = load_config(module, tostring(req), warnings, action='replace')
|
diff = load_config(module, tostring(req), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -219,7 +219,7 @@ def main():
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
for req in requests:
|
for req in requests:
|
||||||
diff = load_config(module, tostring(req), warnings, action='replace')
|
diff = load_config(module, tostring(req), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -173,7 +173,7 @@ def main():
|
||||||
ele = map_obj_to_ele(module, want, top)
|
ele = map_obj_to_ele(module, want, top)
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
diff = load_config(module, tostring(ele), warnings, action='replace')
|
diff = load_config(module, tostring(ele), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -298,6 +298,8 @@ def main():
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if module.params['purge']:
|
if module.params['purge']:
|
||||||
kwargs['action'] = 'replace'
|
kwargs['action'] = 'replace'
|
||||||
|
else:
|
||||||
|
kwargs['action'] = 'merge'
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
diff = load_config(module, tostring(ele), warnings, **kwargs)
|
diff = load_config(module, tostring(ele), warnings, **kwargs)
|
||||||
|
|
|
@ -207,7 +207,7 @@ def main():
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
for req in requests:
|
for req in requests:
|
||||||
diff = load_config(module, tostring(req), warnings, action='replace')
|
diff = load_config(module, tostring(req), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
|
@ -245,7 +245,7 @@ def main():
|
||||||
|
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
for req in requests:
|
for req in requests:
|
||||||
diff = load_config(module, tostring(req), warnings, action='replace')
|
diff = load_config(module, tostring(req), warnings, action='merge')
|
||||||
|
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
if diff:
|
if diff:
|
||||||
|
|
Loading…
Reference in a new issue