Bug 687903

Summary: API Documentation for system.isNvreInstalled
Product: Red Hat Satellite 5 Reporter: Stephan Dühr <stephan.duehr>
Component: APIAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Minar <mminar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 541CC: cperry, mkoci, mminar, tkasparek
Target Milestone: ---Keywords: EasyFix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 21:56:54 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: 924232    

Description Stephan Dühr 2011-03-15 17:11:44 UTC
Description of problem:

API Documentation for system.isNvreInstalled says:

Returns:

    * int - 1 on success, exception thrown otherwise. 

That is incorrect, it does not throw an exception,
instead 0 is returned if the given package is not installed.

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

spacewalk-java-1.2.39-35.1.el5sat

How reproducible:

call system.isNvreInstalled with a package that is not
installed on the target system. It will return 0.

Look at
https://your.rhn.sat/rhn/apidoc/handlers/SystemHandler.jsp#isNvreInstalled

Steps to Reproduce:
1. call system.isNvreInstalled
2. Look at API Documentation for system.isNvreInstalled
3.
  
Actual results:

Returns:

    * int - 1 on success, exception thrown otherwise. 


Expected results:

Returns:

    * int - 1 if the package is installed, 0 otherwise. 


Additional info:

Alternatively, the API could be changed to behave as documented.
I think the documentation should be corrected. An exception should
only be thrown if an error occured so that it could not be determined
if the package is installed or not.

Comment 1 Stephan Dühr 2011-03-15 17:15:15 UTC
Here is an example:

>>> r = client.system.isNvreInstalled(session, 1000011088, "rpm-python", "4.4.2.3","18.el5")
>>> r
1
>>> r = client.system.isNvreInstalled(session, 1000011088, "rpm-python", "4.4.5.3","18.el5")
>>> r
0

Comment 2 Tomas Lestach 2011-03-23 11:25:30 UTC
NoSuchSystemException is thrown, when you specify non-existing serverId. But right, information about 0 value returned is missing.

Comment 3 Stephan Dühr 2012-08-16 12:25:15 UTC
This is not yet correctly documented in Satellite 5.4.1 and also in Spacewalk 1.7 (don't know about 1.8).

Comment 4 Tomáš Kašpárek 2013-06-25 08:05:31 UTC
committed changes of documentation to spacewalk.git: 63a8f286ff671908440b21473a3112fdd534474f

Comment 7 Clifford Perry 2013-10-01 21:56:54 UTC
Satellite 5.6 has been released. This bug was tracked under the release.  

This bug was either VERIFIED or RELEASE_PENDING (re-verified prior shortly
before release). 

Moving to CLOSED CURRENT_RELEASE. 

Text from Upgrade Erratum follows:

Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1395.html