Bug 251374 - RFE: API call for listing systems with a particular package installed
RFE: API call for listing systems with a particular package installed
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API (Show other bugs)
520
All Linux
low Severity low
: ---
: ---
Assigned To: Brad Buckingham
Sayli Karmarkar
:
Depends On:
Blocks: 456996
  Show dependency treegraph
 
Reported: 2007-08-08 13:02 EDT by Máirín Duffy
Modified: 2009-09-10 15:52 EDT (History)
2 users (show)

See Also:
Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-10 15:52:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Máirín Duffy 2007-08-08 13:02:35 EDT
Description of problem:

The use case here is if you want to see not just which systems are subscribed to
the software channel for a particular product, but which of those systems
actually has the product installed.

With the API calls currently available in 420, this involves:

- grab a list of systems subscribed to the channel you're interested in
- iterate through the list of systems, calling listPackages and iterating
through each package list to see if any of the packages you care about are installed

This is fairly inefficient and would be made easier if there was a call such as
the following:

packages.listSystemsWithPackage(session, pid, sid)

or maybe

system.isPackageInstalled( session, pid, sid )

or even both?
Comment 1 Brad Buckingham 2009-02-04 14:19:51 EST
The following APIs should address this request:

system.listSystemsWithPackage - these APIs were added in Spacewalk 0.1 for inclusion in Satellite 5.3.0

system.isNvreaInstalled - APIs that already exist that can be used to determine if a specific package is installed.

Note: one of the desired pieces of information to be included in these APIs was the date the package was installed/modified on the machine.  After discussion with multiple members of the eng team and investigation in to the code, it doesn't appear that we currently have a mechanism to support this at this time.

------------------------------------------------------------------------------

Below are the API doc details on these APIs.

Method: listSystemsWithPackage
Description:
Lists the systems that have the given installed package

Parameters:

    * string sessionKey
    * int pid - the package id

Returns:

    * array:
          o struct - system
                + int "id"
                + string "name"
                + dateTime.iso8601 "last_checkin" - Last time server successfully checked in

Method: listSystemsWithPackage
Description:
Lists the systems that have the given installed package

Parameters:

    * string sessionKey
    * string name - the package name
    * string version - the package version
    * string release - the package release

Returns:

    * array:
          o struct - system
                + int "id"
                + string "name"
                + dateTime.iso8601 "last_checkin" - Last time server successfully checked in


---------------------------------------------------------------------------

For the second part of the request, the system.isNvreInstalled APIs will enable the user to determine if a specific package is installed on the system.

Method: isNvreInstalled
Description:
Check if the package with the given NVRE is installed on given system.

Parameters:

    * string sessionKey
    * int serverId
    * string name - Package name.
    * string version - Package version.
    * string release - Package release.

Returns:

    * int - 1 on success, exception thrown otherwise. 

Method: isNvreInstalled
Description:
Is the package with the given NVRE installed on given system.

Parameters:

    * string sessionKey
    * int serverId
    * string name - Package name.
    * string version - Package version.
    * string release - Package release.
    * string epoch - Package epoch.

Returns:

    * int - 1 on success, exception thrown otherwise.
Comment 2 Sayli Karmarkar 2009-02-16 14:38:32 EST
Added additional checks in API automation tests for above 4 APIs and verified.

~SayliK
Comment 3 Michael Mráka 2009-08-26 05:43:31 EDT
Verified in stage -> RELEASE_PENDING.

API calls exist and work.

$ ./xmlrpc-client.pl dell-pem710-01.rhts.eng.bos.redhat.com admin xxx system.listSystemsWithPackage 8853
      name = dhcp71-16.rhts.bos.redhat.com
        id = 1000010022
      name = dhcp71-16.rhts.bos.redhat.com
        id = 1000010023
      name = dhcp71-16.rhts.bos.redhat.com
        id = 1000010024
$ ./xmlrpc-client.pl dell-pem710-01.rhts.eng.bos.redhat.com admin xxx system.listSystemsWithPackage acl 2.2.39 3.el5
      name = dhcp71-16.rhts.bos.redhat.com
        id = 1000010022
      name = dhcp71-16.rhts.bos.redhat.com
        id = 1000010023
      name = dhcp71-16.rhts.bos.redhat.com
        id = 1000010024
$ ./xmlrpc-client.pl dell-pem710-01.rhts.eng.bos.redhat.com admin xxx  system.isNvreInstalled 1000010024 acl 2.2.39 3.el5 
OK
$ ./xmlrpc-client.pl dell-pem710-01.rhts.eng.bos.redhat.com admin xxx  system.isNvreInstalled 1000010024 perl 5.8.8 18.el5 4
OK
Comment 4 Brandon Perkins 2009-09-10 15:52:05 EDT
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/RHEA-2009-1434.html

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