Finishing up reconciler in auditor

This commit is contained in:
Andrew Melton 2013-06-24 16:41:46 -04:00
parent 2f8b54be74
commit 0c47be60a6
3 changed files with 5 additions and 27 deletions

View File

@ -44,9 +44,9 @@ class Reconciler(object):
def __init__(self, config, client=None, region_mapping=None):
self.config = config
self.client = (client or Reconciler._load_client(config))
self.client = (client or Reconciler.load_client(config))
self.region_mapping = (region_mapping or
Reconciler._load_region_mapping(config))
Reconciler.load_region_mapping(config))
@classmethod
def load_client(cls, config):

View File

@ -17,7 +17,7 @@ class JSONBridgeClient(object):
self.config = config
def _url_for_region(self, region):
return self.config['url'] + self.config['regions'][region]
return self.config['url'] + self.config['databases'][region]
def _do_query(self, region, query):
data = {'sql': query}

View File

@ -32,28 +32,6 @@ from stacktach.reconciler import nova
from tests.unit import utils
from tests.unit.utils import INSTANCE_ID_1
config = {
'nova': {
'RegionOne': {
'username': 'demo',
'project_id': '111111',
'api_key': 'some_key',
'auth_url': 'https://identity.example.com/v2.0',
'auth_system': 'keystone',
},
'RegionTwo': {
'username': 'demo',
'project_id': '111111',
'api_key': 'some_key',
'auth_url': 'https://identity.example.com/v2.0',
'auth_system': 'keystone',
},
},
'region_mapping_loc': '/etc/stacktach/region_mapping.json',
}
region_mapping = {
'RegionOne.prod.cell1': 'RegionOne',
'RegionTwo.prod.cell1': 'RegionTwo',
@ -65,7 +43,7 @@ class ReconcilerTestCase(unittest.TestCase):
self.mox = mox.Mox()
self.client = self.mox.CreateMockAnything()
self.client.src_str = 'mocked_client'
self.reconciler = reconciler.Reconciler(config,
self.reconciler = reconciler.Reconciler({},
client=self.client,
region_mapping=region_mapping)
self.mox.StubOutWithMock(models, 'RawData', use_mock_anything=True)
@ -215,7 +193,7 @@ json_bridge_config = {
'url': 'http://json_bridge.example.com/query/',
'username': 'user',
'password': 'pass',
'regions': {
'databases': {
'RegionOne': 'nova',
}
}