-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use RHSM in the nspawn container
- it is not safe to use subscription-manager in a container https://bugzilla.redhat.com/show_bug.cgi?id=1702691 Co-authored-by: Petr Stodulka <[email protected]>
- Loading branch information
Showing
19 changed files
with
778 additions
and
260 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
8 changes: 4 additions & 4 deletions
8
repos/system_upgrade/el7toel8/actors/checkrhsmsku/tests/test_rhsmsku.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
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
21 changes: 11 additions & 10 deletions
21
repos/system_upgrade/el7toel8/actors/enablerhsmreposonrhel8/libraries/library.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
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
22 changes: 22 additions & 0 deletions
22
repos/system_upgrade/el7toel8/actors/reportsettargetrelease/libraries/library.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,22 @@ | ||
from leapp import reporting | ||
from leapp.libraries.stdlib import api | ||
|
||
|
||
def process(): | ||
# TODO: skip if users are not using rhsm at all (RHELLEAPP-201) | ||
target_version = api.current_actor().configuration.version.target | ||
reporting.create_report([ | ||
reporting.Title( | ||
'The subscription-manager release is going to be set after the upgrade'), | ||
reporting.Summary( | ||
'After the upgrade has completed the release of the subscription-manager will be set to {release}.' | ||
' This will ensure that you will receive and keep the version you choose to upgrade to.' | ||
.format(release=target_version) | ||
), | ||
reporting.Severity(reporting.Severity.LOW), | ||
reporting.Remediation( | ||
hint='If you wish to receive updates for the latest released version of RHEL 8, run `subscription-manager' | ||
' release --unset` after the upgrade.'), | ||
reporting.Tags([reporting.Tags.UPGRADE_PROCESS]), | ||
reporting.RelatedResource('package', 'subscription-manager') | ||
]) |
40 changes: 22 additions & 18 deletions
40
...s/system_upgrade/el7toel8/actors/reportsettargetrelease/tests/test_targetreleasereport.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 |
---|---|---|
@@ -1,24 +1,28 @@ | ||
from leapp.models import Report, TargetRHSMInfo | ||
from collections import namedtuple | ||
|
||
import pytest | ||
|
||
def test_report_target_version(current_actor_context): | ||
current_actor_context.feed(TargetRHSMInfo(release='6.6.6')) | ||
current_actor_context.run() | ||
reports = list(current_actor_context.consume(Report)) | ||
assert reports and len(reports) == 1 | ||
report_fields = reports[0].report | ||
assert '6.6.6' in report_fields.get('summary', '') | ||
assert '6.6.6' in report_fields.get('title', '') | ||
from leapp import reporting | ||
from leapp.libraries.actor import library | ||
from leapp.libraries.common.testutils import create_report_mocked | ||
from leapp.libraries.stdlib import api | ||
|
||
|
||
def test_report_target_version_notset(current_actor_context): | ||
current_actor_context.feed(TargetRHSMInfo(release='')) | ||
current_actor_context.run() | ||
reports = list(current_actor_context.consume(Report)) | ||
assert not reports | ||
class CurrentActorMocked(object): | ||
def __init__(self, src_ver='7.6', dst_ver='8.1'): | ||
|
||
version = namedtuple('Version', ['source', 'target'])(src_ver, dst_ver) | ||
self.configuration = namedtuple('configuration', ['version'])(version) | ||
|
||
def test_report_target_version_nomessage(current_actor_context): | ||
current_actor_context.run() | ||
reports = list(current_actor_context.consume(Report)) | ||
assert not reports | ||
def __call__(self): | ||
return self | ||
|
||
|
||
@pytest.mark.parametrize('version', ['8.{}'.format(i) for i in range(4)]) | ||
def test_report_target_version(monkeypatch, version): | ||
monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(dst_ver=version)) | ||
monkeypatch.setattr(reporting, 'create_report', create_report_mocked()) | ||
SUMMARY_FMT = 'will be set to {}.' | ||
library.process() | ||
assert reporting.create_report.called == 1 | ||
assert SUMMARY_FMT.format(version) in reporting.create_report.report_fields['summary'] |
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
4 changes: 1 addition & 3 deletions
4
repos/system_upgrade/el7toel8/actors/scansubscriptionmanagerinfo/libraries/scanrhsm.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 |
---|---|---|
@@ -1,12 +1,10 @@ | ||
from leapp.models import SourceRHSMInfo | ||
from leapp.libraries.common import rhsm | ||
from leapp.libraries.common.mounting import NotIsolatedActions | ||
from leapp.libraries.stdlib import api | ||
|
||
|
||
@rhsm.with_rhsm | ||
def scan(): | ||
info = SourceRHSMInfo() | ||
context = NotIsolatedActions(base_dir='/') | ||
rhsm.scan_rhsm_info(context, info) | ||
info = rhsm.scan_rhsm_info(context) | ||
api.produce(info) |
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.