manatools / dnfdaemon

DBus daemon for doing package action with the dnf package manager
GNU General Public License v2.0
12 stars 16 forks source link

problems using GetRepo in dnf 2.0 #11

Closed anaselli closed 7 years ago

anaselli commented 7 years ago

developing dnfdragora, I found a problem in using GetRepo in Mageia caludron which is currently using DNF 2.0. The same code does not have any problems in my Fedora VM in which DNF is not 2.0.

Mageia output:

(Pdb) p self.backend.GetRepositories("*")      
['backports_testing-i586-debuginfo', 'mageia-x86_64-tainted-source', 'updates_testing-i586-tainted-debuginfo', 'cauldron-x86_64', 'backports-x86_64-tainted-debuginfo', 'cauldron-updates_testing-x86_64-tainted', 'updates-x86_64-tainted-source', 'cauldron-backports_testing-i586-nonfree-debuginfo', 'backports-i586-tainted', 'cauldron-updates-x86_64-debuginfo', 'cauldron-backports-x86_64-source', 'mageia-x86_64-tainted', 'cauldron-x86_64-source', 'cauldron-backports-i586-nonfree', 'updates_testing-i586', 'cauldron-updates_testing-x86_64-source', 'cauldron-updates_testing-i586-debuginfo', 'updates_testing-x86_64-tainted-debuginfo', 'backports-i586', 'cauldron-backports-x86_64-tainted-debuginfo', 'cauldron-backports-x86_64-nonfree', 'cauldron-i586-tainted-debuginfo', 'cauldron-updates-i586', 'cauldron-updates-i586-tainted-debuginfo', 'backports_testing-i586', 'cauldron-updates-x86_64-nonfree-source', 'cauldron-backports-x86_64-nonfree-debuginfo', 'updates_testing-i586-debuginfo', 'cauldron-updates_testing-x86_64-tainted-debuginfo', 'backports-x86_64-tainted-source', 'updates-x86_64-tainted', 'backports-i586-nonfree-debuginfo', 'cauldron-x86_64-nonfree-source', 'cauldron-updates_testing-x86_64', 'mageia-i586-nonfree', 'cauldron-backports-x86_64-tainted-source', 'cauldron-x86_64-debuginfo', 'updates-i586-tainted-debuginfo', 'cauldron-backports_testing-x86_64-debuginfo', 'cauldron-updates_testing-x86_64-nonfree-source', 'backports-x86_64-nonfree', 'mageia-i586-nonfree-debuginfo', 'cauldron-backports_testing-x86_64-nonfree-debuginfo', 'cauldron-i586-nonfree-debuginfo', 'backports-x86_64-tainted', 'backports_testing-x86_64-source', 'cauldron-backports_testing-x86_64-tainted', 'backports_testing-x86_64-nonfree', 'cauldron-backports_testing-i586-nonfree', 'mageia-x86_64-nonfree-debuginfo', 'updates-x86_64-nonfree-source', 'cauldron-updates_testing-i586-tainted-debuginfo', 'cauldron-backports_testing-x86_64-tainted-source', 'cauldron-backports-i586', 'backports-x86_64-nonfree-source', 'backports-i586-tainted-debuginfo', 'backports_testing-x86_64-tainted', 'backports-x86_64', 'updates-i586-tainted', 'cauldron-updates_testing-i586-nonfree-debuginfo', 'cauldron-updates_testing-x86_64-nonfree', 'cauldron-backports_testing-i586-debuginfo', 'cauldron-backports_testing-x86_64-nonfree-source', 'updates_testing-x86_64-debuginfo', 'updates-i586-debuginfo', 'cauldron-updates-i586-nonfree-debuginfo', 'updates-x86_64-source', 'cauldron-x86_64-nonfree-debuginfo', 'updates-i586-nonfree', 'cauldron-updates-x86_64-tainted-debuginfo', 'updates_testing-i586-nonfree-debuginfo', 'updates_testing-x86_64-tainted', 'cauldron-backports_testing-x86_64-source', 'updates_testing-x86_64-nonfree-source', 'cauldron-backports-x86_64-nonfree-source', 'cauldron-backports_testing-i586-tainted', 'cauldron-i586-debuginfo', 'cauldron-backports_testing-x86_64-nonfree', 'updates_testing-x86_64-source', 'mageia-x86_64-nonfree-source', 'cauldron-updates-x86_64', 'cauldron-updates_testing-x86_64-nonfree-debuginfo', 'cauldron-x86_64-nonfree', 'backports_testing-x86_64-nonfree-source', 'ngompa-livecd-creator-mga', 'backports_testing-x86_64-nonfree-debuginfo', 'cauldron-backports_testing-x86_64-tainted-debuginfo', 'cauldron-backports-x86_64-tainted', 'backports_testing-i586-nonfree-debuginfo', 'cauldron-updates_testing-i586-nonfree', 'cauldron-backports-x86_64-debuginfo', 'cauldron-backports_testing-i586-tainted-debuginfo', 'updates-x86_64-tainted-debuginfo', 'backports_testing-x86_64-debuginfo', 'mageia-i586-debuginfo', 'cauldron-updates-x86_64-source', 'updates-x86_64-nonfree-debuginfo', 'mageia-x86_64-nonfree', 'backports-i586-nonfree', 'updates-x86_64-nonfree', 'cauldron-backports-i586-tainted', 'mageia-cauldron-core', 'cauldron-backports-i586-nonfree-debuginfo', 'mageia-x86_64-debuginfo', 'backports_testing-i586-tainted', 'mageia-i586', 'backports-i586-debuginfo', 'cauldron-x86_64-tainted', 'cauldron-updates-i586-tainted', 'updates_testing-i586-tainted', 'cauldron-x86_64-tainted-debuginfo', 'cauldron-x86_64-tainted-source', 'cauldron-updates-i586-nonfree', 'mageia-cauldron-core-debug', 'updates_testing-i586-nonfree', 'cauldron-backports-i586-debuginfo', 'updates-x86_64', 'cauldron-i586-nonfree', 'cauldron-updates_testing-i586', 'cauldron-backports_testing-x86_64', 'cauldron-updates-x86_64-nonfree-debuginfo', 'mageia-x86_64-tainted-debuginfo', 'updates_testing-x86_64-nonfree-debuginfo', 'mageia-x86_64', 'cauldron-updates-i586-debuginfo', 'updates-i586-nonfree-debuginfo', 'backports-x86_64-debuginfo', 'backports_testing-i586-nonfree', 'backports_testing-x86_64', 'updates_testing-x86_64-nonfree', 'updates-x86_64-debuginfo', 'cauldron-updates-x86_64-tainted', 'updates-i586', 'cauldron-updates_testing-x86_64-tainted-source', 'cauldron-backports-x86_64', 'cauldron-backports_testing-i586', 'backports-x86_64-source', 'cauldron-updates_testing-i586-tainted', 'cauldron-updates_testing-x86_64-debuginfo', 'cauldron-updates-x86_64-tainted-source', 'updates_testing-x86_64', 'updates_testing-x86_64-tainted-source', 'backports-x86_64-nonfree-debuginfo', 'mageia-i586-tainted-debuginfo', 'cauldron-backports-i586-tainted-debuginfo', 'mageia-cauldron-core-32', 'mageia-x86_64-source', 'backports_testing-i586-tainted-debuginfo', 'backports_testing-x86_64-tainted-debuginfo', 'mageia-i586-tainted', 'cauldron-i586-tainted', 'backports_testing-x86_64-tainted-source', 'cauldron-updates-x86_64-nonfree', 'cauldron-i586']
(Pdb) p self.backend.GetRepo("cauldron-x86_64")
*** dnfdaemon.client.DaemonError: g-io-error-quark: GDBus.Error:org.freedesktop.DBus.Python.AttributeError: Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3.5/site-packages/dnfdaemon/server/__init__.py", line 83, in newFunc
    rc = func(*args, **kwargs)
  File "/usr/share/dnfdaemon/dnfdaemon-system", line 223, in GetRepo
    value = self.get_repo(repo_id)
  File "/usr/lib/python3.5/site-packages/dnfdaemon/server/__init__.py", line 306, in get_repo
    repo_conf = dict([(c, getattr(repo, c)) for c in repo.iterkeys()])
AttributeError: 'Repo' object has no attribute 'iterkeys'
 (36)

Fedora output:

(Pdb) p self.backend.GetRepositories("*")
['ngompa-dnfdragora', 'kkofler-dnfdragora', 'updates-source', 'fedora-cisco-openh264-debuginfo', 'fedora', 'fedora-source', 'fedora-cisco-openh264', 'updates-debuginfo', 'ngompa-libyui-qt-test', 'updates-testing-debuginfo', 'updates', 'fedora-debuginfo', 'updates-testing', 'updates-testing-source']
(Pdb) p self.backend.GetRepo("fedora")
{'proxy': None, 'sslcacert': None, 'sslclientcert': None, 'bandwidth': 0, 'exclude': [], 'repo_gpgcheck': False, 'skip_if_unavailable': False, 'enabled': True, 'sslverify': True, 'proxy_password': None, 'timeout': 120, 'proxy_username': None, 'metalink': 'https://mirrors.fedoraproject.org/metalink?repo=fedora-25&arch=x86_64', 'minrate': 1000, 'username': None, 'enablegroups': True, 'sslclientkey': None, 'cost': 1000, 'throttle': 0, 'baseurl': [], 'deltarpm': True, 'priority': 99, 'password': None, 'max_parallel_downloads': None, 'metadata_expire': 604800, 'gpgcheck': True, 'mediaid': None, 'gpgkey': ['file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-25-x86_64'], 'include': [], 'name': 'Fedora 25 - x86_64', 'ip_resolve': None, 'fastestmirror': False, 'mirrorlist': None}
Conan-Kudo commented 7 years ago

Note that DNF 2.0 will be shipping in Fedora 26, per the Fedora 26 Change Set.

anaselli commented 7 years ago

I suspect that a similar patch should be written for issue #12, i will test that code later

Conan-Kudo commented 7 years ago

Fixed in dda40e59a95dae95dc38eb9032317601690ba4fc.