Skip to content
Snippets Groups Projects
Commit 1cb8d376 authored by Guido Trotter's avatar Guido Trotter
Browse files

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
parent 817a030d
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment