Bug 1455880

Summary: failSystemAction does not check system action id
Product: Red Hat Satellite 5 Reporter: Ales Dujicek <adujicek>
Component: APIAssignee: Jiří Dostál <jdostal>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: jdostal, lhellebr, tkasparek, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-java-2.5.14-102-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-13 07:58:38 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    

Description Ales Dujicek 2017-05-26 11:16:13 UTC
Description of problem:

API call schedule.failSystemAction does not check if the action ID is valid
if it is not, it fail: unhandled internal exception: null

I would expect error message like: cannot find system %s action %d...

schedule.failSystemAction(key, SID, AID, "error message")
Traceback (most recent call last):
  File "bz1452080.py", line 15, in <module>
    print client.schedule.failSystemAction(key, SID, AID, "error message")
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault -1: 'redstone.xmlrpc.XmlRpcFault: unhandled internal exception: null'>


import sys
import xmlrpclib

client = xmlrpclib.Server('http://localhost/rpc/api')
key = client.auth.login('ales', 'nimda')

SID=int(sys.argv[1])
AID=int(sys.argv[2])

print client.schedule.failSystemAction(key, SID, AID, "error message")


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

How reproducible:
always

Comment 1 Jiří Dostál 2017-07-20 13:51:33 UTC
spacewalk 70abf819db8c46be2b6d4579dae60269ef246e04

Comment 3 Lukáš Hellebrandt 2017-11-13 15:12:00 UTC
Verified with spacewalk-java-2.5.14-104.

Calls client.schedule.failSystemAction(<key>,<SID>,<AID>) and client.schedule.failSystemAction(<key>,<SID>,<AID>,<message>) work and when attempting to remove an action that does not exist, they stop with:

Traceback (most recent call last):
  File "./test.py", line 7, in <module>
    client.schedule.failSystemAction(key,1000010000,6)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault -1: 'redstone.xmlrpc.XmlRpcFault: unhandled internal exception: Could not find action 6 on system 1000010000'>

... which is correct.

Comment 6 errata-xmlrpc 2017-12-13 07:58:38 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-2017:3445