Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1094526 - reposync.py SQL query incorrectly terminated for Oracle
Summary: reposync.py SQL query incorrectly terminated for Oracle
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space22
TreeView+ depends on / blocked
 
Reported: 2014-05-05 22:27 UTC by Avi Miller
Modified: 2014-07-17 08:40 UTC (History)
1 user (show)

Fixed In Version: spacewalk-backend-2.2.28-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-17 08:40:49 UTC
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.