Bug 1482501

Summary: system.listSystemEvents API call doesn't return all items from system's history
Product: Red Hat Satellite 5 Reporter: Radovan Drazny <rdrazny>
Component: APIAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED ERRATA QA Contact: Martin Korbel <mkorbel>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: galtukho, jdostal, mkorbel, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-java-2.5.14-108-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-05 13:56:41 UTC Type: Bug
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: 1450111, 1450940    

Description Radovan Drazny 2017-08-17 12:33:50 UTC
Description of problem:
When comparing history displayed in the WebUI (../rhn/systems/details/history/History.do?sid=SID&) and list of history items returned by system.listSystemEvents API call, the API call is missing all items with status (n/a). 

Version-Release number of selected component (if applicable):
spacewalk-java-2.5.14-89.el6sat

How reproducible:
always


Steps to Reproduce:
1. Register a new system to a Satellite server
2. Check the ../rhn/systems/details/history/History.do?sid=SID& for the the system
3. Run client.system.listSystemEvents(key, SID) API call.

Actual results:
While there are two system events in the WebUI ("subscribed to channel rhel-x86_64-server-X" and  "added system entitlement"), result of the API call is empty.

Expected results:
API call returns a list containing same items as displayed in the WebUI. 

Additional info:
API call currently returns only items with a exit status (non n/a status). If you schedule a package install on the newly registered system, run rhn_check on the client, and then run system.listSystemEvents API call, you will get list containing only one item (package install that just finished). WebUI will contain three system items, of course (reg, entitlement and package install).

Comment 1 Jiří Dostál 2017-08-17 14:18:18 UTC
I suppose the behavior is correct. In UI when you visit '/rhn/schedule/*', you can list real *scheduled* events. On page '/rhn/systems/details/history/History.do' you get system event history, including items describing "what happened to the system" ie. "Subscription via Token". And I think System History != Events. API to get System History is getEventHistory(key, system_id). 

However, it is quite confusing in API documentation, where we have "List all system events for given server. This includes *all* events for the server since it was registered". 

It'd be nice to update API docs to keep it clear. Keeping BZ opened for docs update.

Comment 2 Tomas Lestach 2017-08-18 11:29:17 UTC
Jiri, feel free to update the docs within this BZ.

Comment 3 Gennadii Altukhov 2017-11-29 09:47:01 UTC
upstream fix, spacewalk.git:
c2e06af6f535f67660beda6eafa1fc6272a43a3c

Comment 6 Martin Korbel 2018-01-12 10:32:10 UTC
VERIFIED on spacewalk-java-2.5.14-108

listSystemEvents
List system actions of the specified type that were *scheduled* against the given server. "actionType" should be exactly the string returned in the action_type field from the listSystemEvents(sessionKey, serverId) method. For example, 'Package Install' or 'Initiate a kickstart for a virtual guest.' Note: see also system.getEventHistory method which returns a history of all events.

Comment 9 errata-xmlrpc 2018-02-05 13:56:41 UTC
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.

https://access.redhat.com/errata/RHBA-2018:0274