Skip to content

Commit

Permalink
Use merge operation for load configuration in junos modules (ansible#…
Browse files Browse the repository at this point in the history
…28369)

*  Change load configuration operation from replace to merge
  • Loading branch information
ganeshrn authored Aug 18, 2017
1 parent bc66faa commit ceef4f9
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def main():
ele = map_obj_to_ele(module, want, top)

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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_l3_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def main():
diff = None
with locked_config(module):
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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_linkagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def main():
diff = None
with locked_config(module):
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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_lldp.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def main():
ele = map_obj_to_ele(module, want, top, param=item)

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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_lldp_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def main():
ele = map_obj_to_ele(module, want, top, param=item)

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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def main():
diff = None
with locked_config(module):
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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_static_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def main():

with locked_config(module):
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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def main():
ele = map_obj_to_ele(module, want, top)

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
if diff:
Expand Down
2 changes: 2 additions & 0 deletions lib/ansible/modules/network/junos/junos_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ def main():
kwargs = {}
if module.params['purge']:
kwargs['action'] = 'replace'
else:
kwargs['action'] = 'merge'

with locked_config(module):
diff = load_config(module, tostring(ele), warnings, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def main():

with locked_config(module):
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
if diff:
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/junos/junos_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def main():

with locked_config(module):
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
if diff:
Expand Down

0 comments on commit ceef4f9

Please sign in to comment.