Description of problem: [root@10 ~]# rpm -q pulp pulp-0.0.112-1 [root@10 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.5 (Tikanga) [root@10 ~]# [root@10 ~]# service pulp-server restart Stopping httpd: [FAILED] Stopping Qpid AMQP daemon: [FAILED] Stopping mongod: [ OK ] Pulp database not initialized, please run: /etc/init.d/pulp-server init [root@10 ~]# service pulp-server init Starting mongod: [ OK ] Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 19, in ? from pulp.server.db.migrate import script File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py", line 21, in ? from pulp.server import auditing File "/usr/lib/python2.4/site-packages/pulp/server/auditing.py", line 18, in ? import functools ImportError: No module named functools [root@10 ~]# pulp-migrate Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 19, in ? from pulp.server.db.migrate import script File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py", line 21, in ? from pulp.server import auditing File "/usr/lib/python2.4/site-packages/pulp/server/auditing.py", line 18, in ? import functools ImportError: No module named functools
functools was not added until python 2.5. I don't see any reason we can't remove the use of this package but, I want to discuss with Jason Connor first.
Commented out references to functools and got: [root@unused ~]# service pulp-server init Starting mongod: [ OK ] Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 19, in ? from pulp.server.db.migrate import script File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py", line 21, in ? from pulp.server import auditing File "/usr/lib/python2.4/site-packages/pulp/server/auditing.py", line 32, in ? from pulp.server.api.base import BaseApi File "/usr/lib/python2.4/site-packages/pulp/server/api/base.py", line 16, in ? from pulp.server import async File "/usr/lib/python2.4/site-packages/pulp/server/async.py", line 17, in ? from pulp.server.tasking.queue.fifo import FIFOTaskQueue File "/usr/lib/python2.4/site-packages/pulp/server/tasking/queue/fifo.py", line 23, in ? from pulp.server.tasking.queue.base import TaskQueue File "/usr/lib/python2.4/site-packages/pulp/server/tasking/queue/base.py", line 17, in ? import pulp.server.tasking.task File "/usr/lib/python2.4/site-packages/pulp/server/tasking/task.py", line 24, in ? from pulp.server.tasking.queue.thread import TimeoutException, CancelException File "/usr/lib/python2.4/site-packages/pulp/server/tasking/queue/thread.py", line 17, in ? import ctypes ImportError: No module named ctypes
python-ctypes is in the Requires list so after fixing the %if for RHEL, this should be taken care of. So, I installed (yum install python-ctypes) and now getting this: [root@unused ~]# service pulp-server init Starting mongod: [ OK ] Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 19, in ? from pulp.server.db.migrate import script File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py", line 21, in ? from pulp.server import auditing File "/usr/lib/python2.4/site-packages/pulp/server/auditing.py", line 32, in ? from pulp.server.api.base import BaseApi File "/usr/lib/python2.4/site-packages/pulp/server/api/base.py", line 16, in ? from pulp.server import async File "/usr/lib/python2.4/site-packages/pulp/server/async.py", line 29, in ? _queue = FIFOTaskQueue() File "/usr/lib/python2.4/site-packages/pulp/server/tasking/queue/fifo.py", line 65, in __init__ self.__dispatcher.start() File "/usr/lib/python2.4/site-packages/pulp/server/tasking/queue/thread.py", line 82, in start parent = threading.current_thread() AttributeError: 'module' object has no attribute 'current_thread'
Looks like this should be threading.currentThread() for backwards compat. Fixing in code.
Fixed threading.current_thread() in site-packages and now getting: [root@unused ~]# service pulp-server init Starting mongod: [ OK ] Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 23, in ? sys.exit(script.main()) File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py", line 80, in main errors = validate() File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/validate.py", line 277, in validate num_errors += _validate_user() File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/validate.py", line 253, in _validate_user objectdb = user.UserApi()._getcollection() File "/usr/lib/python2.4/site-packages/pulp/server/api/user.py", line 35, in __init__ self._ensure_default_admin() File "/usr/lib/python2.4/site-packages/pulp/server/api/user.py", line 46, in _ensure_default_admin self.create(self.default_login, password=default_password) File "/usr/lib/python2.4/site-packages/pulp/server/auditing.py", line 199, in _audit param_values) File "/usr/lib/python2.4/site-packages/pulp/server/db/model.py", line 199, in __init__ self.principal_type = unicode(type(principal)) TypeError: unbound method __unicode__() must be called with SystemPrincipal instance as first argument (got nothing instead)
(In reply to comment #5) > self.principal_type = unicode(type(principal)) > TypeError: unbound method __unicode__() must be called with SystemPrincipal > instance as first argument (got nothing instead) This seems to be a bug in python 2.4. I did a simple test and it can be reproduced as follows: class A: def __unicode__(self): return 'A' unicode(A) So, I changed in the code: from: self.principal_type = unicode(type(principal)) to: self.principal_type = str(type(principal)).encode('utf-8') Moving on ...
Correction, I changed to: self.principal_type = str(type(principal)) and added: class User: ... def __str__(self): return unicode(self).encode('utf-8') ...
Now getting: [root@unused ~]# pulp-migrate --auto --log-level=debug data model in use matches the current version principal(SYSTEM) Traceback (most recent call last): File "/usr/bin/pulp-migrate", line 23, in ? sys.exit(script.main()) File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py", line 80, in main errors = validate() File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/validate.py", line 277, in validate num_errors += _validate_user() File "/usr/lib/python2.4/site-packages/pulp/server/db/migrate/validate.py", line 253, in _validate_user objectdb = user.UserApi()._getcollection() File "/usr/lib/python2.4/site-packages/pulp/server/api/user.py", line 35, in __init__ self._ensure_default_admin() File "/usr/lib/python2.4/site-packages/pulp/server/api/user.py", line 46, in _ensure_default_admin self.create(self.default_login, password=default_password) File "/usr/lib/python2.4/site-packages/pulp/server/auditing.py", line 204, in _audit result = method(*args, **kwargs) File "/usr/lib/python2.4/site-packages/pulp/server/api/user.py", line 57, in create hashed_password = password_util.hash_password(password) File "/usr/lib/python2.4/site-packages/pulp/server/auth/password_util.py", line 41, in hash_password hashed_password = pbkdf_sha256(str(plain_password), salt, NUM_ITERATIONS) File "/usr/lib/python2.4/site-packages/pulp/server/auth/password_util.py", line 35, in pbkdf_sha256 result = HMAC(result, salt, sha256).digest() # use HMAC to apply the salt File "/usr/lib64/python2.4/hmac.py", line 42, in __init__ self.outer = digestmod.new() AttributeError: 'builtin_function_or_method' object has no attribute 'new'
This appears to be a bug in the hmac or incompatability with the sha256 function in hashlib package and can be reproduced as follows: >>> from hmac import HMAC >>> from hashlib import sha256 >>> HMAC('foo', 'bar', sha256) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib64/python2.4/hmac.py", line 42, in __init__ self.outer = digestmod.new() AttributeError: 'builtin_function_or_method' object has no attribute 'new' hashlib is new in python 2.5 and the rpm on this box: python-hashlib-20081119-4.el5 was installed from EPEL. It appears to be incompatible with python 2.4 function objects passed as the digest function. Looking for workaround.
Code updated to use sha1 on < python 2.5 and hashlib.sha256 on python 2.5+.
pulp-migrate script hangs on exit. It's actually hanging in/usr/lib/python2.4/site-packages/pulp/server/db/migrate/script.py on exit. The main() completes but something in the module namespace is preventing the interpreter from exiting. I've reduced to the following: [root@unused ~]# python Python 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pulp.server.db.migrate.validate import validate >>> from pulp.server.db.version import ( ... VERSION, get_version_in_use, is_validated, set_validated) >>> >>> ^D <hangs>
Actually just this: [root@unused ~]# python Python 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. > from pulp.server.db.migrate.validate import validate > ^D <hangs>
I traced the imports back to async.py with instantiates the FIFOTaskQueue which starts are worker thread. Looks like thread.daemon does not do the same thing as thread.setDaemon() (at least on python2.4). Changed to use setDaemon(True) and no longer hangs. Moving on.
Running pulp_migrate is fixed but as you can see by all the comments, this bug includes a lot of issues around installing/running pulp on RHEL 5. The issues mentioned have been fix on the test box and replicated in the code but not tested on a clean install. Once installed, the pulp_migrate script should work.
Fixed in build 0.123.
[root@hp-ml370g4-01 ~]# service pulp-server init Starting mongod: [ OK ] database migration to version 4 complete root@hp-ml370g4-01 ~]# pulp-migrate data model in use matches the current version database migration to version 4 complete
[root@hp-ml370g4-01 ~]# service pulp-server restart Stopping httpd: [ OK ] Stopping Qpid AMQP daemon: [ OK ] Stopping mongod: [ OK ] Starting mongod: [ OK ] Starting Qpid AMQP daemon: [ OK ] Starting httpd: [ OK ]
verified [root@hp-ml370g4-01 ~]# rpm -q pulp pulp-0.0.147-1 [root@hp-ml370g4-01 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Closing with Community Release 15 pulp-0.0.223-4.