summaryrefslogtreecommitdiffstats
path: root/nova/twistd.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/twistd.py')
-rw-r--r--nova/twistd.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/nova/twistd.py b/nova/twistd.py
index df75b603e..3ec0ff61e 100644
--- a/nova/twistd.py
+++ b/nova/twistd.py
@@ -53,6 +53,7 @@ class TwistdServerOptions(ServerOptions):
class FlagParser(object):
# this is a required attribute for gflags
syntactic_help = ''
+
def __init__(self, parser):
self.parser = parser
@@ -63,6 +64,7 @@ class FlagParser(object):
def WrapTwistedOptions(wrapped):
class TwistedOptionsToFlags(wrapped):
subCommands = None
+
def __init__(self):
# NOTE(termie): _data exists because Twisted stuff expects
# to be able to set arbitrary things that are
@@ -80,7 +82,8 @@ def WrapTwistedOptions(wrapped):
def _absorbFlags(self):
twistd_flags = []
- reflect.accumulateClassList(self.__class__, 'optFlags', twistd_flags)
+ reflect.accumulateClassList(self.__class__, 'optFlags',
+ twistd_flags)
for flag in twistd_flags:
key = flag[0].replace('-', '_')
if hasattr(FLAGS, key):
@@ -89,7 +92,8 @@ def WrapTwistedOptions(wrapped):
def _absorbParameters(self):
twistd_params = []
- reflect.accumulateClassList(self.__class__, 'optParameters', twistd_params)
+ reflect.accumulateClassList(self.__class__, 'optParameters',
+ twistd_params)
for param in twistd_params:
key = param[0].replace('-', '_')
if hasattr(FLAGS, key):
@@ -103,13 +107,14 @@ def WrapTwistedOptions(wrapped):
def _absorbHandlers(self):
twistd_handlers = {}
- reflect.addMethodNamesToDict(self.__class__, twistd_handlers, "opt_")
+ reflect.addMethodNamesToDict(self.__class__, twistd_handlers,
+ "opt_")
# NOTE(termie): Much of the following is derived/copied from
# twisted.python.usage with the express purpose of
# providing compatibility
for name in twistd_handlers.keys():
- method = getattr(self, 'opt_'+name)
+ method = getattr(self, 'opt_' + name)
takesArg = not usage.flagFunction(method, name)
doc = getattr(method, '__doc__', None)
@@ -125,7 +130,6 @@ def WrapTwistedOptions(wrapped):
flags.DEFINE_string(name, None, doc)
self._paramHandlers[name] = method
-
def _doHandlers(self):
for flag, handler in self._flagHandlers.iteritems():
if self[flag]:
@@ -195,7 +199,7 @@ def stop(pidfile):
"""
# Get the pid from the pidfile
try:
- pf = file(pidfile,'r')
+ pf = file(pidfile, 'r')
pid = int(pf.read().strip())
pf.close()
except IOError:
@@ -204,7 +208,8 @@ def stop(pidfile):
if not pid:
message = "pidfile %s does not exist. Daemon not running?\n"
sys.stderr.write(message % pidfile)
- return # not an error in a restart
+ # Not an error in a restart
+ return
# Try killing the daemon process
try: