Bug 1064296 - Reserved Oracle word used for repo-sync
Summary: Reserved Oracle word used for repo-sync
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space21
TreeView+ depends on / blocked
 
Reported: 2014-02-12 11:27 UTC by Mike
Modified: 2014-09-22 11:08 UTC (History)
2 users (show)

Fixed In Version: spacewalk-backend-2.1.51-1
Clone Of:
Environment:
Last Closed: 2014-03-04 13:07:03 UTC
Embargoed:


Attachments (Terms of Use)

Description Mike 2014-02-12 11:27:24 UTC
Description of problem:

Using repo-sync on the console I get the following error message:

[root@euedcapp0028 ~]# spacewalk-repo-sync -c centos_6_x86_64_base  -f  --sync-kickstart
Repo URL: ftp://ftp.ciril.fr/pub/linux/centos/6.4/os/x86_64
Packages in repo:              6381
No new packages to sync.
Repo ftp://ftp.ciril.fr/pub/linux/centos/6.4/os/x86_64 has 0 errata.
Retrieving .discinfo
ERROR: (1745, 'ORA-01745: invalid host/bind variable name\n', "insert into rhnKSTreeFile (kstree_id, relative_filename, checksum_id, file_size, last_modified, created, modified) values (:id, :path, lookup_checksum('sha256', :checksum), :size, epoch_seconds_to_timestamp_tz(:st_time), current_timestamp, current_timestamp)")
Sync completed.
Total time: 0:04:31

Regarding our Oracle DBA "size" is a reserved word in Oracle 11g PL/SQL
(see http://docs.oracle.com/cd/B28359_01/appdev.111/b31231/appb.htm#BABDFFBA)


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

How reproducible:

All time.

Steps to Reproduce:
1. run spacewalk-repo-sync -c <Channel Label> -f  --sync-kickstart
2.
3.

Actual results:
ERROR: (1745, 'ORA-01745)

Expected results:
Run w.o. erroor message.

Additional info:

Comment 1 Jan Pazdziora (Red Hat) 2014-02-14 14:45:01 UTC
Can you please check if applying the following patch fixes the issue?

diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index f3e2352..d336a88 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -620,7 +620,7 @@ class RepoSync(object):
 
         insert_h = rhnSQL.prepare("""
             insert into rhnKSTreeFile (kstree_id, relative_filename, checksum_id, file_size, last_modified, created, modified)
-            values (:id, :path, lookup_checksum('sha256', :checksum), :size, epoch_seconds_to_timestamp_tz(:st_time), current_timestamp, current_timestamp)
+            values (:id, :path, lookup_checksum('sha256', :checksum), :st_size, epoch_seconds_to_timestamp_tz(:st_time), current_timestamp, current_timestamp)
             """)
         dirs = [ '' ]
         while len(dirs) > 0:
@@ -646,7 +646,7 @@ class RepoSync(object):
                     print "Retrieving %s" % d + s
                     plug.get_file(d + s, os.path.join(CFG.MOUNT_POINT, ks_path))
                 st = os.stat(local_path)
-                insert_h.execute(id = ks_id, path = d + s, checksum = getFileChecksum('sha256', local_path), size = st.st_size, st_time = st.st_mtime)
+                insert_h.execute(id = ks_id, path = d + s, checksum = getFileChecksum('sha256', local_path), st_size = st.st_size, st_time = st.st_mtime)
 
         rhnSQL.commit()

Comment 2 Michael Mráka 2014-02-18 15:21:18 UTC
I've checked that above patch fixes the issue. Thanks.

Committed to spacewalk master as
commit fe9029fe397336c561f1be28deb5d9a2ad9fe6e7
    1064296 - rename variable so it doesn't colide with reserved word

Comment 3 Matej Kollar 2014-03-04 13:07:03 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21

Comment 4 Matej Kollar 2014-03-04 13:08:41 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21

Comment 5 Mike 2014-09-22 11:08:47 UTC
Hello,

That works for me.
Thanks

Michael


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