summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-05-06 16:45:44 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-05-06 16:45:44 +0100
commit3639a5610b590a64d6d56bee81dddd252994cfe5 (patch)
treebffd67c3bc929523e99ab3ad3c11097bbffc5d8d /python
parent142a6b99f0da5cf474f03572e1e6c2f8772c77c9 (diff)
downloadvyos-1x-3639a5610b590a64d6d56bee81dddd252994cfe5.tar.gz
vyos-1x-3639a5610b590a64d6d56bee81dddd252994cfe5.zip
validator: T2417: try to make the code clearer
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index e598e0ff3..381cd0358 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -389,12 +389,9 @@ def get_cfg_group_id():
def file_is_persistent(path):
import re
- if not re.match(r'^(/config|/opt/vyatta/etc/config)', os.path.dirname(path)):
- warning = "Warning: file {0} is outside the /config directory\n".format(path)
- warning += "It will not be automatically migrated to a new image on system update"
- return (False, warning)
- else:
- return (True, None)
+ location = r'^(/config|/opt/vyatta/etc/config)'
+ absolute = os.path.abspath(os.path.dirname(path))
+ return re.match(location,absolute)
def commit_in_progress():