Bug 1172288 - web ui activation key
Summary: web ui activation key
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Clients
Version: 2.2
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Clifford Perry
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 1183989 space24
TreeView+ depends on / blocked
 
Reported: 2014-12-09 19:14 UTC by Slava
Modified: 2015-10-08 13:27 UTC (History)
6 users (show)

Fixed In Version: yum-rhn-plugin-2.4.4-1
Clone Of:
Environment:
Last Closed: 2015-10-08 13:27:21 UTC
Embargoed:


Attachments (Terms of Use)

Description Slava 2014-12-09 19:14:16 UTC
Hello Everyone, I tried specify in activation key which packages I want to install with host activation and rpm is not installed. In debug log I see that  it add -- to package name.


D: check_action{'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>packages.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><array><data>\n<value><string>bind</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>dhcp</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>foreman-proxy</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>syslinux</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>syslinux-nonlinux</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>tftp-server</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 0, 'id': 2607}
updateLoginInfo() login info
D: login(forceUpdate=True) invoked
logging into up2date server
D: rpcServer: Calling XMLRPC up2date.login
D: writeCachedLogin() invoked
D: Wrote pickled loginInfo at 1418149419.95 with expiration of 1418153019.95 seconds.
successfully retrieved authentication token from up2date server
D: logininfo:{'X-RHN-Server-Id': 1000010172, 'X-RHN-Auth-Server-Time': '1418149840.28', 'X-RHN-Auth': 'JdcKowTC76Au6Klzw83+dosy5sKA5i/+c4epqu/RjTM=', 'X-RHN-Auth-Channels': [['adm-oel6', '20141209050000', '1', '1'], ['adm-oel6-latest', '20141209040000', '0', '1'], ['adm-rhel-foreman', '20141117091213', '0', '1'], ['adm-oel6-update5', '20141209040000', '0', '1'], ['adm-epel6', '20141209000000', '0', '1'], ['adm-spacewalk', '20141209040635', '0', '1'], ['adm-vmware-tools', '20141209040632', '0', '1'], ['adm-oel6-addons', '20141203105617', '0', '1'], ['adm-elrepo-kernel-lt', '20141209080000', '0', '1']], 'X-RHN-Auth-User-Id': '', 'X-RHN-Auth-Expire-Offset': '3600.0'}
D: handle_action{'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>packages.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><array><data>\n<value><string>bind</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>dhcp</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>foreman-proxy</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>syslinux</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>syslinux-nonlinux</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n<value><array><data>\n<value><string>tftp-server</string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n<value><string></string></value>\n</data></array></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 0, 'id': 2607}
D: handle_action actionid = 2607, version = 0
D: do_call packages.update([['bind', '', '', '', ''], ['dhcp', '', '', '', ''], ['foreman-proxy', '', '', '', ''], ['syslinux', '', '', '', ''], ['syslinux-nonlinux', '', '', '', ''], ['tftp-server', '', '', '', '']],){'cache_only': None}
Loaded plugins: remove-with-leaves, rhnplugin
Config time: 0.061
D: rpcServer: Calling XMLRPC up2date.listChannels
This system is receiving updates from RHN Classic or Red Hat Satellite.
Setting up Package Sacks
pkgsack time: 0.399
rpmdb time: 0.000
repo time: 0.000
D: Called update[['bind', '', '', '', ''], ['dhcp', '', '', '', ''], ['foreman-proxy', '', '', '', ''], ['syslinux', '', '', '', ''], ['syslinux-nonlinux', '', '', '', ''], ['tftp-server', '', '', '', '']]
E: Package bind-- is not available for installation
E: Package dhcp-- is not available for installation
D: Package foreman-proxy is already installed
D: Package syslinux is already installed
D: Package syslinux-nonlinux is already installed
D: Package tftp-server is already installed
D: Sending back response(32, 'Failed: Packages failed to install properly:\nPackage bind-- is not available for installation\nPackage dhcp-- is not available for installation', {'version': '1', 'name': 'package_install_failure'})
D: do_call packages.checkNeedUpdate('rhnsd=1',){}
D: Called refresh_rpmlist
Updating package profile
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.update_packages
D: local action status: (0, 'rpmlist refreshed', {})
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.new_system
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.add_hw_profile
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.add_packages
D: rpcServer: Calling XMLRPC registration.virt_notify

Comment 1 Stephen Herr 2014-12-10 14:28:22 UTC
What OS and what version of rhn-client-tools is this happening on?

Comment 2 Slava 2014-12-10 16:12:17 UTC
OS OEL 6.5


[root@ca01fproxy00 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)


Installed Packages
Name        : rhn-client-tools
Arch        : noarch
Version     : 2.2.7
Release     : 1.el6
Size        : 1.7 M
Repo        : installed
From repo   : spacewalk-temp
Summary     : Support programs and libraries for Red Hat Satellite or Spacewalk
URL         : https://fedorahosted.org/spacewalk
License     : GPLv2
Description : Red Hat Satellite Client Tools provides programs and libraries to allow your
            : system to receive software updates from Red Hat Satellite or Spacewalk.

Comment 3 Stephen Herr 2014-12-11 20:26:40 UTC
I think the '--' is just added on due to poor error message construction, I think the real problem is that those yum can't find a version of those packages to install.

What is the result of 'yum list bind dhcp'?

Comment 4 Slava 2014-12-17 14:41:21 UTC
I think it is --. Here example of up2date log. If I install from yum no issue there at all

[Wed Dec 17 08:09:05 2014] up2date successfully retrieved authentication token from up2date server
[Wed Dec 17 08:09:28 2014] up2date E: Package java-1.7.0-openjdk-- is not available for installation


[root@ca01ts15 log]# yum list bind dhcp
Loaded plugins: langpacks, refresh-packagekit, remove-with-leaves, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Available Packages
bind.x86_64                                  32:9.9.4-16.P2.fc20                                   adm-fc20-updates
dhcp.x86_64                                  12:4.2.7-2.fc20                                       adm-fc20-updates
[root@ca01ts15 log]#

Comment 5 Stephen Herr 2014-12-17 18:45:53 UTC
That's a different machine. I was talking about bind and dhcp not being available on your client OEL 6 ca01fproxy00 machine, not your F20 machine (spacewalk server?).

Comment 6 Slava 2014-12-17 19:27:34 UTC
this that same repo from spacewalk on oel 6.5 and fedora 20. All infrastructure the same.

[root@ca01sprx00 ~]# yum list dhcp bind
Loaded plugins: remove-with-leaves, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
adm-elrepo-kernel-lt                                                                        | 1.0 kB     00:00
adm-epel6                                                                                   | 1.5 kB     00:00
adm-oel6                                                                                    | 1.2 kB     00:00
adm-oel6-addons                                                                             |  871 B     00:00
adm-oel6-latest                                                                             | 1.3 kB     00:00
Installed Packages
bind.x86_64                               32:9.8.2-0.30.rc1.el6                                    @adm-oel6-latest
dhcp.x86_64                               12:4.1.1-43.P1.0.1.el6                                   @adm-oel6-latest
Available Packages
bind.x86_64                               32:9.8.2-0.30.rc1.el6_6.1                                adm-oel6-latest
[root@ca01sprx00 ~]#

Comment 7 Paul Wayper 2015-01-27 02:21:17 UTC
See also https://bugzilla.redhat.com/show_bug.cgi?id=1183989

Comment 8 Slava 2015-01-27 03:12:51 UTC
Unfortunately, I don't access to view this bug report.

Comment 9 Martin Schuppert 2015-04-11 13:37:35 UTC
Yes, it is the same issue as BZ1183989 . I had the same issue kickstart a Centos 7.1 from a spacewalk 2.2 and try to install bind, dhcp and postfix-perl-scripts using the package section in the activation key.

From up2date log:
[Sat Apr 11 11:12:47 2015] up2date updateLoginInfo() login info
[Sat Apr 11 11:12:47 2015] up2date logging into up2date server
[Sat Apr 11 11:12:47 2015] up2date successfully retrieved authentication token from up2date server
[Sat Apr 11 11:12:47 2015] up2date E: Package bind-- is not available for installation
[Sat Apr 11 11:12:47 2015] up2date E: Package dhcp-- is not available for installation
[Sat Apr 11 11:12:47 2015] up2date E: Package postfix-perl-scripts-- is not available for installation
[Sat Apr 11 11:12:47 2015] up2date Updating package profile

I got this working by downgrade yum-rhn-plugin from yum-rhn-plugin-2.2.6-1.el7 to 

$ rpm -q yum-rhn-plugin
yum-rhn-plugin-2.0.1-5.el7.noarch

The issue here is that in update(), yum_base.pkgSack.searchNevra ( /usr/share/rhn/actions/packages.py ) do not find the bind package if the epoch is part of the search: 

    360         if not found:
    361             available = yum_base.pkgSack.searchNevra(name=pkgkeys['name'], arch=pkgkeys['arch'],
    362                         epoch=pkgkeys['epoch'], ver=pkgkeys['version'], rel=pkgkeys['release'])

This must be something package specific, since it do work for other packages (e.g. samba). Added some debug output to update

[Sat Apr 11 14:58:02 2015] up2date Called update[['a2ps', '', '', '', ''], ['bind', '', '', '', ''], ['dhcp', '', '', '', ''], ['nfs4-acl-tools', '', '', '', ''], ['postfix-perl-scripts', '', '', '', ''], ['samba', '', '', '', '']]

do not work:
pkg = yb.pkgSack.searchNevra(name='bind', arch='', epoch='0', ver='', rel='')

work:
pkg = yb.pkgSack.searchNevra(name='samba', arch='', epoch='0', ver='', rel='')

Looking at the packages which work/not work we see that e.g. samba do not have epoch information, but bind have:
$ yum info samba
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
 * epel: mirrors.n-ix.net
Installed Packages
Name        : samba
Arch        : x86_64
Version     : 4.1.12
Release     : 21.el7_1
Size        : 1.6 M
Repo        : installed
From repo   : centos7-x86_64
Summary     : Server and Client software to interoperate with Windows machines
URL         : http://www.samba.org/
License     : GPLv3+ and LGPLv3+
Description : Samba is the standard Windows interoperability suite of programs for Linux and Unix.

$ yum info bind
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
 * epel: mirrors.n-ix.net
Installed Packages
Name        : bind
Arch        : x86_64
Epoch       : 32
Version     : 9.9.4
Release     : 18.el7_1.1
Size        : 4.3 M
Repo        : installed
From repo   : centos7-x86_64-updates
Summary     : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
URL         : http://www.isc.org/products/BIND/
License     : ISC
Description : ...

$ yum info dhcp
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
 * epel: mirrors.n-ix.net
Installed Packages
Name        : dhcp
Arch        : x86_64
Epoch       : 12
Version     : 4.2.5
Release     : 36.el7.centos
Size        : 1.4 M
Repo        : installed
From repo   : centos7-x86_64
Summary     : Dynamic host configuration protocol software
URL         : http://isc.org/products/DHCP/
License     : ISC
Description : ...

With this the issue is:
    339         if pkgkeys['epoch'] == '':
    340             pkgkeys['epoch'] = '0'

Is the epoch number important to check the availability of the package? I guess no since we only want to check _if_ there is a e.g. bind package available.

Comment 10 Matej Kollar 2015-04-16 12:16:12 UTC
Spacewalk.git:

* 83330778915bb8e5f70beed5ed3a280d2c1bbabb
  1172288 - Unspecified epoch is not epoch = '0'

Martin: Thanks for great work (finding highest version where it still worked).

Comment 11 Matej Kollar 2015-04-28 15:21:41 UTC
Spacewalk.git:
* d8b551964a5a0e58d2fbad1f81aafd95e15fbcea
  1172288 - One more occurrence of bad epoch interpretation

Comment 12 Stephen Herr 2015-05-08 15:41:36 UTC
Okay, so some explanation:
1) As far as yum's python api is concerned, an rpm with no epoch == an rpm with epoch '0'.
2) Searching for an rpm with epoch='0' means "find all matching results where the rpm's epoch == 0 or is unspecified in rpm spec".
3) Searching for an rpm with epoch=None means "we don't care what the epoch is".
4) The result of an rpm search will always have a non-None epoch, with epoch=='0' if there is no epoch specified in rpm spec.

So: the commit in comment 10 where you change unspecified epoch from '0' to None is correct, because we are passing that value in to searchNevra and if the epoch is unspecified we want to say "we don't care what the epoch is".

But: the commit in comment 11 where you change unspecified epoch from '0' to None is wrong, because in that case we are comparing a search result from yum (which always has a non-None epoch) with a None epoch, which will never match even though it's supposed to.

Reverting commit in comment 11 in Spacewalk master:
d4c2e768d236be29db5ffaea15c50a37c5ff41a1

Comment 13 Stephen Herr 2015-05-08 16:11:43 UTC
Oh, reverting the commit in commant 11 is not sufficient, because even though most rpms have an unspecified epoch (which means comparing with '0' will work fine most of the time), some rpms have a non-0 epoch, and we want the comparison to work correctly with them as well.

The code in this method (update) is trying to see if an equal to or greater than version of the package that we're trying to update is already installed. If Spacewalk is telling yum to upgrade to vim-enhanced-1-2.noarch for example, and you already have vim-enhanced-1-3.noarch installed, then there is nothing to be done. So the code is doing a search for installed packages where name and arch match, and then looping through the results to see if evr of installed package is >= evr of package we're trying to upgrade to.

The problem is that if we haven't specified the 'e' part of evr (epoch), then the old code assumes '0' (which is usually right but not always), and the new code assumes None (which is never right). 

This is actually probably a bug in Yum, because evr comparison is inconsistent with the equals definition:
$ python
>>> import yum
>>> evr1 = yum.packages.PackageEVR('0', '1', '1')
>>> evr2 = yum.packages.PackageEVR(None, '1', '1')
>>> evr1 == evr2
False
>>> evr1.compare(evr2)
0

It seems to me that the "compare" result is correct and follows the larger yum-api convention of "None means we don't care". 

I will un-revert the commit in comment 11 so that unspecified epoch == None, and then change the code so that we're using 'compare' instead of '=='. This should cause the comparison to have the desired results, whether we specify epoch or not.

Committing to Spacewalk master:
0ea1cfa4fbced0eac22b1bc3d6eed9ba0f3d0642
7d21eba060408ed436b383235e06faa605260a1a

Comment 15 Jan Dobes 2015-10-08 13:27:21 UTC
Spacewalk 2.4 has been released.


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