Skip to content

Commit

Permalink
rename actors
Browse files Browse the repository at this point in the history
  • Loading branch information
matejmatuska committed Nov 14, 2023
1 parent 2595961 commit 5b33872
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from leapp.actors import Actor
from leapp.libraries.actor import dnfconftargetusecustom
from leapp.libraries.actor import applycustomdnfconf
from leapp.tags import ApplicationsPhaseTag, IPUWorkflowTag


class DNFConfTargetUseCustom(Actor):
class ApplyCustomDNFConf(Actor):
"""
Move /etc/leapp/files/dnf.conf to /etc/dnf/dnf.conf if it exists
An actor in FactsPhase copies this file to the target userspace if present.
In such case we also want to use the file on the target system.
"""
name = "dnf_conf_target_use_custom"
name = "apply_custom_dnf_conf"
consumes = ()
produces = ()
tags = (ApplicationsPhaseTag, IPUWorkflowTag)

def process(self):
dnfconftargetusecustom.process()
applycustomdnfconf.process()
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from leapp.libraries.actor import dnfconftargetusecustom
from leapp.libraries.actor import applycustomdnfconf


@pytest.mark.parametrize(
Expand All @@ -17,7 +17,7 @@ def test_copy_correct_dnf_conf(monkeypatch, exists, should_move):
def mocked_run(_):
run_called[0] = True

monkeypatch.setattr(dnfconftargetusecustom, 'run', mocked_run)
monkeypatch.setattr(applycustomdnfconf, 'run', mocked_run)

dnfconftargetusecustom.process()
applycustomdnfconf.process()
assert run_called[0] == should_move
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from leapp.actors import Actor
from leapp.libraries.actor import dnfconfuserspacecopy
from leapp.libraries.actor import copydnfconfintotargetuserspace
from leapp.models import TargetUserSpacePreupgradeTasks
from leapp.tags import FactsPhaseTag, IPUWorkflowTag


class DNFConfUserspaceCopy(Actor):
class CopyDNFConfIntoTargetUserspace(Actor):
"""
Copy dnf.conf to target userspace
Copy dnf.conf into target userspace
Copies /etc/leapp/files/dnf.conf to target userspace. If it isn't available
/etc/dnf/dnf.conf is copied instead. This allows specifying a different
Expand All @@ -15,10 +15,10 @@ class DNFConfUserspaceCopy(Actor):
example is incompatible proxy configuration between RHEL7 and RHEL8 DNF
versions.
"""
name = "dnf_conf_userspace_copy"
name = "copy_dnf_conf_into_target_userspace"
consumes = ()
produces = (TargetUserSpacePreupgradeTasks,)
tags = (FactsPhaseTag, IPUWorkflowTag)

def process(self):
dnfconfuserspacecopy.process()
copydnfconfintotargetuserspace.process()
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from leapp.libraries.actor import dnfconfuserspacecopy
from leapp.libraries.actor import copydnfconfintotargetuserspace
from leapp.libraries.common.testutils import logger_mocked, produce_mocked


Expand All @@ -14,10 +14,10 @@ def test_copy_correct_dnf_conf(monkeypatch, userspace_conf_exists, expected):
monkeypatch.setattr(os.path, "exists", lambda _: userspace_conf_exists)

mocked_produce = produce_mocked()
monkeypatch.setattr(dnfconfuserspacecopy.api, 'produce', mocked_produce)
monkeypatch.setattr(dnfconfuserspacecopy.api, 'current_logger', logger_mocked())
monkeypatch.setattr(copydnfconfintotargetuserspace.api, 'produce', mocked_produce)
monkeypatch.setattr(copydnfconfintotargetuserspace.api, 'current_logger', logger_mocked())

dnfconfuserspacecopy.process()
copydnfconfintotargetuserspace.process()

assert mocked_produce.called == 1
assert len(mocked_produce.model_instances) == 1
Expand Down

0 comments on commit 5b33872

Please sign in to comment.