-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add actor to check for particular cloud package (provided from special repository) to determine whether we are on public cloud. - disable DNF plugin with a message - use the resolved mirrorlist on AWS - copy RHUI data from special Leapp package when on public cloud and running without RHSM - add hybrid (BIOS, UEFI) image grubby workaround
- Loading branch information
Showing
17 changed files
with
511 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from leapp.actors import Actor | ||
from leapp.libraries.common.rpms import has_package | ||
from leapp.models import ( | ||
InstalledRPM, | ||
RHUIInfo, | ||
RequiredTargetUserspacePackages, | ||
DNFPluginInfo | ||
) | ||
from leapp.reporting import Report, create_report | ||
from leapp import reporting | ||
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag | ||
from leapp.libraries.common import rhsm, rhui | ||
|
||
|
||
class CheckRHUI(Actor): | ||
""" | ||
Check if system is using RHUI infrastructure (on public cloud) and send messages to | ||
provide additional data needed for upgrade. | ||
""" | ||
|
||
name = 'checkrhui' | ||
consumes = (InstalledRPM) | ||
produces = (RHUIInfo, RequiredTargetUserspacePackages, Report, DNFPluginInfo) | ||
tags = (ChecksPhaseTag, IPUWorkflowTag) | ||
|
||
def process(self): | ||
for k, v in rhui.RHUI_CLOUD_MAP.items(): | ||
if has_package(InstalledRPM, v['el7_pkg']): | ||
if not rhsm.skip_rhsm(): | ||
create_report([ | ||
reporting.Title('Upgrade initiated with RHSM on public cloud with RHUI infrastructure'), | ||
reporting.Summary( | ||
'Leapp detected this system is on public cloud with RHUI infrastructure ' | ||
'but the process was initiated without "--no-rhsm" command line option. ' | ||
), | ||
reporting.Severity(reporting.Severity.INFO), | ||
reporting.Tags([reporting.Tags.PUBLIC_CLOUD]), | ||
]) | ||
return | ||
# AWS RHUI package is provided and signed by RH but the Azure one not | ||
if not has_package(InstalledRPM, v['leapp_pkg']): | ||
create_report([ | ||
reporting.Title('Package "{}" is missing'.format(v['leapp_pkg'])), | ||
reporting.Summary( | ||
'On {} using RHUI infrastructure, a package "{}" is needed for' | ||
'in-place upgrade'.format(k, v['leapp_pkg']) | ||
), | ||
reporting.Severity(reporting.Severity.HIGH), | ||
reporting.RelatedResource('package', v['leapp_pkg']), | ||
reporting.Flags([reporting.Flags.INHIBITOR]), | ||
reporting.Tags([reporting.Tags.PUBLIC_CLOUD, reporting.Tags.RHUI]), | ||
reporting.Remediation(commands=[['yum', 'install', '-y', v['leapp_pkg']]]) | ||
]) | ||
return | ||
if k == 'aws': | ||
self.produce(DNFPluginInfo(name='amazon-id', disable_in=['upgrade'])) | ||
self.produce(RHUIInfo(provider=k)) | ||
self.produce(RequiredTargetUserspacePackages(packages=[v['el8_pkg']])) | ||
return |
75 changes: 75 additions & 0 deletions
75
repos/system_upgrade/el7toel8/actors/checkrhui/tests/component_test_checkrhui.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import pytest | ||
|
||
from leapp.snactor.fixture import current_actor_context | ||
from leapp.models import ( | ||
InstalledRedHatSignedRPM, | ||
InstalledRPM, | ||
RPM, | ||
RHUIInfo, | ||
RequiredTargetUserspacePackages, | ||
) | ||
from leapp.reporting import Report | ||
from leapp.libraries.common.config import mock_configs | ||
from leapp.libraries.common import rhsm | ||
|
||
|
||
RH_PACKAGER = 'Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>' | ||
|
||
NO_RHUI = [ | ||
RPM(name='yolo', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, arch='noarch', | ||
pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'), | ||
] | ||
|
||
ON_AWS_WITHOUT_LEAPP_PKG = [ | ||
RPM(name='rh-amazon-rhui-client', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, | ||
arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'), | ||
] | ||
|
||
ON_AWS_WITH_LEAPP_PKG = [ | ||
RPM(name='rh-amazon-rhui-client', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, | ||
arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51'), | ||
RPM(name='leapp-rhui-aws', version='0.1', release='1.sm01', epoch='1', packager=RH_PACKAGER, | ||
arch='noarch', pgpsig='RSA/SHA256, Mon 01 Jan 1970 00:00:00 AM -03, Key ID 199e2f91fd431d51') | ||
] | ||
|
||
|
||
def create_modulesfacts(installed_rpm): | ||
return InstalledRPM(items=installed_rpm) | ||
|
||
|
||
def test_actor_no_rhui(current_actor_context): | ||
current_actor_context.feed(create_modulesfacts(installed_rpm=NO_RHUI)) | ||
current_actor_context.run(config_model=mock_configs.CONFIG) | ||
assert not current_actor_context.consume(Report) | ||
assert not current_actor_context.consume(RHUIInfo) | ||
assert not current_actor_context.consume(RequiredTargetUserspacePackages) | ||
|
||
|
||
def test_actor_rhui_without_leapp_package(monkeypatch, current_actor_context): | ||
monkeypatch.setattr(rhsm, 'skip_rhsm', lambda: True) | ||
|
||
current_actor_context.feed(create_modulesfacts(installed_rpm=ON_AWS_WITHOUT_LEAPP_PKG)) | ||
current_actor_context.run(config_model=mock_configs.CONFIG) | ||
assert current_actor_context.consume(Report) | ||
assert not current_actor_context.consume(RHUIInfo) | ||
assert not current_actor_context.consume(RequiredTargetUserspacePackages) | ||
|
||
|
||
def test_actor_rhui_with_leapp_package(monkeypatch, current_actor_context): | ||
monkeypatch.setattr(rhsm, 'skip_rhsm', lambda: True) | ||
|
||
current_actor_context.feed(create_modulesfacts(installed_rpm=ON_AWS_WITH_LEAPP_PKG)) | ||
current_actor_context.run(config_model=mock_configs.CONFIG) | ||
assert not current_actor_context.consume(Report) | ||
assert current_actor_context.consume(RHUIInfo) | ||
assert current_actor_context.consume(RequiredTargetUserspacePackages) | ||
|
||
|
||
def test_actor_without_no_rhsm(monkeypatch, current_actor_context): | ||
monkeypatch.setattr(rhsm, 'skip_rhsm', lambda: False) | ||
|
||
current_actor_context.feed(create_modulesfacts(installed_rpm=ON_AWS_WITH_LEAPP_PKG)) | ||
current_actor_context.run(config_model=mock_configs.CONFIG) | ||
assert current_actor_context.consume(Report) | ||
assert not current_actor_context.consume(RHUIInfo) | ||
assert not current_actor_context.consume(RequiredTargetUserspacePackages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.