Skip to content

Commit 92f79a6

Browse files
fixcopytorun
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
1 parent 2fa9cb0 commit 92f79a6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

plugins/module_utils/network/netconf/netconf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,12 @@ def sanitize_xml(data):
132132
if key not in IGNORE_XML_ATTRIBUTE:
133133
attribute.pop(key)
134134
return to_text(tostring(tree), errors="surrogate_then_replace").strip()
135+
136+
def copy_config(module, source, target):
137+
conn = get_connection(module)
138+
try:
139+
response = conn.copy_config(source=source, target=target)
140+
except ConnectionError as e:
141+
module.fail_json(msg=to_text(e, errors="surrogate_then_replace").strip())
142+
return response
143+

plugins/modules/netconf_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def main():
598598
conn.validate(target)
599599
if source:
600600
if not module.check_mode:
601-
conn.copy(source, target)
601+
conn.copy_config(source, target)
602602
result["changed"] = True
603603
elif delete:
604604
if not module.check_mode:

0 commit comments

Comments
 (0)