summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-06-25 23:04:31 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2022-06-29 01:37:59 +0200
commit0d5ac59894ae7c10bd9d69047fa7098de66f835f (patch)
tree2b36fb68c41ddb4f13a087833edd774cd841f005 /python/vyos/util.py
parent56457c9f35c5273d1d7ad679f37278c6cf2c77b0 (diff)
downloadvyos-1x-0d5ac59894ae7c10bd9d69047fa7098de66f835f.tar.gz
vyos-1x-0d5ac59894ae7c10bd9d69047fa7098de66f835f.zip
openvpn: T4485: Accept multiple `tls ca-certificate` values
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r--python/vyos/util.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 0d62fbfe9..bee5d7aec 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -197,7 +197,7 @@ def read_file(fname, defaultonfailure=None):
return defaultonfailure
raise e
-def write_file(fname, data, defaultonfailure=None, user=None, group=None, mode=None):
+def write_file(fname, data, defaultonfailure=None, user=None, group=None, mode=None, append=False):
"""
Write content of data to given fname, should defaultonfailure be not None,
it is returned on failure to read.
@@ -212,7 +212,7 @@ def write_file(fname, data, defaultonfailure=None, user=None, group=None, mode=N
try:
""" Write a file to string """
bytes = 0
- with open(fname, 'w') as f:
+ with open(fname, 'w' if not append else 'a') as f:
bytes = f.write(data)
chown(fname, user, group)
chmod(fname, mode)