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
def load_config(self, config, commit=False, replace=False, confirm=None,
comment=None, config_format='text', overwrite=False):
if all([replace, overwrite]):
self.raise_exc('setting both replace and overwrite to True is invalid')
comment=None, config_format='text', overwrite=False, merge=False):
if (overwrite or replace) and config_format == 'set':
self.raise_exc('replace/overwrite cannot be True when config_format is `set`')
if replace:
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()