1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add 'update' parameter in junos_config module (#19046)

* Add update parameter in junos_config module which supports
configuration action like merge, replace and overwrite.

* Add support for replace along with update
argument
This commit is contained in:
Ganesh Nalawade 2016-12-21 22:26:55 +05:30 committed by Nathaniel Case
parent dd0257b995
commit 0d06b77970

View file

@ -175,23 +175,12 @@ class Netconf(object):
return ele return ele
def load_config(self, config, commit=False, replace=False, confirm=None, def load_config(self, config, commit=False, replace=False, confirm=None,
comment=None, config_format='text', overwrite=False): comment=None, config_format='text', overwrite=False, merge=False):
if (overwrite or replace) and config_format == 'set':
if all([replace, overwrite]): self.raise_exc('replace/overwrite cannot be True when config_format is `set`')
self.raise_exc('setting both replace and overwrite to True is invalid')
if replace: if replace:
merge = False merge = False
overwrite = False
elif overwrite:
merge = False
overwrite = True
else:
merge = True
overwrite = False
if overwrite and config_format == 'set':
self.raise_exc('replace cannot be True when config_format is `set`')
self.lock_config() self.lock_config()