"""
+# pylint: disable-msg=C0103
+# C0103: Invalid name ganeti-confd
+
import os
import sys
import logging
import time
try:
+ # pylint: disable-msg=E0611
from pyinotify import pyinotify
except ImportError:
import pyinotify
from ganeti import constants
from ganeti import errors
from ganeti import daemon
-from ganeti import ssconf
class ConfdAsyncUDPServer(daemon.AsyncUDPSocket):
# no need to call the parent's constructor
self.watch_manager = watch_manager
self.callback = callback
+ # pylint: disable-msg=E1103
+ # pylint for some reason doesn't see the below constants
self.mask = pyinotify.EventsCodes.IN_IGNORED | \
pyinotify.EventsCodes.IN_MODIFY
self.file = filename
self._ResetTimer()
-def CheckConfd(options, args):
+def CheckConfd(_, args):
"""Initial checks whether to run exit with a failure.
"""
+ if args: # confd doesn't take any arguments
+ print >> sys.stderr, ("Usage: %s [-f] [-d] [-b ADDRESS]" % sys.argv[0])
+ sys.exit(constants.EXIT_FAILURE)
+
# TODO: collapse HMAC daemons handling in daemons GenericMain, when we'll
# have more than one.
if not os.path.isfile(constants.HMAC_CLUSTER_KEY):
sys.exit(constants.EXIT_FAILURE)
-def ExecConfd(options, args):
+def ExecConfd(options, _):
"""Main confd function, executed with PID file held
"""
+ # TODO: clarify how the server and reloader variables work (they are
+ # not used)
+ # pylint: disable-msg=W0612
mainloop = daemon.Mainloop()
# Asyncronous confd UDP server
# If enabling the processor has failed, we can still go on, but confd will
# be disabled
logging.warning("Confd is starting in disabled mode")
- pass
+
server = ConfdAsyncUDPServer(options.bind_address, options.port, processor)
# Configuration reloader