Bug 2106065

Summary: 'leapp preupgrade' traceback _sub_commands[cmdname].parser.error(leftover)
Product: Red Hat Enterprise Linux 8 Reporter: Corey Marthaler <cmarthal>
Component: leappAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Michal Macura <mmacura>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.6CC: mmacura
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: leapp-0.15.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 09:46:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Marthaler 2022-07-11 16:31:17 UTC
Description of problem:
I assume this is due to an invalid or improper named boot volume or boom entry, either way, leapp should offer more in checking and warning the user than a traceback.



[root@hayes-01 ~]# boom create --backup --title "Root LV snapshot before changes" --rootlv rhel/root_snapshot_before_changes
WARNING - Boom grub2 integration is disabled in '/boot/../etc/default/boom'
Created entry with boot_id 8cc2b32:
  title Root LV snapshot before changes
  machine-id abaa31d7fbe14391b6f63b7fb4d617fc
  version 4.18.0-398.g366e.el8.kpq1.x86_64
  linux /vmlinuz-4.18.0-398.g366e.el8.kpq1.x86_64.boom0
  initrd /initramfs-4.18.0-398.g366e.el8.kpq1.x86_64.img.boom0
  options root=/dev/rhel/root_snapshot_before_changes ro rd.lvm.lv=rhel/root_snapshot_before_changes rhgb quiet
  grub_users $grub_users
  grub_arg --unrestricted
  grub_class kernel


[root@hayes-01 ~]# leapp -h
usage: leapp [-h] [--version]

Optional arguments:
  -h, --help  show this help message and exit
  --version   show program's version number and exit

[root@hayes-01 ~]# leapp preupgrade
Traceback (most recent call last):
  File "/usr/bin/leapp", line 11, in <module>
    load_entry_point('leapp==0.14.0', 'console_scripts', 'leapp')()
  File "/usr/lib/python3.6/site-packages/leapp/cli/__init__.py", line 43, in main
    cli.command.execute('leapp version {}'.format(VERSION))
  File "/usr/lib/python3.6/site-packages/leapp/utils/clicmd.py", line 105, in execute
    self._sub_commands[cmdname].parser.error(leftover)
KeyError: 'leapp'




Version-Release number of selected component (if applicable):
kernel-4.18.0-398.g366e.el8.kpq1    BUILT: Tue Jun  7 04:56:38 CDT 2022

[root@hayes-01 ~]# rpm -qi leapp
Name        : leapp
Version     : 0.14.0
Release     : 3.el8
Architecture: noarch
Install Date: Mon 11 Jul 2022 11:25:37 AM CDT
Group       : Unspecified
Size        : 61655
License     : ASL 2.0
Signature   : RSA/SHA256, Wed 15 Jun 2022 10:17:17 AM CDT, Key ID 199e2f91fd431d51
Source RPM  : leapp-0.14.0-3.el8.src.rpm
Build Date  : Fri 27 May 2022 06:04:55 AM CDT

Comment 1 Corey Marthaler 2022-07-11 16:33:06 UTC
Same thing for other cmds, something must not be installed properly?


[root@hayes-01 ~]# leapp upgrade --reboot
Traceback (most recent call last):
  File "/usr/bin/leapp", line 11, in <module>
    load_entry_point('leapp==0.14.0', 'console_scripts', 'leapp')()
  File "/usr/lib/python3.6/site-packages/leapp/cli/__init__.py", line 43, in main
    cli.command.execute('leapp version {}'.format(VERSION))
  File "/usr/lib/python3.6/site-packages/leapp/utils/clicmd.py", line 105, in execute
    self._sub_commands[cmdname].parser.error(leftover)
KeyError: 'leapp'

Comment 2 Petr Stodulka 2022-07-11 17:10:07 UTC
Hi, thanks for the report. It's unrelated to /boot and boom. The problem is caused just by wrong instalation. On the system is installed just the leapp framework, without leapp repositories for upgrades. So there is not discovered any leapp subcommand. All required packages needs to be installed, which can be done by:

  # dnf install leapp-upgrade

Or you can specifically install the specific package directly, e.g. leapp-upgrade-el8toel9 in your case.

We will replace the traceback by proper error msg to make it more clear, like:
  ,,The 'upgrade' subcommand has not been discovered. Possibly the particular leapp repository has not been installed?"

Comment 3 Petr Stodulka 2022-07-11 17:23:36 UTC
Note: It is important to understand that leapp component contains only the framework and basic utility (+ another devel/testing tools) to make the use of the framework more friendly. When the system should be upgraded, the proper leapp repository / repositories needs to be installed (which in our case installs also particular leapp CLI subcommands, like `preupgrade`, `upgrade`, ...). These repositories are provided by the leapp-repository component (srpm) on RHEL systems. To make it easy for people so they do not need to know how particular RPMs are named, we instruct them to install `leapp-upgrade` which covers all packages needed for the In-Place Upgrade.

But as written above, the traceback is unfortunate and we agree that proper error msg should be delivered.

Comment 4 Petr Stodulka 2022-08-23 16:14:47 UTC
This has been fixed in upstream by the following PR:
    https://github.com/oamg/leapp/pull/785

Comment 10 errata-xmlrpc 2022-11-08 09:46:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (leapp bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7591