Skip to content

Commit

Permalink
Merge pull request #390 from flyingcircusio/fix-dns-lookup-on-provisi…
Browse files Browse the repository at this point in the history
…oning

provisioning: properly catch documented errors for `getaddrinfo`
  • Loading branch information
ctheune authored Sep 19, 2023
2 parents c6a5669 + ce139ea commit 1f28f0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
## 2.4rc2 (unreleased)
----------------------

- Nothing changed yet.
- Fix bug where some rare exceptions (caused by DNS resolvers during provisioning)
bubbled incorrectly and caused spurious deployment errors.


## 2.4rc1 (2023-09-12)
Expand Down
10 changes: 8 additions & 2 deletions src/batou/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ def configure_host(self, host, config):
f" alias override v4 {alias_fqdn} -> {addr}", debug=True
)
batou.utils.resolve_override[alias_fqdn] = addr
except (socket.gaierror, ValueError):
except (OSError, ValueError):
# We used to catch socket.gaierror here, but reading the
# docs correctly it can raise any OSError (and socket and gaierror
# are subclasses)
pass

try:
Expand All @@ -128,7 +131,10 @@ def configure_host(self, host, config):
f" alias override v6 {alias_fqdn} -> {addr}", debug=True
)
batou.utils.resolve_v6_override[alias_fqdn] = addr
except (socket.gaierror, ValueError):
except (OSError, ValueError):
# We used to catch socket.gaierror here, but reading the
# docs correctly it can raise any OSError (and socket and gaierror
# are subclasses)
pass

def summarize(self, host):
Expand Down

0 comments on commit 1f28f0c

Please sign in to comment.