Skip to content

Commit

Permalink
OpenSslConfigScanner: Do not run on EL7
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Jelen <[email protected]>
  • Loading branch information
Jakuje authored and pirat89 committed Feb 10, 2025
1 parent 9627f28 commit f8cc12e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import errno

from leapp.libraries.common.config import version
from leapp.libraries.common.rpms import check_file_modification
from leapp.libraries.stdlib import api
from leapp.models import OpenSslConfig, OpenSslConfigBlock, OpenSslConfigPair
Expand Down Expand Up @@ -87,6 +88,11 @@ def scan_config(producer):
Parse openssl.cnf file to create OpenSslConfig message.
"""

if version.get_source_major_version() == '7':
# Apply this only for EL 8+ as we are not interested about this
# on EL 7 anymore (moved from el8toel9)
return

# direct access to configuration file
output = read_config()
config = parse_config(output)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from leapp.libraries.actor.readconf import parse_config, produce_config, strip_whitespace_and_comments
from leapp.libraries.common.config import version
from leapp.models import OpenSslConfig, OpenSslConfigBlock, OpenSslConfigPair

testdata = (
Expand Down Expand Up @@ -141,6 +142,15 @@ def fake_producer(*args):
assert cfg.blocks[2].pairs[0].value == "/etc/crypto-policies/back-ends/opensslcnf.config"


def test_actor_execution(current_actor_context):
@pytest.mark.parametrize(('source_version', 'should_run'), [
('7', False),
('8', True),
('9', True),
])
def test_actor_execution(monkeypatch, current_actor_context, source_version, should_run):
monkeypatch.setattr(version, 'get_source_major_version', lambda: source_version)
current_actor_context.run()
assert current_actor_context.consume(OpenSslConfig)
if should_run:
assert current_actor_context.consume(OpenSslConfig)
else:
assert not current_actor_context.consume(OpenSslConfig)

0 comments on commit f8cc12e

Please sign in to comment.