summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-08 20:27:31 +0200
committerGitHub <noreply@github.com>2020-05-08 20:27:31 +0200
commit2f2b28347b9a90953ff2419c03e8e02eab533f45 (patch)
treea5169f3fe6b53386ab93e8fefd5d4b920028506e /python
parent2c69daf94cbe9caf177af8959936917bdc645876 (diff)
parentff58182904882278a004f4d3d8082ec11adbe1ea (diff)
downloadvyos-1x-2f2b28347b9a90953ff2419c03e8e02eab533f45.tar.gz
vyos-1x-2f2b28347b9a90953ff2419c03e8e02eab533f45.zip
Merge pull request #395 from thomas-mangin/T2417
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():