Skip to content

Commit

Permalink
[RFE enablerepo 2/2] update texts and checktargetrepos
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pirat89 committed Apr 16, 2020
1 parent 91931bb commit 3d51ad4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 24 deletions.
27 changes: 16 additions & 11 deletions repos/system_upgrade/el7toel8/actors/checktargetrepos/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ class Checktargetrepos(Actor):
"""
Check whether target yum repositories are specified.
RHSM | CTR | CTRF || result
-----+-----+------++-------
Yes | --- | ---- || -
-----+-----+------++-------
No | No | No || inhibit
-----+-----+------++-------
No | No | Yes || inhibit
-----+-----+------++-------
No | Yes | No || warn/report info
-----+-----+------++-------
No | Yes | Yes || -
RHSM | ER | CTR | CTRF || result
-----+----+-----+------++-------
Yes | -- | --- | ---- || -
-----+----+-----+------++-------
No | -- | No | No || inhibit
-----+----+-----+------++-------
No | -- | No | Yes || inhibit
-----+----+-----+------++-------
No | No | Yes | No || warn/report info
-----+----+-----+------++-------
No | No | Yes | Yes || -
-----+----+-----+------++-------
No | Yes| Yes | No || -
-----+----+-----+------++-------
No | Yes| Yes | Yes || -
ER - config.get_env('LEAPP_ENABLE_REPOS') is non-empty
CTR - CustomTargetRepositories found
CTRF - the expected CustomTargetRepositoryFile found
RHSM - RHSM is used (it is not skipped)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from leapp.models import CustomTargetRepositoryFile, TargetRepositories
from leapp.libraries.stdlib import api
from leapp import reporting
from leapp.libraries.common import rhsm
from leapp.libraries.common import config, rhsm


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


def _the_enablerepo_option_used():
return config.get_env('LEAPP_ENABLE_REPOS', None) is not None


def process():
if not rhsm.skip_rhsm():
# getting RH repositories through RHSM; resolved by seatbelts
Expand All @@ -33,16 +37,17 @@ def process():
# rhsm skipped; take your seatbelts please
is_ctr = _any_custom_repo_defined()
is_ctrf = _the_custom_repofile_defined()
is_re = _the_enablerepo_option_used()
if not is_ctr:
# no rhsm, no custom repositories.. this will really not work :)
# TODO: add link to the RH article about use of custom repositories!!
# NOTE: we can put here now the link to the main document, as this
# will be described there or at least the link to the right document
# will be delivered here.
if is_ctrf:
summary_ctrf = 'The custom repository file has been detected. Maybe it is empty?'
summary_ctrf = '\n\nThe custom repository file has been detected. Maybe it is empty?'
else:
summary_ctrf = 'The custom repository file has not been detected.'
summary_ctrf = ''
reporting.create_report([
reporting.Title('Using RHSM has been skipped but no custom repositories have been delivered.'),
reporting.Summary(
Expand All @@ -66,17 +71,18 @@ def process():
reporting.ExternalLink(url=_IPU_DOC_URL, title='UPGRADING TO RHEL 8'),
reporting.RelatedResource('file', CUSTOM_REPO_PATH),
])
elif not is_ctrf:
elif not (is_ctrf or is_re):
# Some custom repositories have been discovered, but the custom repo
# file not. Inform about the official recommended way.
# file not - neither the --enablerepo option is usedd. Inform about
# the official recommended way.
reporting.create_report([
reporting.Title('CustomTargetRepositories discovered, but the CustomTargetRepositoryFile is missing.'),
reporting.Title('CustomTargetRepositories discovered, but no new provided mechanisms used.'),
reporting.Summary(
'Red Hat provides now official way how to use custom'
' repositories during the in-place upgrade through'
' the referred custom repository file. The CustomTargetRepositories'
' have been detected (from custom actors?) but the repository'
' file not.'
' the referred custom repository file or through the'
' --enablerepo option for leapp. The CustomTargetRepositories'
' have been produced from custom (own) actors?'
),
reporting.Remediation(hint=(
'Follow the new simple way to enable custom repositories'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ def gather_target_repositories(context):
' your current subscription is entitled to install the requested target version {version}.'
' In case the --no-rhsm option (or the LEAPP_NO_RHSM=1 environment variable is set)'
' ensure the custom repository file is provided regarding the documentation with'
' properly defined repositories.'
' properly defined repositories or in case repositories are already defined'
' in any repofiles under /etc/yum.repos.d/ directory, use the --enablerepo option'
' for leapp'
).format(version=api.current_actor().configuration.version.target)
}
)
Expand All @@ -341,11 +343,14 @@ def gather_target_repositories(context):
message='Some required custom target repositories are not available.',
details={'hint': (
' The most probably you are using custom or third party actor'
' that produces CustomTargetRepository message. However,'
' inside the upgrade container, we are not able to find such'
' that produces CustomTargetRepository message or you did a typo'
' in one of repoids specified on command line for the leapp --enablerepo'
' option.'
' Inside the upgrade container, we are not able to find such'
' repository inside any repository file. Consider use of the'
' custom repository file regarding the official upgrade'
' documentation.'
' documentation or check whether you did not do a typo in any'
' repoids you specified for the --enablerepo option of leapp.'
)
}
)
Expand Down

0 comments on commit 3d51ad4

Please sign in to comment.