Skip to content

Commit

Permalink
Merge pull request #71 from jdickson0296/log-provider-requests
Browse files Browse the repository at this point in the history
Added logging for ResourceException error in NS1 requests.
  • Loading branch information
ross authored Oct 26, 2023
2 parents 586d8b2 + 6ee9cf8 commit f0ec25e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions octodns_ns1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,15 @@ def _try(self, method, *args, **kwargs):
)
sleep(period)
tries -= 1
except ResourceException as e:
self.log.exception(
"_try: method=%s, args=%s, response=%s, body=%s",
method.__name__,
str(args),
e.response,
e.body,
)
raise


class Ns1Provider(BaseProvider):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_provider_ns1.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def reset():
provider._client.reset_caches()
zone_retrieve_mock.reset_mock()
zone_retrieve_mock.side_effect = None
zone_retrieve_mock.__name__ = 'retrieve'
record_retrieve_mock.reset_mock()
record_retrieve_mock.side_effect = None

Expand Down Expand Up @@ -470,7 +471,9 @@ def reset():
provider._client.reset_caches()
record_retrieve_mock.reset_mock()
zone_create_mock.reset_mock()
zone_create_mock.__name__ = 'create'
zone_retrieve_mock.reset_mock()
zone_retrieve_mock.__name__ = 'retrieve'

# Fails, general error
reset()
Expand Down

0 comments on commit f0ec25e

Please sign in to comment.