Bug 616267 - system.ListPackages returns empty set for pre-RHEL 4.8 systems due to null package_arch_id
Summary: system.ListPackages returns empty set for pre-RHEL 4.8 systems due to null pa...
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 530
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Justin Sherrill
QA Contact: Michael Mráka
Depends On:
Blocks: sat540-blockers sat540-api, sat540-apis
TreeView+ depends on / blocked
Reported: 2010-07-20 00:30 UTC by Xixi
Modified: 2018-10-27 13:27 UTC (History)
6 users (show)

Clone Of:
Last Closed: 2010-10-28 14:53:11 UTC

Attachments (Terms of Use)

Description Xixi 2010-07-20 00:30:30 UTC
Description of problem:
For systems with OS older than RHEL 4.8 (such as RHEL 3 and older RHEL 4.x), the RHN API call system.listPackages returns an empty array.  This is due to the system profile having null package_arch_ids - see bottom for more background info.

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.3.0

How reproducible:

Steps to Reproduce:
1. Register a RHEL 3 or RHEL 4 (4.7 or earlier) system to 5.3 Satellite and up2date -p to update package profile.  Notice the "not specified" under architecture listing under System Details -> Software -> List packages.
2. Call system.listPackages API call on the system.

Actual results:
Empty array returned instead of array of installed pkgs.

Expected results:
Returns array of installed pkgs.

Additional info:
This is caused by an old bug where rhn client doesn't sending package architecture information during updates, which was fixed in RHEL 4.8 and RHEL 5. The bug was such that during initial registration, package arch info is sent to the Satellite and populated, however a profile refresh (such as "up2date -p" or installing pkgs via activation keys) will refresh package information minus the architecture, resulting in null package_arch_ids. This is why customer is only seeing older (RHEL release wise) systems being affected, and pkg/profile refresh doesn't help (in fact that's when they'll end up with null package arch ids).

The fix would be to update the clients to get the bugfix, and a workaround would be to re-register system, but do not use any activation keys to install packages, or schedule any package/profile refreshes.
(part of this came from https://bugzilla.redhat.com/show_bug.cgi?id=568958#c5 which is caused by the same thing)

Comment 1 Xixi 2010-07-20 00:32:05 UTC
As seen in the data query below, the API call returns empty b/c the underlying data query joins by package_arch_id, which is null for affected clients.

    public Object[] listPackages(String sessionKey, Integer sid) throws FaultException {
        // Get the logged in user and server
        User loggedInUser = getLoggedInUser(sessionKey);
        Server server = lookupServer(loggedInUser, sid);

        DataResult dr = SystemManager.installedPackages(server.getId());
        return dr.toArray();

    public static DataResult installedPackages(Long sid) {
        SelectMode m = ModeFactory.getMode("System_queries", "system_installed_packages",
        Map params = new HashMap();
        params.put("sid", sid);
        return m.execute(params);

<mode name="system_installed_packages">
  <query params="sid">
       NVL(PE.epoch, ' ') as epoch,
       PA.name as arch
  FROM rhnPackageName PN, rhnPackageEVR PE, rhnServerPackage SP, rhnPackageArch PA
 WHERE SP.server_id = :sid
   AND PN.id = SP.name_id
   AND PE.id = SP.evr_id
   AND PA.id = SP.package_arch_id
ORDER BY PN.name, PE.evr

Comment 3 Justin Sherrill 2010-07-26 19:28:48 UTC
Fixed in spacewalk master for satellite 5.4


Comment 4 Michael Mráka 2010-10-06 14:17:16 UTC

on client
# systemListPackages.py
[{'release': '3', 'epoch': ' ', 'version': '3.15.2', 'arch': 'AMD64', 'name': 'MAKEDEV'}, {'release': '34.4', 'epoch': ' ', 'version': '2.85', 'arch': 'AMD64', 'name': 'SysVinit'}, {'release': '32', 'epoch': ' ', 'version': '2.3', 'arch': 'AMD64', 'name': 'anacron'}, {'release': '4.EL4', 'epoch': '12', 'version': '0.50.5', 'arch': 'AMD64', 'name': 'aspell'}, {'release': '11', 'epoch': '50', 'version': '0.51', 'arch': 'AMD64', 'name': 'aspell-en'},

on server
# rpm -q spacewalk-java

Comment 7 Clifford Perry 2010-10-28 14:48:23 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 

RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade

RHEA-2010:0803 - RHN Tools enhancement update

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update

RHEA-2010:0800 - RHN Satellite Server 5.4.0

Docs are available:



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