Hi, Description of problem: Today I tried to update pulp to 2.2 from 2.1 and pulp-manage-db is failing with a backtrace Version-Release number of selected component (if applicable): 2.2 How reproducible: Always Steps to Reproduce: 1. Update pulp RPM's to 2.2 2. run pulp-manage-db Actual results: It fails with the following backtrace: # pulp-manage-db Beginning database migrations. Migration package pulp.server.db.migrations is up to date at version 4 Migration package pulp_puppet.plugins.migrations is up to date at version 0 Applying pulp_rpm.migrations version 8 Migration to pulp_rpm.migrations version 8 complete. Applying pulp_rpm.migrations version 9 Migration to pulp_rpm.migrations version 9 complete. Applying pulp_rpm.migrations version 10 Migration to pulp_rpm.migrations version 10 complete. Applying pulp_rpm.migrations version 11 Applying migration pulp_rpm.migrations.0011_new_importer failed. See log for details. 2013-10-08 11:52:52,924 db:CRITICAL: Applying migration pulp_rpm.migrations.0011_new_importer failed. 2013-10-08 11:52:52,925 db:CRITICAL: 'NoneType' object has no attribute 'text' 2013-10-08 11:52:52,998 db:CRITICAL: Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 79, in migrate_database update_current_version=not options.test) File "/usr/lib/python2.6/site-packages/pulp/server/db/migrate/models.py", line 161, in apply_migration migration.migrate() File "/usr/lib/python2.6/site-packages/pulp_rpm/migrations/0011_new_importer.py", line 29, in migrate _migrate_collection(type_id) File "/usr/lib/python2.6/site-packages/pulp_rpm/migrations/0011_new_importer.py", line 56, in _migrate_collection package['sourcerpm'] = format_element.find('sourcerpm').text AttributeError: 'NoneType' object has no attribute 'text' Database migrations complete. Loading content types. Content types loaded. Expected results: Upgrade being complete Additional info: After some investigation it seems that I have packages with arch=src and with (obviously) and empty "sourcerpm" in the units_rpm collection. > db.units_rpm.find({arch: 'src', sourcerpm: ''}).count() 3 Is this expected? Shouldn't they be in the units_srpm instead. To work around this issue, I changed the following line in 0011_new_importer.py: package['sourcerpm'] = format_element.find('sourcerpm').text by try: package['sourcerpm'] = format_element.find('sourcerpm').text except AttributeError: package['sourcerpm'] = '' I'm not really sure this is the proper way to fix this
This turned out to be that the user had SRPMs in the RPM collection. This does point out that we lack a srpm upload command, so we should add that to resolve this issue.
Changing the summary according to #c1
We already support uploading RPMs manually using "pulp-admin rpm repo uploads srpm --repo-id <repoid> --file <filename>" I verified this command using the current master branch.
[root@pulp-24-server upload]# rpm -qa pulp-server pulp-server-2.4.0-0.9.beta.el6.noarch [root@pulp-24-server upload]# [root@pulp-24-server upload]# pulp-admin rpm repo uploads srpm --repo-id srpm -f /root/upload/test-srpm01-1.0-1.src.rpm -v +----------------------------------------------------------------------+ Unit Upload +----------------------------------------------------------------------+ Extracting necessary metadata for each request... [==================================================] 100% Analyzing: test-srpm01-1.0-1.src.rpm ... completed Files to be uploaded: test-srpm01-1.0-1.src.rpm Creating upload requests on the server... [==================================================] 100% Initializing: test-srpm01-1.0-1.src.rpm ... completed Starting upload of selected units. If this process is stopped through ctrl+c, the uploads will be paused and may be resumed later using the resume command or cancelled entirely using the cancel command. Uploading: test-srpm01-1.0-1.src.rpm [==================================================] 100% 1607/1607 bytes ... completed Importing into the repository... Import postponed due to queued operations against the repository. The progress of this import can be viewed in the repository tasks list. [root@pulp-24-server upload]#
This has been fixed in Pulp 2.4.0-1.
I think I may be hitting the same bug. I'm migrating from 2.3.1 to 2.4.1. The pulp-manage-db fails: ... Applying pulp_rpm.plugins.migrations version 9 Migration to pulp_rpm.plugins.migrations version 9 complete. Applying pulp_rpm.plugins.migrations version 10 Migration to pulp_rpm.plugins.migrations version 10 complete. Applying pulp_rpm.plugins.migrations version 11 Applying migration pulp_rpm.plugins.migrations.0011_new_importer failed. Halting migrations due to a migration failure. See log for details. 'NoneType' object has no attribute 'text' The logs: pulp: pulp.server.db.manage:CRITICAL: Applying migration pulp_rpm.plugins.migrations.0011_new_importer failed. pulp: pulp.server.db.manage:CRITICAL: pulp: pulp.server.db.manage:CRITICAL: Halting migrations due to a migration failure. pulp: pulp.server.db.manage:CRITICAL: 'NoneType' object has no attribute 'text' pulp: pulp.server.db.manage:CRITICAL: Traceback (most recent call last): pulp: pulp.server.db.manage:CRITICAL: File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 111, in main pulp: pulp.server.db.manage:CRITICAL: _auto_manage_db(options) pulp: pulp.server.db.manage:CRITICAL: File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 157, in _auto_manage_db pulp: pulp.server.db.manage:CRITICAL: migrate_database(options) pulp: pulp.server.db.manage:CRITICAL: File "/usr/lib/python2.6/site-packages/pulp/server/db/manage.py", line 86, in migrate_database pulp: pulp.server.db.manage:CRITICAL: update_current_version=not options.test) pulp: pulp.server.db.manage:CRITICAL: File "/usr/lib/python2.6/site-packages/pulp/server/db/migrate/models.py", line 161, in apply_m pulp: pulp.server.db.manage:CRITICAL: migration.migrate() pulp: pulp.server.db.manage:CRITICAL: File "/usr/lib/python2.6/site-packages/pulp_rpm/plugins/migrations/0011_new_importer.py", line pulp: pulp.server.db.manage:CRITICAL: _migrate_collection(type_id) pulp: pulp.server.db.manage:CRITICAL: File "/usr/lib/python2.6/site-packages/pulp_rpm/plugins/migrations/0011_new_importer.py", line pulp: pulp.server.db.manage:CRITICAL: package['sourcerpm'] = format_element.find('sourcerpm').text pulp: pulp.server.db.manage:CRITICAL: AttributeError: 'NoneType' object has no attribute 'text' pulp: pulp.server.db.manage:CRITICAL: