From 17c61836f067a45342db30f3f807c3dc310a33c4 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Fri, 22 May 2009 15:35:46 +0100 Subject: [PATCH] IsNormAbsPath and users, use "normalized" term We used to refer to normalized paths as "normal" which might be confusing. This fixes the syntax in all current IsNormAbsPath users and in the docstring. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/hypervisor/hv_base.py | 4 ++-- lib/utils.py | 2 +- test/ganeti.utils_unittest.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py index c055a7231..fd675f1b2 100644 --- a/lib/hypervisor/hv_base.py +++ b/lib/hypervisor/hv_base.py @@ -49,11 +49,11 @@ from ganeti import utils # _CHECK values # must be afile -_FILE_CHECK = (utils.IsNormAbsPath, "must be an absolute normal path", +_FILE_CHECK = (utils.IsNormAbsPath, "must be an absolute normalized path", os.path.isfile, "not found or not a file") # must be a directory -_DIR_CHECK = (utils.IsNormAbsPath, "must be an absolute normal path", +_DIR_CHECK = (utils.IsNormAbsPath, "must be an absolute normalized path", os.path.isdir, "not found or not a directory") # nice wrappers for users diff --git a/lib/utils.py b/lib/utils.py index 3a0881fcd..48388babe 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -1786,7 +1786,7 @@ def SetupLogging(logfile, debug=False, stderr_logging=False, program="", raise def IsNormAbsPath(path): - """Check whether a path is absolute and also "normal". + """Check whether a path is absolute and also normalized This avoids things like /dir/../../other/path to be valid. diff --git a/test/ganeti.utils_unittest.py b/test/ganeti.utils_unittest.py index 433bfe336..846b4b446 100755 --- a/test/ganeti.utils_unittest.py +++ b/test/ganeti.utils_unittest.py @@ -975,10 +975,10 @@ class TestIsAbsNormPath(unittest.TestCase): def _pathTestHelper(self, path, result): if result: self.assert_(IsNormAbsPath(path), - "Path %s should be absolute and normal" % path) + "Path %s should result absolute and normalized" % path) else: self.assert_(not IsNormAbsPath(path), - "Path %s should not be absolute and normal" % path) + "Path %s should not result absolute and normalized" % path) def testBase(self): self._pathTestHelper('/etc', True) -- GitLab