From 1cb8d376041d2cc64ee2bcfc07da3e0885cb90d0 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 26 Nov 2008 16:49:33 +0000 Subject: [PATCH] ganeti-masterd: create RUN_GANETI_DIR as well Since we're not sure ganeti-noded has started yet, we need to create RUN_GANETI_DIR before SOCKET_DIR as well, with the proper permissions. Reviewed-by: imsnah --- daemons/ganeti-masterd | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index e187a924a..538a0ffc9 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -438,12 +438,18 @@ def main(): if not CheckAgreement(): return - try: - os.mkdir(constants.SOCKET_DIR, constants.SOCKET_DIR_MODE) - except EnvironmentError, err: - if err.errno != errno.EEXIST: - raise errors.GenericError("Cannot create socket directory" - " '%s': %s" % (constants.SOCKET_DIR, err)) + dirs = [(constants.RUN_GANETI_DIR, constants.RUN_DIRS_MODE), + (constants.SOCKET_DIR, constants.SOCKET_DIR_MODE), + ] + for dir, mode in dirs: + try: + os.mkdir(dir, mode) + except EnvironmentError, err: + if err.errno != errno.EEXIST: + raise errors.GenericError("Cannot create needed directory" + " '%s': %s" % (constants.SOCKET_DIR, err)) + if not os.path.isdir(dir): + raise errors.GenericError("%s is not a directory" % dir) # This is safe to do as the pid file guarantees against # concurrent execution. -- GitLab