|
1 | 1 | import itertools
|
2 | 2 | import os
|
| 3 | +import re |
3 | 4 | import shutil
|
4 | 5 |
|
5 | 6 | from leapp import reporting
|
|
55 | 56 | PROD_CERTS_FOLDER = 'prod-certs'
|
56 | 57 | GPG_CERTS_FOLDER = 'rpm-gpg'
|
57 | 58 | PERSISTENT_PACKAGE_CACHE_DIR = '/var/lib/leapp/persistent_package_cache'
|
| 59 | +DEDICATED_LEAPP_PART_URL = 'https://access.redhat.com/solutions/7011704' |
58 | 60 |
|
59 | 61 |
|
60 | 62 | def _check_deprecated_rhsm_skip():
|
@@ -172,6 +174,53 @@ def _import_gpg_keys(context, install_root_dir, target_major_version):
|
172 | 174 | )
|
173 | 175 |
|
174 | 176 |
|
| 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 | + |
175 | 224 | def prepare_target_userspace(context, userspace_dir, enabled_repos, packages):
|
176 | 225 | """
|
177 | 226 | Implement the creation of the target userspace.
|
@@ -210,21 +259,11 @@ def prepare_target_userspace(context, userspace_dir, enabled_repos, packages):
|
210 | 259 | message = 'Unable to install RHEL {} userspace packages.'.format(target_major_version)
|
211 | 260 | details = {'details': str(exc), 'stderr': exc.stderr}
|
212 | 261 |
|
213 |
| - xfs_info = next(api.consume(XFSPresence), XFSPresence()) |
214 | 262 | if 'more space needed on the' in exc.stderr:
|
215 | 263 | # The stderr contains this error summary:
|
216 | 264 | # Disk Requirements:
|
217 | 265 | # 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) |
228 | 267 |
|
229 | 268 | # If a proxy was set in dnf config, it should be the reason why dnf
|
230 | 269 | # failed since leapp does not support updates behind proxy yet.
|
|
0 commit comments