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

Bug 1727809

Summary: spacewalk-clone-by-date failed with 'unhandled internal exception: query did not return a unique result: 2
Product: Red Hat Satellite 5 Reporter: Jan Jansky <jjansky>
Component: OtherAssignee: Michael Mráka <mmraka>
Status: CLOSED ERRATA QA Contact: Radovan Drazny <rdrazny>
Severity: medium Docs Contact:
Priority: medium    
Version: 580CC: ktordeur, rdrazny, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-java-2.5.14-133-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-09-18 02:49:47 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:

Description Jan Jansky 2019-07-08 08:42:30 UTC
Description of problem:
spacewalk-clone-by-date will fail when there are multiple erratas in the database with the same advisory. spacewalk-clone-by-date should be prepared for advisory in multiple organizations or database should not allow this.

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


How reproducible:
We are not sure how it happened for customer but he have same advisory with multiple org_ids.

for example in rhnerrata
  id   |     advisory       |    org_id
------------------------------------------
 12720 | CL-SA-2019:0818-1  |      1
 12721 | CL-SA-2019:0818-1  |      


Actual results:
Traceback (most recent call last):
  File "/usr/bin/spacewalk-clone-by-date", line 429, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/spacewalk-clone-by-date", line 419, in main
    return cloneByDate.main(args)
  File "/usr/share/rhn/utils/cloneByDate.py", line 282, in main
    cloner.clone(options.skip_depsolve)
  File "/usr/share/rhn/utils/cloneByDate.py", line 465, in clone
    cloner.process()
  File "/usr/share/rhn/utils/cloneByDate.py", line 650, in process
    self.clone()
  File "/usr/share/rhn/utils/cloneByDate.py", line 754, in clone
    self.remote_api.clone_errata(self.to_label, errata_set)
  File "/usr/share/rhn/utils/cloneByDate.py", line 897, in clone_errata
    errata_list)
  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: query did not return a unique result: 2'>

Expected results:
######################################## - complete
Processing Dependencies:
________________________________________
######################################## - complete

Additional info:
We have fixed that for customer with steps as https://access.redhat.com/solutions/4269712

Comment 5 Michael Mráka 2019-07-17 09:46:02 UTC
Fixed in upstream spacewalk git by
commit 9abd0e44c05a6852daff2422fde612a49e7d07a9
    1727809 - prefer errata from this org

Comment 7 Michael Mráka 2019-08-07 09:53:38 UTC
Backported to SATELLITE-5.8 as
commit 1e8f0145414d088a435cd9b1042f8c34e6376513
    1727809 - prefer errata from this org

Comment 9 Radovan Drazny 2019-09-09 11:53:45 UTC
Reproduced the issue on spacewalk-java-2.5.14-132 with the same result as described in the initial comment.

[root@dc2rhn1 rhel-x86_64-server-7]# spacewalk-clone-by-date --channels rhel-x86_64-server-7 clone-rhel-x86_64-server-7 --username satadmin --password redhat --to_date=2019-01-14
Reading repository information.
Using issue_date.

By continuing the following channels will be created:
clone-rhel-x86_64-server-7

Continue with channel creation (y/n)?y

Cloning rhel-x86_64-server-7 to clone-rhel-x86_64-server-7 with original package set.
Copying repodata, please wait.
Solving Dependencies (4403):
<snip>
698 RPM(s) added to clone-rhel-x86_64-server-7 to resolve dependencies.
28 errata added to clone-rhel-x86_64-server-7 to resolve dependencies.
Please see /var/log/rhn/errata-clone.log for details.

By continuing the following will be cloned:
  rhel-x86_64-server-7 -> clone-rhel-x86_64-server-7  (3419/3563 Errata)

Continue with clone (y/n)?y

Cloning Errata into clone-rhel-x86_64-server-7 (3419):
________________________________________
###Traceback (most recent call last):
  File "/usr/bin/spacewalk-clone-by-date", line 429, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/spacewalk-clone-by-date", line 419, in main
    return cloneByDate.main(args)
  File "/usr/share/rhn/utils/cloneByDate.py", line 282, in main
    cloner.clone(options.skip_depsolve)
  File "/usr/share/rhn/utils/cloneByDate.py", line 465, in clone
    cloner.process()
  File "/usr/share/rhn/utils/cloneByDate.py", line 650, in process
    self.clone()
  File "/usr/share/rhn/utils/cloneByDate.py", line 754, in clone
    self.remote_api.clone_errata(self.to_label, errata_set)
  File "/usr/share/rhn/utils/cloneByDate.py", line 897, in clone_errata
    errata_list)
  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: query did not return a unique result: 2'>



After update to spacewalk-java-2.5.14-133, the channel was cloned successfully.

[root@dc2rhn1 rpms]# spacewalk-clone-by-date --channels rhel-x86_64-server-7 clone-rhel-x86_64-server-7 --username satadmin --password redhat --to_date=2019-01-14
Reading repository information.
Using issue_date.

By continuing the following channels will be created:
clone-rhel-x86_64-server-7

Continue with channel creation (y/n)?y

Cloning rhel-x86_64-server-7 to clone-rhel-x86_64-server-7 with original package set.
Copying repodata, please wait.
Solving Dependencies (4403):
<snip>
698 RPM(s) added to clone-rhel-x86_64-server-7 to resolve dependencies.
28 errata added to clone-rhel-x86_64-server-7 to resolve dependencies.
Please see /var/log/rhn/errata-clone.log for details.

By continuing the following will be cloned:
  rhel-x86_64-server-7 -> clone-rhel-x86_64-server-7  (3419/3563 Errata)

Continue with clone (y/n)?y

Cloning Errata into clone-rhel-x86_64-server-7 (3419):
________________________________________
######################################## - complete
Copying repodata, please wait.
Solving Dependencies (18218):
________________________________________
######################################## - complete
Processing Dependencies:
________________________________________
######################################## - complete

VERIFIED

Comment 11 errata-xmlrpc 2019-09-18 02:49:47 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-2019:2783