From 3639a5610b590a64d6d56bee81dddd252994cfe5 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Wed, 6 May 2020 16:45:44 +0100 Subject: validator: T2417: try to make the code clearer --- python/vyos/util.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'python') 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(): -- cgit v1.2.3