Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log.exception on 404s, noisy when zones are being created #72

Merged
merged 2 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions octodns_ns1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,14 @@ 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,
)
if not e.response or e.response.status_code != 404:
self.log.exception(
"_try: method=%s, args=%s, response=%s, body=%s",
method.__name__,
str(args),
e.response,
e.body,
)
raise


Expand Down
7 changes: 5 additions & 2 deletions tests/test_provider_ns1.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,13 @@ def reset():
provider.apply(plan)
self.assertEqual(zone_create_mock.side_effect, ctx.exception)

# non-existent zone, create
# non-existent zone/404, create
class DummyResponse:
status_code = 404

reset()
zone_retrieve_mock.side_effect = ResourceException(
'server error: zone not found'
'server error: zone not found', response=DummyResponse(), body='x'
)

zone_create_mock.side_effect = ['foo']
Expand Down