mirror of
https://github.com/certbot/certbot.git
synced 2026-06-04 06:15:36 -04:00
Fix linting/coverage issues
This commit is contained in:
parent
aecb2690c8
commit
7742f69407
3 changed files with 9 additions and 8 deletions
|
|
@ -31,14 +31,14 @@ OVERRIDE_CLASSES: Dict[str, Type[configurator.ApacheConfigurator]] = {
|
|||
}
|
||||
|
||||
|
||||
def rhel_derived_os(os_name) -> bool:
|
||||
def rhel_derived_os(os_name: str) -> bool:
|
||||
"""
|
||||
Returns whether the given OS is RHEL derived, i.e. tracks RHEL's versioning
|
||||
scheme, and thus should use our CentOS configurator
|
||||
"""
|
||||
return os_name in [
|
||||
"cloudlinux",
|
||||
"centos", "centos linux",
|
||||
"cloudlinux",
|
||||
"ol", "oracle",
|
||||
"rhel", "redhatenterpriseserver", "red hat enterprise linux server",
|
||||
"scientific", "scientific linux",
|
||||
|
|
@ -56,6 +56,9 @@ def get_configurator() -> Type[configurator.ApacheConfigurator]:
|
|||
if os_name == 'fedora' and util.parse_loose_version(os_version) < min_version:
|
||||
return override_centos.OldCentOSConfigurator
|
||||
|
||||
# For CentOS and other RHEL-like distros (that use RHEL's versioning
|
||||
# scheme), Apache's behavior changed in RHEL v9 (see issue #9386). Determine
|
||||
# whether we're using the newer or older overrides class based on the version
|
||||
if rhel_derived_os(os_name):
|
||||
old = util.parse_loose_version(os_version) < util.parse_loose_version('9')
|
||||
if old:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class BaseCentOSConfigurator(configurator.ApacheConfigurator):
|
||||
"""CentOS specific ApacheConfigurator override class"""
|
||||
"""Base class for CentOS specific ApacheConfigurator override class"""
|
||||
|
||||
def config_test(self) -> None:
|
||||
"""
|
||||
|
|
@ -134,7 +134,7 @@ class BaseCentOSConfigurator(configurator.ApacheConfigurator):
|
|||
|
||||
|
||||
class CentOSConfigurator(BaseCentOSConfigurator):
|
||||
|
||||
"""CentOS/RHEL-like overrides for CentOS version 9 and above"""
|
||||
OS_DEFAULTS = OsOptions(
|
||||
server_root="/etc/httpd",
|
||||
vhost_root="/etc/httpd/conf.d",
|
||||
|
|
@ -161,7 +161,7 @@ class CentOSConfigurator(BaseCentOSConfigurator):
|
|||
|
||||
|
||||
class OldCentOSConfigurator(BaseCentOSConfigurator):
|
||||
|
||||
"""CentOS/RHEL-like overrides for CentOS version 8 and below"""
|
||||
OS_DEFAULTS = OsOptions(
|
||||
server_root="/etc/httpd",
|
||||
vhost_root="/etc/httpd/conf.d",
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ class EntryPointTest(unittest.TestCase):
|
|||
with mock.patch("certbot.util.get_os_info") as mock_info:
|
||||
for distro in entrypoint.OVERRIDE_CLASSES:
|
||||
return_value = (distro, "whatever")
|
||||
if distro == 'fedora_old':
|
||||
return_value = ('fedora', '28')
|
||||
elif distro == 'fedora':
|
||||
if distro == 'fedora':
|
||||
return_value = ('fedora', '29')
|
||||
mock_info.return_value = return_value
|
||||
self.assertEqual(entrypoint.get_configurator(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue