RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1466650 - [DNF] TransactionSet object has no attribute 'addReinstall'
Summary: [DNF] TransactionSet object has no attribute 'addReinstall'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rpm
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: pre-dev-freeze
: ---
Assignee: Igor Gnatenko
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks: 1461652 1465896 1466368
TreeView+ depends on / blocked
 
Reported: 2017-06-30 07:19 UTC by Daniel Mach
Modified: 2018-04-10 15:59 UTC (History)
5 users (show)

Fixed In Version: rpm-4.11.3-27.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 15:58:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0877 0 None None None 2018-04-10 15:59:42 UTC

Description Daniel Mach 2017-06-30 07:19:37 UTC
This currently blocks DNF running on RHEL 7.
The feature has to be either backported into RPM (preferred) or we need to find a workaround in the DNF code.

Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 123, in cli_run
    ret = resolving(cli, base)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 154, in resolving
    base.do_transaction(display=displays)
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 235, in do_transaction
    super(BaseCli, self).do_transaction(display)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 677, in do_transaction
    self.transaction._populate_rpm_ts(self._ts)
  File "/usr/lib/python2.7/site-packages/dnf/transaction.py", line 204, in _populate_rpm_ts
    ts.addReinstall(tsi.installed._header, tsi)
  File "/usr/lib/python2.7/site-packages/dnf/rpm/transaction.py", line 65, in __getattr__
    return self.getMethod(attr)
  File "/usr/lib/python2.7/site-packages/dnf/rpm/transaction.py", line 75, in getMethod
    return getattr(self.ts, method)
AttributeError: 'TransactionSet' object has no attribute 'addReinstall'

Comment 1 Panu Matilainen 2017-06-30 08:26:57 UTC
There are basically three options, in order of backporting complexity from rpm POV:

1) Make "reinstall" command in dnf only available if rpm supports it - no rpm changes, a conditional or two in dnf (but obvious con of missing feature)
2) Minimal backport on rpm side to permit install + erasure of same package within a transaction, implement addReinstall() as a trivialish wrapper in dnf
3) Backport all of --reinstall feature to rpm, changes to dnf

For dnf, 3) is obviously easiest, 1) and 2) require some changes there as well.

The relevant rpm commits to backport are:

Preliminaries, equaling case 2) above:
1f3164ae6975747e72af383f2d74c27245e6fe36
fd40d58efa0fbff535f273e5ae5c200d43d28aef

The API + python binding changes:
bfa76529864b9dfb29258f4dedc3fa9de9c5aeca
6665503ec6fb6430ecaafb3e318a4730f146efa9
bf856744f2820a1625ef9428284b5788d18103f3
c5200145fa08da884ce2c1ed85941363eeae6407

--reinstall on rpm cli (optional from dnf POV, but I guess would be strange not to backport this along with the others):
80dee39fb1f97ab3927c10bdd13c7c438b5677be

This should be a trivial backport, commits are cherry-pick'able to rpm 4.11, bfa76529864b9dfb29258f4dedc3fa9de9c5aeca and 6665503ec6fb6430ecaafb3e318a4730f146efa9 need a trivial tweak to compile. Didn't test the result but not expecting any problems.

Comment 5 Daniel Mach 2017-12-07 09:25:07 UTC
how about following?:

import rpm
ts = rpm.TransactionSet()
result = hasattr(ts, "addReinstall")

Comment 6 Panu Matilainen 2017-12-07 09:38:39 UTC
Yeah, that'll basically test that the relevant patch has been applied. If you want to test the actual functionality, try something like this:

# dnf -y install telnet
# ls /usr/share/doc/telnet
README
# dnf -y --nodocs reinstall telnet
# ls /usr/share/doc/telnet
ls: cannot access '/usr/share/doc/telnet': No such file or directory

For an automated testcase you'd probably want 'test -d /usr/share/doc/telnet' rather than 'ls', with the expectation that first it exists and after the --nodocs reinstall it does not.

Comment 10 errata-xmlrpc 2018-04-10 15:58:38 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, 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-2018:0877


Note You need to log in before you can comment on or make changes to this bug.