Bug 2053014

Summary: Undoing an undo produces a python backtrace
Product: Red Hat Enterprise Linux 9 Reporter: Renaud Métrich <rmetrich>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: low Docs Contact: Mariya Pershina <mpershin>
Priority: low    
Version: 9.0CC: gfialova, james.antill, mbanas, mpershin, plawate, prjagtap
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-4.12.0-1.el9 Doc Type: Bug Fix
Doc Text:
.DNF now correctly rolls back a transaction containing an item with the `Reason Change` Action type Previously, running the `dnf history rollback` command on a transaction containing an item with the `Reason Change` Action type failed. With this update, the issue has been fixed, and `dnf history rollback` now works as expected.
Story Points: ---
Clone Of:
: 2064581 (view as bug list) Environment:
Last Closed: 2022-11-15 11:15:35 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:
Bug Depends On: 2074456    
Bug Blocks: 2064581    

Description Renaud Métrich 2022-02-10 13:03:17 UTC
Description of problem:

By mistake I tried undoing an undo, this produced a backtrace:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[root@vm-rhel9 ~]# yum history

ID     | Command line                                                    | Date and time    | Action(s)      | Altered
----------------------------------------------------------------------------------------------------------------------
     6 | install glibc-devel.i686                                        | 2022-02-10 13:55 | I, U           |   14   
     5 | history undo 4                                                  | 2022-02-10 13:49 | ?, D, E        |   15   
     4 | install glibc-devel.i686                                        | 2022-02-10 13:47 | I, U           |   14   
     3 | -y install clevis-dracut                                        | 2022-01-06 18:07 | Install        |    5   
     2 | -y install clevis vim bash-completion                           | 2022-01-06 18:06 | Install        |   15   
     1 |                                                                 | 2022-01-06 17:58 | Install        |  424 EE

# yum history undo 5

Traceback (most recent call last):
  File "/usr/bin/yum", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.9/site-packages/dnf/cli/cli.py", line 1055, in run
    return self.command.run()
  File "/usr/lib/python3.9/site-packages/dnf/cli/commands/history.py", line 342, in run
    self._hcmd_undo(tids)
  File "/usr/lib/python3.9/site-packages/dnf/cli/commands/history.py", line 190, in _hcmd_undo
    self._revert_transaction(old)
  File "/usr/lib/python3.9/site-packages/dnf/cli/commands/history.py", line 233, in _revert_transaction
    ti["action"] = action_map[ti["action"]]
KeyError: 'Reason Change'
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Version-Release number of selected component (if applicable):

dnf-4.7.0-2.el9.noarch

How reproducible:

Always

Comment 15 errata-xmlrpc 2022-11-15 11:15:35 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 (dnf 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:8297