-
Bug
-
Resolution: Done
-
Undefined
-
None
-
None
-
None
The process crashes on the following line, when the filepath object is None.
https://github.com/oamg/convert2rhel/blob/main/convert2rhel/backup/files.py#L41
Discovered with missing_system_release test in tier0.
When the /etc/system-release file is moved elsewhere or missing, the following function returns None, making the logerinst.critical message unreachable
https://github.com/oamg/convert2rhel/blob/main/convert2rhel/redhatrelease.py#L34
Reproducer:
$ mv /etc/system-release /tmp/system-release
$ convert2rhel
Executing a command: mv -v /etc/system-release /tmp/missing-system-release_sysrelease_backup/ renamed '/etc/system-release' -> '/tmp/missing-system-release_sysrelease_backup/system-release' Traceback (most recent call last): File "/usr/bin/convert2rhel", line 11, in <module> load_entry_point('convert2rhel==1.6.1', 'console_scripts', 'convert2rhel')() File "/usr/lib/python3.6/site-packages/convert2rhel/initialize.py", line 80, in run from convert2rhel import main File "/usr/lib/python3.6/site-packages/convert2rhel/main.py", line 26, in <module> from convert2rhel import pkghandler, pkgmanager, redhatrelease, repo, subscription, systeminfo, toolopts, utils File "/usr/lib/python3.6/site-packages/convert2rhel/redhatrelease.py", line 95, in <module> system_release_file = RestorableFile(get_system_release_filepath()) # pylint: disable=C0103 File "/usr/lib/python3.6/site-packages/convert2rhel/backup/files.py", line 41, in __init__ if not os.path.isabs(filepath): File "/usr/lib64/python3.6/posixpath.py", line 66, in isabs s = os.fspath(s) TypeError: expected str, bytes or os.PathLike object, not NoneType