Skip to content

Commit f991107

Browse files
committed
targetuserspacecreator: Update err msg when installing the container
Regarding the changes around source OVL, we need to update the error msg properly in case the installation of the target userspace container fails. In this case, we want to change only the part when the upgrade fails due to missing space.
1 parent 10b497a commit f991107

File tree

1 file changed

+50
-11
lines changed
  • repos/system_upgrade/common/actors/targetuserspacecreator/libraries

1 file changed

+50
-11
lines changed

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

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import itertools
22
import os
3+
import re
34
import shutil
45

56
from leapp import reporting
@@ -55,6 +56,7 @@
5556
PROD_CERTS_FOLDER = 'prod-certs'
5657
GPG_CERTS_FOLDER = 'rpm-gpg'
5758
PERSISTENT_PACKAGE_CACHE_DIR = '/var/lib/leapp/persistent_package_cache'
59+
DEDICATED_LEAPP_PART_URL = 'https://access.redhat.com/solutions/7011704'
5860

5961

6062
def _check_deprecated_rhsm_skip():
@@ -172,6 +174,53 @@ def _import_gpg_keys(context, install_root_dir, target_major_version):
172174
)
173175

174176

177+
def _handle_transaction_err_msg_size_old(err):
178+
# NOTE(pstodulk): This is going to be removed in future!
179+
180+
article_section = 'Generic case'
181+
xfs_info = next(api.consume(XFSPresence), XFSPresence())
182+
if xfs_info.present and xfs_info.without_ftype:
183+
article_section = 'XFS ftype=0 case'
184+
185+
message = ('There is not enough space on the file system hosting /var/lib/leapp directory '
186+
'to extract the packages.')
187+
details = {'hint': "Please follow the instructions in the '{}' section of the article at: "
188+
"link: https://access.redhat.com/solutions/5057391".format(article_section)}
189+
190+
raise StopActorExecutionError(message=message, details=details)
191+
192+
193+
def _handle_transaction_err_msg_size(err):
194+
if get_env('LEAPP_OVL_LEGACY', '0') == '1':
195+
_handle_transaction_err_msg_size_old(err)
196+
return # not needed actually as the above function raises error, but for visibility
197+
NO_SPACE_STR = 'more space needed on the'
198+
199+
# Disk Requirements:
200+
# At least <size> more space needed on the <path> filesystem.
201+
#
202+
missing_space = [line.strip() for line in err.stderr.split('\n') if NO_SPACE_STR in line]
203+
size_str = re.match(r'At least (.*) more space needed', missing_space[0]).group(1)
204+
message = 'There is not enough space on the file system hosting /var/lib/leapp.'
205+
hint = (
206+
'Increase the free space on the filesystem hosting'
207+
' /var/lib/leapp by {} at minimum. It is suggested to provide'
208+
' reasonably more space to be able to perform all planned actions'
209+
' (e.g. when 200MB is missing, add 1700MB or more).\n\n'
210+
'It is also a good practice to create dedicated partition'
211+
' for /var/lib/leapp when more space is needed, which can be'
212+
' dropped after the system upgrade is fully completed'
213+
' For more info, see: {}'
214+
.format(size_str, DEDICATED_LEAPP_PART_URL)
215+
)
216+
# we do not want to confuse customers by the orig msg speaking about
217+
# missing space on '/'. Skip the Disk Requirements section.
218+
# The information is part of the hint.
219+
details = {'hint': hint}
220+
221+
raise StopActorExecutionError(message=message, details=details)
222+
223+
175224
def prepare_target_userspace(context, userspace_dir, enabled_repos, packages):
176225
"""
177226
Implement the creation of the target userspace.
@@ -210,21 +259,11 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages):
210259
message = 'Unable to install RHEL {} userspace packages.'.format(target_major_version)
211260
details = {'details': str(exc), 'stderr': exc.stderr}
212261

213-
xfs_info = next(api.consume(XFSPresence), XFSPresence())
214262
if 'more space needed on the' in exc.stderr:
215263
# The stderr contains this error summary:
216264
# Disk Requirements:
217265
# At least <size> more space needed on the <path> filesystem.
218-
219-
article_section = 'Generic case'
220-
if xfs_info.present and xfs_info.without_ftype:
221-
article_section = 'XFS ftype=0 case'
222-
223-
message = ('There is not enough space on the file system hosting /var/lib/leapp directory '
224-
'to extract the packages.')
225-
details = {'hint': "Please follow the instructions in the '{}' section of the article at: "
226-
"link: https://access.redhat.com/solutions/5057391".format(article_section)}
227-
raise StopActorExecutionError(message=message, details=details)
266+
_handle_transaction_err_msg_size(exc)
228267

229268
# If a proxy was set in dnf config, it should be the reason why dnf
230269
# failed since leapp does not support updates behind proxy yet.

0 commit comments

Comments
 (0)