From b6b45e0d6251cd870658be36004ce4116f4a63c6 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Fri, 2 Oct 2009 11:26:24 +0100 Subject: [PATCH] Convert os api version file name to a constant Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Olivier Tharan <olive@google.com> --- lib/backend.py | 10 +++++----- lib/constants.py | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 24825c4c8..75457e36c 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1598,17 +1598,17 @@ def _OSOndiskAPIVersion(name, os_dir): data holding either the vaid versions or an error message """ - api_file = os.path.sep.join([os_dir, "ganeti_api_version"]) + api_file = os.path.sep.join([os_dir, constants.OS_API_FILE]) try: st = os.stat(api_file) except EnvironmentError, err: - return False, ("Required file 'ganeti_api_version' file not" - " found under path %s: %s" % (os_dir, _ErrnoOrStr(err))) + return False, ("Required file '%s' not found under path %s: %s" % + (constants.OS_API_FILE, os_dir, _ErrnoOrStr(err))) if not stat.S_ISREG(stat.S_IFMT(st.st_mode)): - return False, ("File 'ganeti_api_version' file at %s is not" - " a regular file" % os_dir) + return False, ("File '%s' in %s is not a regular file" % + (constants.OS_API_FILE, os_dir)) try: api_versions = utils.ReadFile(api_file).splitlines() diff --git a/lib/constants.py b/lib/constants.py index 0278cfeee..636832b19 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -328,6 +328,8 @@ OS_SCRIPT_RENAME = 'rename' OS_SCRIPTS = frozenset([OS_SCRIPT_CREATE, OS_SCRIPT_IMPORT, OS_SCRIPT_EXPORT, OS_SCRIPT_RENAME]) +OS_API_FILE = 'ganeti_api_version' + # ssh constants SSH_INITD_SCRIPT = _autoconf.SSH_INITD_SCRIPT SSH_CONFIG_DIR = "/etc/ssh/" -- GitLab