summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/vti.py6
-rw-r--r--python/vyos/util.py10
2 files changed, 10 insertions, 6 deletions
diff --git a/python/vyos/ifconfig/vti.py b/python/vyos/ifconfig/vti.py
index 9eafcd11b..a217d28ea 100644
--- a/python/vyos/ifconfig/vti.py
+++ b/python/vyos/ifconfig/vti.py
@@ -33,13 +33,11 @@ class VTIIf(Interface):
# - https://man7.org/linux/man-pages/man8/ip-link.8.html
# - https://man7.org/linux/man-pages/man8/ip-tunnel.8.html
mapping = {
- 'source_address' : 'local',
'source_interface' : 'dev',
- 'remote' : 'remote',
- 'key' : 'key',
}
- cmd = 'ip link add {ifname} type vti'
+ if_id = self.ifname.lstrip('vti')
+ cmd = f'ip link add {self.ifname} type xfrm if_id {if_id}'
for vyos_key, iproute2_key in mapping.items():
# dict_search will return an empty dict "{}" for valueless nodes like
# "parameters.nolearning" - thus we need to test the nodes existence
diff --git a/python/vyos/util.py b/python/vyos/util.py
index c3bf481ea..65c9c2f45 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -231,8 +231,14 @@ def copy_file(source, destination, mkdstdir=False, user=None, group=None):
dirname = os.path.dirname(destination)
if not os.path.isdir(dirname):
makedir(dirname, user, group)
-
- shutil.copyfile(source, destination)
+ try:
+ filename = os.path.basename(source)
+ if not destination.endswith('/'):
+ destination + '/'
+ shutil.copyfile(source, destination + filename)
+ except shutil.SameFileError:
+ # We don't care if we copy the same file again
+ pass
chown(destination, user, group)
def read_json(fname, defaultonfailure=None):