Bug 1840488

Summary: traceback when attempting to "boom remove" instead of using supported "boom delete"
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM and device-mapper development team <lvm-team>
lvm2 sub component: Other QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: agk, bmr, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, zkabelac
Version: 7.9   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.187-5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-29 19:56:06 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 2020-05-27 03:16:13 UTC
Description of problem:

# rhel8.2
[root@hayes-02 ~]#  boom remove ccb55fe
Unknown command type: remove

# rhel7.9
[root@harding-03 /]# boom remove ccb55fe
Traceback (most recent call last):
  File "/usr/bin/boom", line 7, in <module>
    r = main(sys.argv)
  File "/usr/lib/python2.7/site-packages/boom/command.py", line 3179, in main
    if cmd_type[0] == CACHE_TYPE and not bc.cache_enable:
TypeError: 'NoneType' object has no attribute '__getitem__'


Version-Release number of selected component (if applicable):
3.10.0-1141.el7.x86_64

lvm2-2.02.187-3.el7    BUILT: Tue May 19 06:05:10 CDT 2020
lvm2-libs-2.02.187-3.el7    BUILT: Tue May 19 06:05:10 CDT 2020
lvm2-cluster-2.02.187-3.el7    BUILT: Tue May 19 06:05:10 CDT 2020
lvm2-lockd-2.02.187-3.el7    BUILT: Tue May 19 06:05:10 CDT 2020
lvm2-python-boom-1.1-1.el7    BUILT: Tue May 19 06:07:15 CDT 2020

Comment 2 Bryn M. Reeves 2020-05-27 15:58:24 UTC
This is a regression due to commit 0bde1513 ("boom: don't allow cache commands if !config.cache_enable"). This adds a check to prevent a command of type "boom cache" running when the cache is disabled in boom.conf. The check is applied before validation of the parsed cmd_type, leading to an unhandled exception in the event that the provided command argument is invalid.

The fix is to move the validation before the cache check and I've also added additional checks to distinguish between an unknown subcommand with default type (entry) and a missing argument, which both previously resulted in the same terse "boom: error: too few arguments" message.

Comment 3 Bryn M. Reeves 2020-05-27 16:07:28 UTC
commit 86cac4a0eb35cffbead898af6b18a689db5df92e (HEAD -> master, origin/master)
Author: Bryn M. Reeves <bmr>
Date:   Wed May 27 17:05:00 2020 +0100

    boom.command: fix command validation regression (0bde1513)
    
    This is a regression due to commit 0bde1513 ("boom: don't allow cache
    commands if !config.cache_enable"). This adds a check to prevent a
    command of type "boom cache" running when the cache is disabled in
    boom.conf. The check is applied before validation of the parsed
    cmd_type, leading to an unhandled exception in the event that the
    provided command argument is invalid.
    
    The fix is to move the validation before the cache check and this commit
    also adds additional checks to distinguish between an unknown subcommand
    with default type (entry) and a missing argument, which both previously
    resulted in the same terse "boom: error: too few arguments" message.
    
    Signed-off-by: Bryn M. Reeves <bmr>

Comment 6 Corey Marthaler 2020-06-08 18:03:53 UTC
Fix verified in the latest rpms.

3.10.0-1141.el7.x86_64
lvm2-2.02.187-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
lvm2-libs-2.02.187-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
lvm2-cluster-2.02.187-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
lvm2-lockd-2.02.187-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
lvm2-python-boom-1.2-1.el7    BUILT: Sun Jun  7 08:15:48 CDT 2020
cmirror-2.02.187-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
device-mapper-1.02.170-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
device-mapper-libs-1.02.170-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
device-mapper-event-1.02.170-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
device-mapper-event-libs-1.02.170-5.el7    BUILT: Sun Jun  7 08:13:11 CDT 2020
device-mapper-persistent-data-0.8.5-3.el7    BUILT: Mon Apr 20 09:49:16 CDT 2020


[root@mckinley-01 ~]# boom list 03d0f0
BootID  Version                  Name                            RootDevice            
03d0f01 3.10.0-1141.el7.x86_64   Red Hat Enterprise Linux Server /dev/snapper/boom_snap
[root@mckinley-01 ~]# boom remove 03d0f01
usage: boom [-h] [-a OPTIONS] [--architecture ARCH] [--backup] [-b BOOT_ID]
            [--boot-dir PATH] [-B SUBVOL] [--btrfs-opts OPTS] [-c FILE]
            [-d OPTIONS] [--debug DEBUGOPTS] [-e IMG] [-E] [--grub-arg ARGS]
            [--grub-class CLASS] [--grub-users USERS] [--grub-id ID] [-H]
            [-P PROFILE] [--host-name HOSTNAME] [-i IMG] [-k PATTERN]
            [--label LABEL] [-l IMG] [-L LV] [--lvm-opts OPTS] [-m MACHINE_ID]
            [-n OSNAME] [--name-prefixes] [--no-headings] [--no-dev]
            [--optional-keys KEYS] [-o FIELDS] [--os-version OSVERSION]
            [-O SORTFIELDS] [-I OSVERSIONID] [--os-options OPTIONS]
            [--os-release OSRELEASE] [-p OS_ID] [-r ROOT] [-R PATTERN]
            [--rows] [--separator SEP] [-s OSSHORTNAME] [-t TITLE]
            [-u PATTERN] [-V] [-v VERSION]
            [TYPE] COMMAND [ID]
Unknown command: remove 03d0f01
[root@mckinley-01 ~]# boom delete 03d0f01
Deleted 1 entry

Comment 8 errata-xmlrpc 2020-09-29 19:56:06 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 (lvm2 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-2020:3927