[ContentMigration] migration fails with error "Katello::Errors::Pulp3Error: 'NoneType' object has no attribute 'cast'"

Problem: content migration fails with error “Katello::Errors::Pulp3Error: ‘NoneType’ object has no attribute ‘cast’”

Expected outcome: pulp2 content migrated to pulp3 (yum)

Foreman and Proxy versions:

  • foreman 2.3.1
  • katello 3.18

Other relevant data:
foreman-maintain content switchover gives:
Running Switch support for certain content from Pulp 2 to Pulp 3

Switch support for certain content from Pulp 2 to Pulp 3:
Performing final content migration before switching content [FAIL]
Failed executing foreman-rake katello:pulp3_migration, exit status 1:
Migration failed, You will want to investigate: https://stg-katello/foreman_tasks/tasks/18b2029a-71e6-4df3-aa90-0c68983ac48b
rake aborted!
ForemanTasks::TaskError: Task 18b2029a-71e6-4df3-aa90-0c68983ac48b: Katello::Errors::Pulp3Error: ‘NoneType’ object has no attribute ‘cast’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.0/lib/katello/tasks/pulp3_migration.rake:31:in block (2 levels) in <top (required)>' /opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in <top (required)>’
Tasks: TOP => katello:pulp3_migration
(See full trace by running task with --trace)
Starting task.
2020-12-30 16:12:41 +0100: Initial Migration steps complete.

Scenario [Switch support for certain content from Pulp 2 to Pulp 3] failed.

Smart-Proxy services show: “yum (supported, but overridden to use Pulp 2)”

How to proceed?

1 Like

I think I’m seeing the exact same issue

me too.
Katello version: 3.18.0

Same here in Katello version: 3.18.1 :frowning:

Anyone reading these things?

Same here.

Tried again after 3.18.1, same problem

Sorry - this was missed by me.
Will try to get some eyes on this for you!

The problem from what I’ve been able to dig (I’m no pythonista) is in
/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/rpm/repoisitory.py line 105

  "pulp_tasks": [
  "pulp_href": "/pulp/api/v3/tasks/ed7a3e81-1635-4138-813b-691a8fd71d41/",
  "pulp_created": "2021-02-01T19:45:15.957+00:00",
  "state": "failed",
  "name": "pulp_2to3_migration.app.tasks.migrate.migrate_from_pulp2",
  "started_at": "2021-02-01T19:45:16.043+00:00",
  "finished_at": "2021-02-01T19:45:46.270+00:00",
  "error": {
    "traceback": "  File \"/usr/lib/python3.6/site-packages/rq/worker.py\", line 936, in perform_job\n    rv = job.perform()\n  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 684, in perform\n    self._result = self._execute()\n  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 690, in _execute\n    return self.func(*self.args, **self.kwargs)\n  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/tasks/migrate.py\", line 136, in migrate_from_pulp2\n    pre_migrate_all_without_content(plan, type_to_repo_ids, repo_id_to_type)\n  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/pre_migration.py\", line 384, in pre_migrate_all_without_content\n    repo_id, distributors_repos, distributor_migrators, repo)\n  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/pre_migration.py\", line 556, in pre_migrate_distributor\n    needs_new_publication = dist_migrator.needs_new_publication(distributor)\n  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/rpm/repository.py\", line 105, in needs_new_publication\n    current_checksum_type = pulp2distributor.pulp3_publication.cast().metadata_checksum_type\n",
    "description": "'NoneType' object has no attribute 'cast'"
1 Like

Is it possible that it’s choking on sha1 checksum types? I did some poking and on looking at the Checksum Type’s on my repos most of them are sha256, but there’s a few that are sha1

Thanks for the patience, looking into this now.

@Justin_Sherrill any ideas on further debugging?

1 Like

It looks like this is the proper traceback formatted, thanks @indygwyn that should help quite a bit.

NoneType' object has no attribute 'cast
    "traceback": "  File \"/usr/lib/python3.6/site-packages/rq/worker.py\", line 936, in perform_job
    rv = job.perform()
  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 684, in perform
    self._result = self._execute()
  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 690, in _execute
    return self.func(*self.args, **self.kwargs)
  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/tasks/migrate.py\", line 136, in migrate_from_pulp2
    pre_migrate_all_without_content(plan, type_to_repo_ids, repo_id_to_type)
  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/pre_migration.py\", line 384, in pre_migrate_all_without_content
    repo_id, distributors_repos, distributor_migrators, repo)
  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/pre_migration.py\", line 556, in pre_migrate_distributor
    needs_new_publication = dist_migrator.needs_new_publication(distributor)
  File \"/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/rpm/repository.py\", line 105, in needs_new_publication
    current_checksum_type = pulp2distributor.pulp3_publication.cast().metadata_checksum_type

let me bring it up with the pulp team and see if its a known issue

the pulp team said it looks like a new bug, so i filed Issue #8195: NoneType' object has no attribute 'cast on metadata_checksum_type - Pulp

We plan to backport all these fixes found in the migration to katello 3.18, so please hold tight on 3.18 for a fix.


1 Like

@indygwyn The pulp team did have one question, do you remember if you deleted any Repositories or Content View Versions in between the first migration you ran and when you started getting this error? An answer of ‘I don’t remember but its very likely’ is perfectly okay :slight_smile:

@Justin_Sherrill for me I can answer with a definite yes :slight_smile: No repositories deleted but sure some content view versions.

It’s a probably yes for me too, it’s been awhile though. I’ve updated 2 Katello’s from 3.14 to 3.18 in the last month and I do like to clean up things so there’s less to process during the upgrades

Thanks guys, we’ll update this post when we have more information, you can monitor that pulp issue (Issue #8195: NoneType' object has no attribute 'cast on metadata_checksum_type - Migration Plugin - Pulp) as well in the meantime.

1 Like

Just a followup, I hand patched in the fix and I get past this issue now, but stuck on the corrupted rpms problem that there’s already a Bug filed on target for 3.18.2, so I guess I’ll wait for that update to finish my migration