Mike McCune wrote:
Mike McCune wrote:
When trying to register:

Exception Handler Information
Traceback (most recent call last):
   File "/usr/share/rhn/server/apacheServer.py", line 58, in __call__
     ret = f(req)
File "/usr/share/rhn/server/apacheHandler.py", line 72, in headerParserHandler
     rhnSQL.initDB()
   File "/usr/share/rhn/server/rhnSQL/__init__.py", line 97, in initDB
     __init__DB(backend, host, port, username, password, database)
   File "/usr/share/rhn/server/rhnSQL/__init__.py", line 57, in __init__DB
     if db == __DB.dsn: # this connection has been already made
NameError: global name 'db' is not defined

I changed the code to use the new incoming param database:

--- a/backend/server/rhnSQL/__init__.py
+++ b/backend/server/rhnSQL/__init__.py
@@ -54,7 +54,7 @@ def __init__DB(backend, host, port, username, password, database):
      else:
          del my_db

-    if db == __DB.dsn: # this connection has been already made
+    if database == __DB.dsn: # this connection has been already made
          __DB.check_connection()
          return
      __DB.commit()

but then get more errors later on:

Exception Handler Information
Traceback (most recent call last):
   File "/usr/share/rhn/server/apacheRequest.py", line 120, in call_function
     response = apply(func, params)
File "/usr/share/rhn/server/handlers/xmlrpc/registration.py", line 526, in new_system
     architecture, data)
File "/usr/share/rhn/server/handlers/xmlrpc/registration.py", line 373, in create_system
     newserv.save(0, channel)
   File "/usr/share/rhn/server/rhnServer/server_class.py", line 576, in save
     rhnSQL.transaction("save_server")
   File "/usr/share/rhn/server/rhnSQL/__init__.py", line 181, in transaction
     return db.transaction(name)
File "/usr/share/rhn/server/rhnSQL/driver_cx_Oracle.py", line 434, in transaction
     return self.execute("savepoint %s" % name)
AttributeError: Database instance has no attribute 'execute'


Looks like it was because you removed:

diff --git a/backend/server/rhnSQL/driver_cx_Oracle.py b/backend/server/rhnSQL/driver_cx_Oracle.py
index 2a38113..fd59cb9 100644
--- a/backend/server/rhnSQL/driver_cx_Oracle.py
+++ b/backend/server/rhnSQL/driver_cx_Oracle.py
@@ -490,12 +490,6 @@ class Database(sql_base.Database):
          # Pass the cursor in so we can close it after execute()
          return self._procedure_class(name, c)

-    # why would anybody need this?!
-    def execute(self, sql, *args, **kwargs):
-        cursor = self.prepare(sql)
-        apply(cursor.execute, args, kwargs)
-        return cursor
-

I added it back in and it worked.

Mike

FYI, I haven't committed/pushed this.  Just say the word and I will!

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to