diff --git a/repos/system_upgrade/el9toel10/actors/checkpamuserdb/actor.py b/repos/system_upgrade/el9toel10/actors/checkpamuserdb/actor.py new file mode 100644 index 0000000000..b40e397fa0 --- /dev/null +++ b/repos/system_upgrade/el9toel10/actors/checkpamuserdb/actor.py @@ -0,0 +1,18 @@ +from leapp.actors import Actor +from leapp.models import PamUserDbLocation, Report +from leapp.tags import ChecksPhaseTag, IPUWorkflowTag +from leapp.libraries.actor import checkpamuserdb + + +class CheckPamUserDb(Actor): + """ + Create report with the location of pam_userdb databases + """ + + name = 'check_pam_user_db' + consumes = (PamUserDbLocation,) + produces = (Report,) + tags = (ChecksPhaseTag, IPUWorkflowTag) + + def process(self): + checkpamuserdb.process() diff --git a/repos/system_upgrade/el9toel10/actors/checkpamuserdb/libraries/checkpamuserdb.py b/repos/system_upgrade/el9toel10/actors/checkpamuserdb/libraries/checkpamuserdb.py new file mode 100644 index 0000000000..2f3bf07775 --- /dev/null +++ b/repos/system_upgrade/el9toel10/actors/checkpamuserdb/libraries/checkpamuserdb.py @@ -0,0 +1,22 @@ +from leapp import reporting +from leapp.models import PamUserDbLocation +from leapp.libraries.stdlib import api + + +def process(): + for msg in api.consume(PamUserDbLocation): + locations = msg.locations + + if locations: + reporting.create_report([ + reporting.Title('pam_userdb database will be converted to GDBM'), + reporting.Summary( + 'pam_userdb used BerkeleyDB as the backend database format. ' + 'It is no longer maintained as open source, so it will be ' + 'replaced by GDBM. The upgrade process has detected ' + 'BerkeleyDB databases [{}] in the system and it will proceed to ' + 'convert them.'.format(locations)), + reporting.Severity(reporting.Severity.INFO), + reporting.Groups([reporting.Groups.SECURITY]), + reporting.Groups([reporting.Groups.AUTHENTICATION]) + ]) diff --git a/repos/system_upgrade/el9toel10/actors/checkpamuserdb/tests/component_test_checkpamuserdb.py b/repos/system_upgrade/el9toel10/actors/checkpamuserdb/tests/component_test_checkpamuserdb.py new file mode 100644 index 0000000000..5d7fcad283 --- /dev/null +++ b/repos/system_upgrade/el9toel10/actors/checkpamuserdb/tests/component_test_checkpamuserdb.py @@ -0,0 +1,30 @@ +import os + +import pytest + +from leapp.reporting import Report +from leapp.models import PamUserDbLocation +from leapp.libraries.actor import checkpamuserdb + + +def test_process_no_location(current_actor_context): + current_actor_context.feed( + PamUserDbLocation( + locations=[] + ) + ) + current_actor_context.run() + assert not current_actor_context.consume(Report) + + +def test_process_locations(current_actor_context): + current_actor_context.feed( + PamUserDbLocation( + locations=['/tmp/db1', '/tmp/db2'] + ) + ) + current_actor_context.run() + report = current_actor_context.consume(Report) + assert report + assert ('pam_userdb database will be converted to GDBM' + in report[0].report['title'])