1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

adds warning to dyn provider when it cannot load a trafficdirector

This commit is contained in:
Tim Hughes
2017-10-17 16:16:17 +01:00
parent 7f2c292f5a
commit 8352ab89ef
2 changed files with 6 additions and 2 deletions

View File

@@ -290,7 +290,8 @@ class DynProvider(BaseProvider):
for td in get_all_dsf_services():
try:
fqdn, _type = td.label.split(':', 1)
except ValueError:
except ValueError as e:
self.log.warn("Failed to load TraficDirector '{}': {}".format(td.label, e))
continue
tds[fqdn][_type] = td
self._traffic_directors = dict(tds)

View File

@@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function, \
from dyn.tm.errors import DynectGetError
from dyn.tm.services.dsf import DSFResponsePool
from json import loads
from mock import MagicMock, call, patch
from mock import MagicMock, call, patch, Mock
from unittest import TestCase
from octodns.record import Create, Delete, Record, Update
@@ -601,6 +601,7 @@ class TestDynProviderGeo(TestCase):
provider = DynProvider('test', 'cust', 'user', 'pass', True)
# short-circuit session checking
provider._dyn_sess = True
provider.log.warn = MagicMock()
# no tds
mock.side_effect = [{'data': []}]
@@ -649,6 +650,8 @@ class TestDynProviderGeo(TestCase):
set(tds.keys()))
self.assertEquals(['A'], tds['unit.tests.'].keys())
self.assertEquals(['A'], tds['geo.unit.tests.'].keys())
provider.log.warn.assert_called_with("Failed to load TraficDirector 'something else': need more than 1 value to unpack")
@patch('dyn.core.SessionEngine.execute')
def test_traffic_director_monitor(self, mock):