Bug 659364

Summary: packages.listFiles() does not list objects without checksums (directories, links)
Product: Red Hat Satellite 5 Reporter: Milan Zázrivec <mzazrivec>
Component: APIAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED ERRATA QA Contact: Šimon Lukašík <slukasik>
Severity: medium Docs Contact:
Priority: high    
Version: 540CC: cperry, jkastner, luc, slukasik, tlestach
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The API call packages.listFiles() did not list package objects which have by definition no checksums (directories, symbolic links). This update ensures all package objects are returned, including those without checksums.
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-16 15:44:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 646488    

Description Milan Zázrivec 2010-12-02 16:19:11 UTC
Description of problem:
API call packages.listFiles() would not return package objects which
have (by definition) no checksum (directories, symbolic links).

Version-Release number of selected component (if applicable):
spacewalk-java-1.2.39-29 / stock Satellite 5.4

How reproducible:
Always

Steps to Reproduce:
1. Satellite 5.4, some content imported
2. Find a package id of a package which is known to contain directory
   in its file list
3. Use following script to see whether or not are the package directories
   contained in the file list returned by packages.listFiles():
...
#!/usr/bin/perl

use strict;
use warnings;

use Frontier::Client;
use Data::Dumper;

my $HOST = 'satellite.domain.com';
my $user = 'user';
my $pass = 'password';
my $pid = 0;

my $client = new Frontier::Client(url => "https://$HOST/rpc/api");
my $session = $client->call('auth.login',$user, $pass);
my $pkglist = $client->call('packages.list_files', $session, $pid);
print Dumper($pkglist);
$client->call('auth.logout', $session);
...
  
Actual results:
packages.listFiles() does not return package objects without checksums.

Expected results:
packages.listFiles() will return package objects without checksums.

Additional info:
From com/redhat/rhn/common/db/datasource/xml/Package_queries.xml:

<mode name="package_files">
  <query params="pid">
SELECT C.name,
       F.file_size,
       CS.checksum,
       CS.checksum_type checksumtype,
       F.file_mode,
       F.linkto,
       TO_CHAR(F.mtime, 'YYYY-MM-DD HH24:MI:SS') AS MTIME
  FROM rhnPackageFile F, rhnPackageCapability C,
       rhnChecksumView CS
 WHERE F.package_id = :pid
   AND F.capability_id = C.id
   AND F.checksum_id = CS.id
ORDER BY UPPER(C.name)
  </query>
</mode>

Use of the inner join in the above statement is incorrect.

Comment 4 Milan Zázrivec 2010-12-05 18:01:55 UTC
spacewalk.git master: 2ae1c1a73d332736e652cb9e2927d3d35aaa6f92

Comment 7 Šimon Lukašík 2010-12-09 13:27:51 UTC
Changing to VERIFIED:

Testing procedure:
Automated script.

Verified against:
spacewalk-java-1.2.39-33.el5sat

Comment 9 errata-xmlrpc 2010-12-16 15:44:36 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0991.html

Comment 10 Jaromir Hradilek 2010-12-16 16:35:49 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The API call packages.listFiles() did not list package objects which have by definition no checksums (directories, symbolic links). This update ensures all package objects are returned, including those without checksums.