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:
parent
dd0257b995
commit
0d06b77970
1 changed files with 3 additions and 14 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue