small code cleanup w/o affecting functionalities
Change-Id: I98c3e403a0a4537afcc8553a7d2d59b791e4b26a
This commit is contained in:
parent
ff2db3c748
commit
89d379e5e7
|
@ -124,7 +124,7 @@ class RequestContext(object):
|
||||||
|
|
||||||
return cls(**values)
|
return cls(**values)
|
||||||
|
|
||||||
def elevated(self, read_deleted=None, overwrite=False):
|
def elevated(self, read_deleted=None):
|
||||||
"""Return a version of this context with admin flag set."""
|
"""Return a version of this context with admin flag set."""
|
||||||
context = copy.copy(self)
|
context = copy.copy(self)
|
||||||
context.is_admin = True
|
context.is_admin = True
|
||||||
|
|
|
@ -38,13 +38,13 @@ class Manager(Thread):
|
||||||
self.managers = {}
|
self.managers = {}
|
||||||
|
|
||||||
def execute(self, command, *args, **kargs):
|
def execute(self, command, *args, **kargs):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def task(self):
|
def task(self):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def doOnEvent(self, event_type, *args, **kargs):
|
def doOnEvent(self, event_type, *args, **kargs):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def getManagers(self):
|
def getManagers(self):
|
||||||
return self.managers
|
return self.managers
|
||||||
|
@ -88,10 +88,10 @@ class Manager(Thread):
|
||||||
is created.
|
is created.
|
||||||
Child classes should override this method.
|
Child classes should override this method.
|
||||||
"""
|
"""
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def getStatus(self):
|
def getStatus(self):
|
||||||
return self.status
|
return self.status
|
||||||
|
|
|
@ -106,7 +106,7 @@ class SynergyObject(object):
|
||||||
|
|
||||||
class SynergySerializer(oslo_messaging.Serializer):
|
class SynergySerializer(oslo_messaging.Serializer):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(oslo_messaging.Serializer, self).__init__()
|
super(SynergySerializer, self).__init__()
|
||||||
|
|
||||||
def serialize_entity(self, context, entity):
|
def serialize_entity(self, context, entity):
|
||||||
if not entity:
|
if not entity:
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Service(object):
|
||||||
signal.signal(signal.SIGTERM, self.sigterm_handler)
|
signal.signal(signal.SIGTERM, self.sigterm_handler)
|
||||||
signal.signal(signal.SIGINT, self.sigterm_handler)
|
signal.signal(signal.SIGINT, self.sigterm_handler)
|
||||||
|
|
||||||
def sigterm_handler(self, signum, frame):
|
def sigterm_handler(self):
|
||||||
global SIGTERM_SENT
|
global SIGTERM_SENT
|
||||||
if not SIGTERM_SENT:
|
if not SIGTERM_SENT:
|
||||||
LOG.info("Shutting down %s" % self.name)
|
LOG.info("Shutting down %s" % self.name)
|
||||||
|
@ -52,13 +52,13 @@ class Service(object):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def wait(self):
|
def wait(self):
|
||||||
pass
|
raise NotImplementedError
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
# Reload config files and restart service
|
# Reload config files and restart service
|
||||||
|
|
|
@ -28,6 +28,6 @@ def import_class(import_str):
|
||||||
try:
|
try:
|
||||||
return getattr(sys.modules[mod_str], class_str)
|
return getattr(sys.modules[mod_str], class_str)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise ImportError('Class %s cannot be found (%s)' %
|
raise ImportError(
|
||||||
(class_str,
|
'Class %s cannot be found (%s)' %
|
||||||
traceback.format_exception(*sys.exc_info())))
|
(class_str, traceback.format_exception(*sys.exc_info())))
|
||||||
|
|
|
@ -73,7 +73,6 @@ class ManagerRPC(object):
|
||||||
% (ex))
|
% (ex))
|
||||||
|
|
||||||
result[name] = manager.getStatus()
|
result[name] = manager.getStatus()
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -97,7 +96,6 @@ class ManagerRPC(object):
|
||||||
% (ex))
|
% (ex))
|
||||||
|
|
||||||
result[name] = manager.getStatus()
|
result[name] = manager.getStatus()
|
||||||
pass
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -367,7 +365,6 @@ class Synergy(service.Service):
|
||||||
"%s" % (ex))
|
"%s" % (ex))
|
||||||
|
|
||||||
result[name]["message"] = "ERROR: %s" % ex
|
result[name]["message"] = "ERROR: %s" % ex
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
result[name]["message"] = "WARN: already started"
|
result[name]["message"] = "WARN: already started"
|
||||||
|
|
||||||
|
@ -416,7 +413,6 @@ class Synergy(service.Service):
|
||||||
% (ex))
|
% (ex))
|
||||||
|
|
||||||
result[name]["message"] = "ERROR: %s" % ex
|
result[name]["message"] = "ERROR: %s" % ex
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
result[name]["message"] = "WARN: already stopped"
|
result[name]["message"] = "WARN: already stopped"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue