Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1445254

Summary: Can't remove a package from a system when it's not synced in the satellite using API. schedulePackageRemoveByNevra can not find it.
Product: Red Hat Satellite 5 Reporter: Lukáš Hellebrandt <lhellebr>
Component: APIAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED ERRATA QA Contact: Ales Dujicek <adujicek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: adujicek, jdostal, tkasparek, 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:57:18 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 Lukáš Hellebrandt 2017-04-25 11:16:38 UTC
Description of problem:
In WebUI, if a registered system has a package that is not on the Satellite, it can still be scheduled for removal. In API, however, I have not found a way to do this.

schedulePackageRemove requires package ID.
schedulePackageRemoveByNevra does not require package ID but still does not find the package (as it probably searches the database which does not contain it) and fails with (for antlr package):

Traceback (most recent call last):
  File "./z.py", line 9, in <module>
    res = client.system.schedulePackageRemoveByNevra(key,1000010001,[{'package_name': "antlr", 'package_epoch': "0", 'package_version': "2.7.7", 'package_release': "6.5.el6", 'package_arch': "x86_64"}], datetime.now())
  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 2300: 'redstone.xmlrpc.XmlRpcFault: Invalid package: antlr'>


How reproducible:
Deterministic

Steps to Reproduce:
For an existing system with antlr-2.7.7-6.5.el6:0 package installed and not synced to satellite, in python:
client.system.schedulePackageRemoveByNevra(key,<SYSTEMID>,[{'package_name': "antlr", 'package_epoch': "0", 'package_version': "2.7.7", 'package_release': "6.5.el6", 'package_arch': "x86_64"}], datetime.now())

Actual results:
Nothing scheduled, traceback

Expected results:
Package removal scheduled

Additional info:
This operation can be done using WebUI so I think it should also be possible using API

Comment 2 Tomáš Kašpárek 2017-10-16 10:58:13 UTC
spacewalk.git(master): 641ee2ec292905c67dc93b6e40a6153fb989359c
spacewalk.git(master): f9f50d4bfddf9562dc302995753db4938fb8cbc1

Comment 8 errata-xmlrpc 2018-02-05 13:57:18 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