Commit b6b45e0d authored by Guido Trotter's avatar Guido Trotter
Browse files

Convert os api version file name to a constant


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 84e3f66f
......@@ -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()
......
......@@ -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/"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment