Commit a5ce2ea2 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Migrate lib/server/*.py from constants to pathutils



File system paths moved from constants to pathutils.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 80ec9f96
......@@ -49,6 +49,7 @@ from ganeti import constants
from ganeti import errors
from ganeti import daemon
from ganeti import netutils
from ganeti import pathutils
class ConfdAsyncUDPServer(daemon.AsyncUDPSocket):
......@@ -114,7 +115,7 @@ class ConfdConfigurationReloader(object):
self.last_notification = 0
# Asyncronous inotify handler for config changes
cfg_file = constants.CLUSTER_CONF_FILE
cfg_file = pathutils.CLUSTER_CONF_FILE
self.wm = pyinotify.WatchManager()
self.inotify_handler = asyncnotifier.SingleFileEventHandler(self.wm,
self.OnInotify,
......@@ -249,8 +250,8 @@ def CheckConfd(_, args):
# TODO: collapse HMAC daemons handling in daemons GenericMain, when we'll
# have more than one.
if not os.path.isfile(constants.CONFD_HMAC_KEY):
print >> sys.stderr, "Need HMAC key %s to run" % constants.CONFD_HMAC_KEY
if not os.path.isfile(pathutils.CONFD_HMAC_KEY):
print >> sys.stderr, "Need HMAC key %s to run" % pathutils.CONFD_HMAC_KEY
sys.exit(constants.EXIT_FAILURE)
# TODO: once we have a cluster param specifying the address family
......
......@@ -58,6 +58,7 @@ from ganeti import netutils
from ganeti import objects
from ganeti import query
from ganeti import runtime
from ganeti import pathutils
CLIENT_REQUEST_WORKERS = 16
......@@ -527,9 +528,9 @@ def _SetWatcherPause(until):
"""
if until is None:
utils.RemoveFile(constants.WATCHER_PAUSEFILE)
utils.RemoveFile(pathutils.WATCHER_PAUSEFILE)
else:
utils.WriteFile(constants.WATCHER_PAUSEFILE,
utils.WriteFile(pathutils.WATCHER_PAUSEFILE,
data="%d\n" % (until, ))
return until
......@@ -689,10 +690,10 @@ def PrepMasterd(options, _):
"""
# This is safe to do as the pid file guarantees against
# concurrent execution.
utils.RemoveFile(constants.MASTER_SOCKET)
utils.RemoveFile(pathutils.MASTER_SOCKET)
mainloop = daemon.Mainloop()
master = MasterServer(constants.MASTER_SOCKET, options.uid, options.gid)
master = MasterServer(pathutils.MASTER_SOCKET, options.uid, options.gid)
return (mainloop, master)
......@@ -712,7 +713,7 @@ def ExecMasterd(options, args, prep_data): # pylint: disable=W0613
finally:
rpc.Shutdown()
finally:
utils.RemoveFile(constants.MASTER_SOCKET)
utils.RemoveFile(pathutils.MASTER_SOCKET)
logging.info("Clean master daemon shutdown")
......
......@@ -48,6 +48,7 @@ from ganeti import utils
from ganeti import storage
from ganeti import serializer
from ganeti import netutils
from ganeti import pathutils
import ganeti.http.server # pylint: disable=W0611
......@@ -447,7 +448,7 @@ class NodeRequestHandler(http.server.HttpServerHandler):
Note that as opposed to export_info, which may query data about an
export in any path, this only queries the standard Ganeti path
(constants.EXPORT_DIR).
(pathutils.EXPORT_DIR).
"""
return backend.ListExports()
......@@ -1090,6 +1091,6 @@ def Main():
default=True, action="store_false")
daemon.GenericMain(constants.NODED, parser, CheckNoded, PrepNoded, ExecNoded,
default_ssl_cert=constants.NODED_CERT_FILE,
default_ssl_key=constants.NODED_CERT_FILE,
default_ssl_cert=pathutils.NODED_CERT_FILE,
default_ssl_key=pathutils.NODED_CERT_FILE,
console_logging=True)
......@@ -47,6 +47,7 @@ from ganeti import luxi
from ganeti import serializer
from ganeti import compat
from ganeti import utils
from ganeti import pathutils
from ganeti.rapi import connector
import ganeti.http.auth # pylint: disable=W0611
......@@ -325,10 +326,10 @@ def PrepRapi(options, _):
handler = RemoteApiHandler(users.Get)
# Setup file watcher (it'll be driven by asyncore)
SetupFileWatcher(constants.RAPI_USERS_FILE,
compat.partial(users.Load, constants.RAPI_USERS_FILE))
SetupFileWatcher(pathutils.RAPI_USERS_FILE,
compat.partial(users.Load, pathutils.RAPI_USERS_FILE))
users.Load(constants.RAPI_USERS_FILE)
users.Load(pathutils.RAPI_USERS_FILE)
server = \
http.server.HttpServer(mainloop, options.bind_address, options.port,
......@@ -360,5 +361,5 @@ def Main():
constants.RELEASE_VERSION)
daemon.GenericMain(constants.RAPI, parser, CheckRapi, PrepRapi, ExecRapi,
default_ssl_cert=constants.RAPI_CERT_FILE,
default_ssl_key=constants.RAPI_CERT_FILE)
default_ssl_cert=pathutils.RAPI_CERT_FILE,
default_ssl_key=pathutils.RAPI_CERT_FILE)
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