Added quote calls to rating processors

Use self.process by default but overriding it can be useful
in case a processors is tracking the state of a calculation
and you don't want to disrupt it.

Change-Id: I9505adfdc65b0decfa3586c0636d091f41ecfb7d
This commit is contained in:
Stéphane Albert
2015-03-16 18:10:28 +01:00
committed by Guillaume Espanel
parent 2db226974d
commit 7e3e1f03e2
2 changed files with 10 additions and 1 deletions

View File

@@ -73,6 +73,15 @@ class BillingProcessorBase(object):
client.cast({}, operation, name=self.module_name)
return module_db.set_state(self.module_name, enabled)
def quote(self, data):
"""Compute rating informations from data.
:param data: An internal CloudKitty dictionary used to describe
resources.
:type data: dict(str:?)
"""
return self.process(data)
@abc.abstractmethod
def process(self, data):
"""Add billing informations to data

View File

@@ -124,7 +124,7 @@ class APIWorker(BaseWorker):
def quote(self, res_data):
for processor in self._processors.values():
processor.process(res_data)
processor.quote(res_data)
price = decimal.Decimal(0)
for res in res_data: