Hoist duplicated AlarmService initialization to super

api_client and _load_evaluators was duplicated across each service,
presumably needlessly*.

Discovered via pylint complaining about use of unitialize api_client
member.

* If there is a specific need for it to be otherwise that needs to
be made more clear.

Change-Id: I118edce87abd0e26ee0e963f44535b355a3752d0
This commit is contained in:
Chris Dent 2014-10-14 17:49:57 +01:00
parent 42c3d487aa
commit 69ac3d15bc
1 changed files with 5 additions and 6 deletions

View File

@ -60,6 +60,11 @@ class AlarmService(object):
EXTENSIONS_NAMESPACE = "ceilometer.alarm.evaluator"
def __init__(self):
super(AlarmService, self).__init__()
self._load_evaluators()
self.api_client = None
def _load_evaluators(self):
self.evaluators = extension.ExtensionManager(
namespace=self.EXTENSIONS_NAMESPACE,
@ -118,8 +123,6 @@ class AlarmEvaluationService(AlarmService, os_service.Service):
def __init__(self):
super(AlarmEvaluationService, self).__init__()
self._load_evaluators()
self.api_client = None
self.partition_coordinator = coordination.PartitionCoordinator()
def start(self):
@ -155,8 +158,6 @@ class SingletonAlarmService(AlarmService, os_service.Service):
def __init__(self):
super(SingletonAlarmService, self).__init__()
self._load_evaluators()
self.api_client = None
def start(self):
super(SingletonAlarmService, self).start()
@ -182,8 +183,6 @@ class PartitionedAlarmService(AlarmService, os_service.Service):
self.rpc_server = messaging.get_rpc_server(
transport, cfg.CONF.alarm.partition_rpc_topic, self)
self._load_evaluators()
self.api_client = None
self.partition_coordinator = alarm_coordination.PartitionCoordinator()
def start(self):