Replace aliased OSError.

As of Python 3.3, various errors were merged into OSError.
https://docs.python.org/3/library/exceptions.html#OSError
This commit is contained in:
Mads Jensen
2024-12-14 11:15:26 +01:00
parent 0f0000298b
commit 57b5942fc3
23 changed files with 46 additions and 46 deletions
@@ -295,7 +295,7 @@ class ApacheConfigurator(common.Configurator):
try:
with open(ssl_module_location, mode="rb") as f:
contents = f.read()
except IOError as error:
except OSError as error:
logger.debug(str(error), exc_info=True)
return None
return contents
@@ -928,7 +928,7 @@ class ApacheConfigurator(common.Configurator):
try:
socket.inet_aton(addr.get_addr())
return socket.gethostbyaddr(addr.get_addr())[0]
except (socket.error, socket.herror, socket.timeout):
except (OSError, socket.herror, socket.timeout):
pass
return ""
@@ -1523,7 +1523,7 @@ class ApacheConfigurator(common.Configurator):
# activation (it's not included as default)
if not self.parser.parsed_in_current(ssl_fp):
self.parser.parse_file(ssl_fp)
except IOError:
except OSError:
logger.critical("Error writing/reading to file in make_vhost_ssl", exc_info=True)
raise errors.PluginError("Unable to write/read in make_vhost_ssl")
@@ -153,7 +153,7 @@ class ApacheParser:
try:
# This is a noop save
self.aug.save()
except (RuntimeError, IOError):
except (OSError, RuntimeError):
self._log_save_errors(ex_errs)
# Erase Save Notes
self.configurator.save_notes = ""
@@ -198,7 +198,7 @@ class ApacheParser:
ex_errs = self.aug.match("/augeas//error")
try:
self.aug.save()
except IOError:
except OSError:
self._log_save_errors(ex_errs)
raise