Bug 1094526

Summary: reposync.py SQL query incorrectly terminated for Oracle
Product: [Community] Spacewalk Reporter: Avi Miller <avi.miller>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.2CC: dyordano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-2.2.28-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-17 08:40:49 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: 1119298    

Description Avi Miller 2014-05-05 22:27:41 UTC
Description of problem:

The recent update for reposync.py to provide the -l/--list option terminates the query with a semi-colon, which is invalid on Oracle database.


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

Added in commit 5775e76647587f545ebc4d71ec8ec91ba1c98b00 on Github: https://github.com/spacewalkproject/spacewalk/commit/5775e76647587f545ebc4d71ec8ec91ba1c98b00


How reproducible:

100%

Steps to Reproduce:
0. Install Spacewalk HEAD with an Oracle database backend
1. Setup a yum repository
2. Setup a software channel
3. Link the repository to the software channel
4. Attempt to run spacewalk-reposync

Actual results:

[root@ca-spacewalk-server-ol6-x86_64-test ~]# spacewalk-repo-sync
Traceback (most recent call last):
  File "/usr/bin/spacewalk-repo-sync", line 138, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/bin/spacewalk-repo-sync", line 98, in main
    d_chan_repo=reposync.getChannelRepo()
  File
"/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/reposync.py", line
59, in getChannelRepo
    h.execute()
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py",
line 163, in execute
    return apply(self._execute_wrapper, (self._execute, ) + p, kw)
  File
"/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_cx_Oracle.py",
line 108, in _execute_wrapper
    retval = apply(function, p, kw)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py",
line 217, in _execute
    return self._execute_(args, kwargs)
  File
"/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_cx_Oracle.py",
line 161, in _execute_
    self._real_cursor.execute(*(None, ), **params)
spacewalk.server.rhnSQL.sql_base.SQLStatementPrepareError: ('ORA-00911: invalid
character\n', 911, 'select s.source_url, c.label from rhnContentSource s,
rhnChannelContentSource cs, rhnChannel c where s.id = cs.source_id and
cs.channel_id=c.id;')


Expected results:

[root@ca-spacewalk-server-ol6-x86_64-test ~]# spacewalk-repo-sync -l
======================================
|   Channel Label   |   Repository   |
======================================
oraclelinux6-x86_64-mysql | http://public-yum.oracle.com/repo/OracleLinux/OL6/MySQL/x86_64/
oraclelinux6-x86_64-server | http://public-yum.oracle.com/repo/OracleLinux/OL6/spacewalk20/server/x86_64/
...


Additional info:

Prepared statements for Oracle shouldn't be terminated by a semi-colon.

Comment 1 Avi Miller 2014-05-05 23:17:04 UTC
Pull request with fix: https://github.com/spacewalkproject/spacewalk/pull/60

Comment 2 Michael Mráka 2014-06-06 09:05:29 UTC
Merged to spacewalk master as

commit 3b7527b6277b103290b504ea532200f347524984
    1094526 - remove trailing semi-colon from SQL query as this breaks Oracle support.

Comment 3 Milan Zázrivec 2014-07-17 08:40:49 UTC
Spacewalk 2.2 has been released:

    https://fedorahosted.org/spacewalk/wiki/ReleaseNotes22