Skip to content

Commit

Permalink
Merge pull request #4764 from VladimirSlavik/master-remove-deprecated…
Browse files Browse the repository at this point in the history
…-conf

Drop deprecated conf: kickstart_modules, addons_enabled
  • Loading branch information
VladimirSlavik committed Jul 19, 2023
2 parents dda9ace + cf3190b commit 8b79b4f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 152 deletions.
8 changes: 0 additions & 8 deletions data/anaconda.conf
Expand Up @@ -6,14 +6,6 @@
# Run Anaconda in the debugging mode.
debug = False

# Enable Anaconda addons.
# This option is deprecated and will be removed in in the future.
# addons_enabled = True

# List of enabled Anaconda DBus modules.
# This option is deprecated and will be removed in in the future.
# kickstart_modules =

# List of Anaconda DBus modules that can be activated.
# Supported patterns: MODULE.PREFIX.*, MODULE.NAME
activatable_modules =
Expand Down
11 changes: 11 additions & 0 deletions docs/release-notes/removed-conf-options.rst
@@ -0,0 +1,11 @@
:Type: Configuration
:Summary: Deprecated configuration options are now removed

:Description:
The following deprecated configuration file options are now removed:

- ``kickstart_modules``
- ``addons_enabled``

:Links:
- https://github.com/rhinstaller/anaconda/pull/4764
47 changes: 2 additions & 45 deletions pyanaconda/core/configuration/anaconda.py
Expand Up @@ -18,7 +18,6 @@
# Author(s): Vendula Poncova <vponcova@redhat.com>
#
import os
import warnings

from pyanaconda.anaconda_loggers import get_module_logger
from pyanaconda.core.configuration.bootloader import BootloaderSection, BootloaderType
Expand Down Expand Up @@ -63,27 +62,7 @@ def activatable_modules(self):
:return: a list of patterns
"""
return self._get_deprecated_activatable_modules() \
or self._get_option("activatable_modules").split()

def _get_deprecated_activatable_modules(self):
"""Get a list of deprecated activatable modules.
FIXME: This is a temporary workaround.
If the kickstart_modules option is defined in the configuration,
allow to activate only the specified modules and Anaconda addons.
"""
if not self._has_option("kickstart_modules"):
return []

warnings.warn(
"The kickstart_modules configuration option is deprecated and "
"will be removed in in the future.", DeprecationWarning
)

return self._get_option("kickstart_modules").split() \
+ ["org.fedoraproject.Anaconda.Addons.*"]
return self._get_option("activatable_modules").split()

@property
def forbidden_modules(self):
Expand All @@ -96,29 +75,7 @@ def forbidden_modules(self):
:return: a list of patterns
"""
return self._get_deprecated_forbidden_modules() \
+ self._get_option("forbidden_modules").split()

def _get_deprecated_forbidden_modules(self):
"""Get a list of deprecated forbidden modules.
FIXME: This is a temporary workaround.
If the addons_enabled option is defined in the configuration
and set to False, don't allow to activate Anaconda addons.
"""
if not self._has_option("addons_enabled"):
return []

warnings.warn(
"The addons_enabled configuration option is deprecated and "
"will be removed in in the future.", DeprecationWarning
)

if self._get_option("addons_enabled", bool):
return []

return ["org.fedoraproject.Anaconda.Addons.*"]
return self._get_option("forbidden_modules").split()

@property
def optional_modules(self):
Expand Down
99 changes: 0 additions & 99 deletions tests/unit_tests/pyanaconda_tests/core/test_configuration.py
Expand Up @@ -384,112 +384,13 @@ def test_activatable_modules(self):
for pattern in conf.anaconda.activatable_modules:
self._check_pattern(pattern)

def test_kickstart_modules(self):
"""Test the kickstart_modules option."""
message = \
"The kickstart_modules configuration option is " \
"deprecated and will be removed in in the future."

conf = AnacondaConfiguration.from_defaults()
assert conf.anaconda.activatable_modules == [
"org.fedoraproject.Anaconda.Modules.*",
"org.fedoraproject.Anaconda.Addons.*"

]

parser = conf.get_parser()
parser.read_string(dedent("""
[Anaconda]
kickstart_modules =
org.fedoraproject.Anaconda.Modules.Timezone
org.fedoraproject.Anaconda.Modules.Localization
org.fedoraproject.Anaconda.Modules.Security
"""))

with pytest.warns(DeprecationWarning, match=message):
activatable_modules = conf.anaconda.activatable_modules

assert activatable_modules == [
"org.fedoraproject.Anaconda.Modules.Timezone",
"org.fedoraproject.Anaconda.Modules.Localization",
"org.fedoraproject.Anaconda.Modules.Security",
"org.fedoraproject.Anaconda.Addons.*"
]

for pattern in activatable_modules:
self._check_pattern(pattern)

def test_forbidden_modules(self):
"""Test the forbidden_modules option."""
conf = AnacondaConfiguration.from_defaults()

for pattern in conf.anaconda.forbidden_modules:
self._check_pattern(pattern)

def test_addons_enabled_modules(self):
"""Test the addons_enabled option."""
message = \
"The addons_enabled configuration option is " \
"deprecated and will be removed in in the future."

conf = AnacondaConfiguration.from_defaults()
assert conf.anaconda.forbidden_modules == []

parser = conf.get_parser()
parser.read_string(dedent("""
[Anaconda]
forbidden_modules =
org.fedoraproject.Anaconda.Modules.Timezone
org.fedoraproject.Anaconda.Modules.Localization
org.fedoraproject.Anaconda.Modules.Security
"""))

assert conf.anaconda.forbidden_modules == [
"org.fedoraproject.Anaconda.Modules.Timezone",
"org.fedoraproject.Anaconda.Modules.Localization",
"org.fedoraproject.Anaconda.Modules.Security",
]

parser.read_string(dedent("""
[Anaconda]
addons_enabled = True
"""))

with pytest.warns(DeprecationWarning, match=message):
forbidden_modules = conf.anaconda.forbidden_modules

assert forbidden_modules == [
"org.fedoraproject.Anaconda.Modules.Timezone",
"org.fedoraproject.Anaconda.Modules.Localization",
"org.fedoraproject.Anaconda.Modules.Security",
]

parser.read_string(dedent("""
[Anaconda]
addons_enabled = False
"""))

with pytest.warns(DeprecationWarning, match=message):
forbidden_modules = conf.anaconda.forbidden_modules

assert forbidden_modules == [
"org.fedoraproject.Anaconda.Addons.*",
"org.fedoraproject.Anaconda.Modules.Timezone",
"org.fedoraproject.Anaconda.Modules.Localization",
"org.fedoraproject.Anaconda.Modules.Security",
]

for pattern in forbidden_modules:
self._check_pattern(pattern)

def test_optional_modules(self):
"""Test the optional_modules option."""
conf = AnacondaConfiguration.from_defaults()
Expand Down

0 comments on commit 8b79b4f

Please sign in to comment.