1
1
from leapp .models import CustomTargetRepositoryFile , TargetRepositories
2
2
from leapp .libraries .stdlib import api
3
3
from leapp import reporting
4
- from leapp .libraries .common import rhsm
4
+ from leapp .libraries .common import config , rhsm
5
5
6
6
7
7
_IPU_DOC_URL = ('https://access.redhat.com/documentation/en-us/'
@@ -24,6 +24,10 @@ def _the_custom_repofile_defined():
24
24
return False
25
25
26
26
27
+ def _the_enablerepo_option_used ():
28
+ return config .get_env ('LEAPP_ENABLE_REPOS' , None ) is not None
29
+
30
+
27
31
def process ():
28
32
if not rhsm .skip_rhsm ():
29
33
# getting RH repositories through RHSM; resolved by seatbelts
@@ -33,16 +37,17 @@ def process():
33
37
# rhsm skipped; take your seatbelts please
34
38
is_ctr = _any_custom_repo_defined ()
35
39
is_ctrf = _the_custom_repofile_defined ()
40
+ is_re = _the_enablerepo_option_used ()
36
41
if not is_ctr :
37
42
# no rhsm, no custom repositories.. this will really not work :)
38
43
# TODO: add link to the RH article about use of custom repositories!!
39
44
# NOTE: we can put here now the link to the main document, as this
40
45
# will be described there or at least the link to the right document
41
46
# will be delivered here.
42
47
if is_ctrf :
43
- summary_ctrf = 'The custom repository file has been detected. Maybe it is empty?'
48
+ summary_ctrf = '\n \n The custom repository file has been detected. Maybe it is empty?'
44
49
else :
45
- summary_ctrf = 'The custom repository file has not been detected. '
50
+ summary_ctrf = ''
46
51
reporting .create_report ([
47
52
reporting .Title ('Using RHSM has been skipped but no custom repositories have been delivered.' ),
48
53
reporting .Summary (
@@ -66,17 +71,18 @@ def process():
66
71
reporting .ExternalLink (url = _IPU_DOC_URL , title = 'UPGRADING TO RHEL 8' ),
67
72
reporting .RelatedResource ('file' , CUSTOM_REPO_PATH ),
68
73
])
69
- elif not is_ctrf :
74
+ elif not ( is_ctrf or is_re ) :
70
75
# 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.
72
78
reporting .create_report ([
73
- reporting .Title ('CustomTargetRepositories discovered, but the CustomTargetRepositoryFile is missing .' ),
79
+ reporting .Title ('CustomTargetRepositories discovered, but no new provided mechanisms used .' ),
74
80
reporting .Summary (
75
81
'Red Hat provides now official way how to use custom'
76
82
' 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? '
80
86
),
81
87
reporting .Remediation (hint = (
82
88
'Follow the new simple way to enable custom repositories'
0 commit comments