From 0c47be60a697c93ede7fcc4786bc5b220fb722f3 Mon Sep 17 00:00:00 2001 From: Andrew Melton Date: Mon, 24 Jun 2013 16:41:46 -0400 Subject: [PATCH] Finishing up reconciler in auditor --- stacktach/reconciler/__init__.py | 4 ++-- stacktach/reconciler/nova.py | 2 +- tests/unit/test_reconciler.py | 26 ++------------------------ 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/stacktach/reconciler/__init__.py b/stacktach/reconciler/__init__.py index 24852ad..68b7138 100644 --- a/stacktach/reconciler/__init__.py +++ b/stacktach/reconciler/__init__.py @@ -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): diff --git a/stacktach/reconciler/nova.py b/stacktach/reconciler/nova.py index aae40b2..59e5955 100644 --- a/stacktach/reconciler/nova.py +++ b/stacktach/reconciler/nova.py @@ -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} diff --git a/tests/unit/test_reconciler.py b/tests/unit/test_reconciler.py index 7ba5d0d..8ec98fa 100644 --- a/tests/unit/test_reconciler.py +++ b/tests/unit/test_reconciler.py @@ -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', } }