Bug 1518421 - dnf-plugin-spacewalk calls unload in packages.py
Summary: dnf-plugin-spacewalk calls unload in packages.py
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Clients
Version: 2.7
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space28
TreeView+ depends on / blocked
 
Reported: 2017-11-28 21:13 UTC by Aran Cox
Modified: 2018-04-20 12:31 UTC (History)
1 user (show)

Fixed In Version: 2.8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-20 12:31:46 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1218071 0 unspecified CLOSED No API to enable/run plugins 2021-02-22 00:41:40 UTC

Description Aran Cox 2017-11-28 21:13:21 UTC
Description of problem:
The dnf plugin spacewalk fails when called by rhn_check on Fedora 26 because it calls unload on lines 125 and 335, which according to the comments in the code is to work around another bug (1218071).

This bug was fixed in DNF2 which ships with Fedora 26.  

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

How reproducible:
100%

Steps to Reproduce:
1. Schedule errata installation or package installation using spacewalk.
2. Run rhn_check or allow rhn_check to be run via osad, etc.
3. Look at /var/log/up2date:
[Tue Nov 28 14:42:53 2017] up2date 
Traceback (most recent call last):
  File "/sbin/rhn_check", line 382, in __run_action
    (status, message, data) = CheckCli.__do_call(method, params, kwargs)
  File "/sbin/rhn_check", line 375, in __do_call
    retval = method(*params, **kwargs)
  File "/usr/share/rhn/actions/errata.py", line 79, in update
    return packages.update(packagelist, cache_only)
  File "/usr/share/rhn/actions/packages.py", line 128, in update
    base._plugins.unload()
<class 'AttributeError'>: 'Plugins' object has no attribute 'unload'


Actual results:
Package may be installed but updating the spacewalk server fails.

Expected results:
Package updated/installed and spacewalk server notified properly.


Additional info:

I don't know what the right way to fix this is, but it seems unload should only be called when dnf version is < 2.

Comment 1 Jen C 2017-12-01 16:35:09 UTC
I also have this issue with Fedora 26, Spacewalk client 2.7 and Spacewalk Server 2.7. /var/log/up2date looks like:

[Thu Nov 30 16:14:55 2017] up2date Updating package profile
[Thu Nov 30 16:18:06 2017] up2date D: check_action{'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>errata.update</methodName>\n<params>\n<
param>\n<value><array><data>\n<value><int>947</int></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 491}
[Thu Nov 30 16:18:06 2017] up2date updateLoginInfo() login info
[Thu Nov 30 16:18:06 2017] up2date D: login(forceUpdate=True) invoked
[Thu Nov 30 16:18:06 2017] up2date logging into up2date server
[Thu Nov 30 16:18:06 2017] up2date D: rpcServer: Calling XMLRPC up2date.login
[Thu Nov 30 16:18:06 2017] up2date D: writeCachedLogin() invoked
[Thu Nov 30 16:18:06 2017] up2date D: Wrote pickled loginInfo at 1512083886.1615386 with expiration of 1512087486.1615386 seconds.
[Thu Nov 30 16:18:06 2017] up2date successfully retrieved authentication token from up2date server
[Thu Nov 30 16:18:06 2017] up2date D: logininfo:{'X-RHN-Server-Id': 1000010006, 'X-RHN-Auth-Server-Time': '1512083887.63', 'X-RHN-Auth-Channels': [['f
edora_26_parent', '20171128123722', '1', '1'], ['fedora_26', '20171130120000', '0', '1']], 'X-RHN-Auth': 'mHq+l7p29GaW5LHVZZ1qUX1cu4NJG87gLn3vVi9xCxo=
', 'X-RHN-Auth-User-Id': '', 'X-RHN-Auth-Expire-Offset': '3600.0'}
[Thu Nov 30 16:18:06 2017] up2date D: handle_action{'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>errata.update</methodName>\n<params>\n
<param>\n<value><array><data>\n<value><int>947</int></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 491}
[Thu Nov 30 16:18:06 2017] up2date D: handle_action actionid = 491, version = 2
[Thu Nov 30 16:18:06 2017] up2date D: do_call errata.update([947],){'cache_only': None}
[Thu Nov 30 16:18:06 2017] up2date D: rpcServer: Calling XMLRPC errata.getErrataInfo
[Thu Nov 30 16:18:06 2017] up2date D: Called update[['wget', '1.19.2', '1.fc26', '', 'x86_64']]
[Thu Nov 30 16:18:06 2017] up2date D: rpcServer: Calling XMLRPC up2date.listChannels
[Thu Nov 30 16:18:15 2017] up2date D: Dependencies Resolved
[Thu Nov 30 16:18:15 2017] up2date D: Downloading and installing: ['wget-1.19.2-1.fc26.x86_64']
[Thu Nov 30 16:18:15 2017] up2date D: Removing: ['wget-1.19.1-3.fc26.x86_64']
[Thu Nov 30 16:18:16 2017] up2date Updating package profile
[Thu Nov 30 16:18:16 2017] up2date D: rpcServer: Calling XMLRPC registration.welcome_message
[Thu Nov 30 16:18:16 2017] up2date D: rpcServer: Calling XMLRPC registration.update_packages
[Thu Nov 30 16:18:17 2017] up2date 
Traceback (most recent call last):
  File "/usr/sbin/rhn_check", line 382, in __run_action
    (status, message, data) = CheckCli.__do_call(method, params, kwargs)
  File "/usr/sbin/rhn_check", line 375, in __do_call
    retval = method(*params, **kwargs)
  File "/usr/share/rhn/actions/errata.py", line 79, in update
    return packages.update(packagelist, cache_only)
  File "/usr/share/rhn/actions/packages.py", line 132, in update
    return _dnf_transaction(base, install=to_install, cache_only=cache_only)
  File "/usr/share/rhn/actions/packages.py", line 338, in _dnf_transaction
    base._plugins.unload()
<class 'AttributeError'>: 'Plugins' object has no attribute 'unload'

[Thu Nov 30 16:18:17 2017] up2date D: Sending back response((6,), 'Fatal error in Python code occurred', {})
[Thu Nov 30 16:18:17 2017] up2date D: check_action{'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>errata.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><int>2005</int></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 492}
[Thu Nov 30 16:18:17 2017] up2date updateLoginInfo() login info
[Thu Nov 30 16:18:17 2017] up2date D: login(forceUpdate=True) invoked
[Thu Nov 30 16:18:17 2017] up2date logging into up2date server
[Thu Nov 30 16:18:17 2017] up2date D: rpcServer: Calling XMLRPC up2date.login
[Thu Nov 30 16:18:17 2017] up2date D: writeCachedLogin() invoked
[Thu Nov 30 16:18:17 2017] up2date D: Wrote pickled loginInfo at 1512083897.2034855 with expiration of 1512087497.2034855 seconds.
[Thu Nov 30 16:18:17 2017] up2date successfully retrieved authentication token from up2date server
[Thu Nov 30 16:18:17 2017] up2date D: logininfo:{'X-RHN-Server-Id': 1000010006, 'X-RHN-Auth-Server-Time': '1512083898.67', 'X-RHN-Auth-Channels': [['fedora_26_parent', '20171128123722', '1', '1'], ['fedora_26', '20171130120000', '0', '1']], 'X-RHN-Auth': '4bw8pKeervTAFRtVfiVzsWpEbqJl5TNM5zD7dHK8mUY=', 'X-RHN-Auth-User-Id': '', 'X-RHN-Auth-Expire-Offset': '3600.0'}
[Thu Nov 30 16:18:17 2017] up2date D: handle_action{'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>errata.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><int>2005</int></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 492}
[Thu Nov 30 16:18:17 2017] up2date D: handle_action actionid = 492, version = 2
[Thu Nov 30 16:18:17 2017] up2date D: do_call errata.update([2005],){'cache_only': None}
[Thu Nov 30 16:18:17 2017] up2date D: rpcServer: Calling XMLRPC errata.getErrataInfo
[Thu Nov 30 16:18:17 2017] up2date D: Called update[['emacs-filesystem', '25.3', '3.fc26', '1', 'noarch']]
[Thu Nov 30 16:18:17 2017] up2date 
Traceback (most recent call last):
  File "/usr/sbin/rhn_check", line 382, in __run_action
    (status, message, data) = CheckCli.__do_call(method, params, kwargs)
  File "/usr/sbin/rhn_check", line 375, in __do_call
    retval = method(*params, **kwargs)
  File "/usr/share/rhn/actions/errata.py", line 79, in update
    return packages.update(packagelist, cache_only)
  File "/usr/share/rhn/actions/packages.py", line 74, in update
    base = _dnf_base(load_system_repo=True, load_available_repos=True)
  File "/usr/share/rhn/actions/packages.py", line 275, in _dnf_base
    base.init_plugins()
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 235, in init_plugins
    self._plugins._load(self.conf, disabled_glob, enable_plugins)
  File "/usr/lib/python3.6/site-packages/dnf/plugin.py", line 111, in _load
    raise RuntimeError("load_plugins() called twice")
<class 'RuntimeError'>: load_plugins() called twice

Comment 2 Aran Cox 2017-12-01 17:17:04 UTC
I upgraded to the version from copr and problem solved, the real issue is the renaming of the unload function which is already fixed.

https://copr.fedorainfracloud.org/coprs/g/spacewalkproject/nightly-client/packages/

Comment 3 Tomáš Kašpárek 2017-12-21 08:23:19 UTC
fixed by commit: 2873201977cc094161b3e856f56ac5db3b866057

Comment 4 Jiří Dostál 2018-03-26 12:16:42 UTC
Moving ON_QA

Comment 5 Jiří Dostál 2018-04-20 12:31:46 UTC
Spacewalk 2.8 has been released.
https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes28


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