Skip to content

Commit 3d51ad4

Browse files
committed
[RFE enablerepo 2/2] update texts and checktargetrepos
Update texts to inform even about the second way how to enable custom target repositories using the --enablerepo option for leapp, and do not produce info report about those new way, when already used this or custom repofile one.
1 parent 91931bb commit 3d51ad4

File tree

3 files changed

+40
-24
lines changed

3 files changed

+40
-24
lines changed

repos/system_upgrade/el7toel8/actors/checktargetrepos/actor.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@ class Checktargetrepos(Actor):
88
"""
99
Check whether target yum repositories are specified.
1010
11-
RHSM | CTR | CTRF || result
12-
-----+-----+------++-------
13-
Yes | --- | ---- || -
14-
-----+-----+------++-------
15-
No | No | No || inhibit
16-
-----+-----+------++-------
17-
No | No | Yes || inhibit
18-
-----+-----+------++-------
19-
No | Yes | No || warn/report info
20-
-----+-----+------++-------
21-
No | Yes | Yes || -
11+
RHSM | ER | CTR | CTRF || result
12+
-----+----+-----+------++-------
13+
Yes | -- | --- | ---- || -
14+
-----+----+-----+------++-------
15+
No | -- | No | No || inhibit
16+
-----+----+-----+------++-------
17+
No | -- | No | Yes || inhibit
18+
-----+----+-----+------++-------
19+
No | No | Yes | No || warn/report info
20+
-----+----+-----+------++-------
21+
No | No | Yes | Yes || -
22+
-----+----+-----+------++-------
23+
No | Yes| Yes | No || -
24+
-----+----+-----+------++-------
25+
No | Yes| Yes | Yes || -
2226
27+
ER - config.get_env('LEAPP_ENABLE_REPOS') is non-empty
2328
CTR - CustomTargetRepositories found
2429
CTRF - the expected CustomTargetRepositoryFile found
2530
RHSM - RHSM is used (it is not skipped)

repos/system_upgrade/el7toel8/actors/checktargetrepos/libraries/library.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from leapp.models import CustomTargetRepositoryFile, TargetRepositories
22
from leapp.libraries.stdlib import api
33
from leapp import reporting
4-
from leapp.libraries.common import rhsm
4+
from leapp.libraries.common import config, rhsm
55

66

77
_IPU_DOC_URL = ('https://access.redhat.com/documentation/en-us/'
@@ -24,6 +24,10 @@ def _the_custom_repofile_defined():
2424
return False
2525

2626

27+
def _the_enablerepo_option_used():
28+
return config.get_env('LEAPP_ENABLE_REPOS', None) is not None
29+
30+
2731
def process():
2832
if not rhsm.skip_rhsm():
2933
# getting RH repositories through RHSM; resolved by seatbelts
@@ -33,16 +37,17 @@ def process():
3337
# rhsm skipped; take your seatbelts please
3438
is_ctr = _any_custom_repo_defined()
3539
is_ctrf = _the_custom_repofile_defined()
40+
is_re = _the_enablerepo_option_used()
3641
if not is_ctr:
3742
# no rhsm, no custom repositories.. this will really not work :)
3843
# TODO: add link to the RH article about use of custom repositories!!
3944
# NOTE: we can put here now the link to the main document, as this
4045
# will be described there or at least the link to the right document
4146
# will be delivered here.
4247
if is_ctrf:
43-
summary_ctrf = 'The custom repository file has been detected. Maybe it is empty?'
48+
summary_ctrf = '\n\nThe custom repository file has been detected. Maybe it is empty?'
4449
else:
45-
summary_ctrf = 'The custom repository file has not been detected.'
50+
summary_ctrf = ''
4651
reporting.create_report([
4752
reporting.Title('Using RHSM has been skipped but no custom repositories have been delivered.'),
4853
reporting.Summary(
@@ -66,17 +71,18 @@ def process():
6671
reporting.ExternalLink(url=_IPU_DOC_URL, title='UPGRADING TO RHEL 8'),
6772
reporting.RelatedResource('file', CUSTOM_REPO_PATH),
6873
])
69-
elif not is_ctrf:
74+
elif not (is_ctrf or is_re):
7075
# Some custom repositories have been discovered, but the custom repo
71-
# file not. Inform about the official recommended way.
76+
# file not - neither the --enablerepo option is usedd. Inform about
77+
# the official recommended way.
7278
reporting.create_report([
73-
reporting.Title('CustomTargetRepositories discovered, but the CustomTargetRepositoryFile is missing.'),
79+
reporting.Title('CustomTargetRepositories discovered, but no new provided mechanisms used.'),
7480
reporting.Summary(
7581
'Red Hat provides now official way how to use custom'
7682
' repositories during the in-place upgrade through'
77-
' the referred custom repository file. The CustomTargetRepositories'
78-
' have been detected (from custom actors?) but the repository'
79-
' file not.'
83+
' the referred custom repository file or through the'
84+
' --enablerepo option for leapp. The CustomTargetRepositories'
85+
' have been produced from custom (own) actors?'
8086
),
8187
reporting.Remediation(hint=(
8288
'Follow the new simple way to enable custom repositories'

repos/system_upgrade/el7toel8/actors/targetuserspacecreator/libraries/userspacegen.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ def gather_target_repositories(context):
332332
' your current subscription is entitled to install the requested target version {version}.'
333333
' In case the --no-rhsm option (or the LEAPP_NO_RHSM=1 environment variable is set)'
334334
' ensure the custom repository file is provided regarding the documentation with'
335-
' properly defined repositories.'
335+
' properly defined repositories or in case repositories are already defined'
336+
' in any repofiles under /etc/yum.repos.d/ directory, use the --enablerepo option'
337+
' for leapp'
336338
).format(version=api.current_actor().configuration.version.target)
337339
}
338340
)
@@ -341,11 +343,14 @@ def gather_target_repositories(context):
341343
message='Some required custom target repositories are not available.',
342344
details={'hint': (
343345
' The most probably you are using custom or third party actor'
344-
' that produces CustomTargetRepository message. However,'
345-
' inside the upgrade container, we are not able to find such'
346+
' that produces CustomTargetRepository message or you did a typo'
347+
' in one of repoids specified on command line for the leapp --enablerepo'
348+
' option.'
349+
' Inside the upgrade container, we are not able to find such'
346350
' repository inside any repository file. Consider use of the'
347351
' custom repository file regarding the official upgrade'
348-
' documentation.'
352+
' documentation or check whether you did not do a typo in any'
353+
' repoids you specified for the --enablerepo option of leapp.'
349354
)
350355
}
351356
)

0 commit comments

Comments
 (0)