[ContentMigration] run content-switchover failed

Thanks for raising this. I have opened Bug #30919: sync_task fails with `The Dynflow world was not initialized yet.` in rake tasks on nightly production - Katello - Foreman to track this.

In the mean time, could you try adding
katello:pulp3_post_migration_check
to
self.rake_tasks_with_executor = … list
in
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.6/lib/dynflow/rails/configuration.rb and re-running foreman-rake katello:pulp3_post_migration_check

After making that change and rerunning the foreman-maintain advanced procedure run content-switchover command I got the following. It appears my content may have already been pulp3.

Running ForemanMaintain::Scenario

Switch support for certain content from Pulp 2 to Pulp 3:
Performing final content migration before switching content
Content Migration completed successfully
Performing a check to verify everything that is needed has been migrated

Switching specified content over to pulp 3 [FAIL]
Failed executing foreman-rake katello:pulp3_content_switchover, exit status 1:
rake aborted!
Katello::Errors::Pulp3MigrationError: Pulp 3 migration cannot run. Types file, docker have already been migrated.
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0/app/services/katello/pulp3/migration.rb:21:in initialize' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0/app/services/katello/pulp3/migration_switchover.rb:9:in new’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0/app/services/katello/pulp3/migration_switchover.rb:9:in initialize' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0/lib/katello/tasks/pulp3_content_switchover.rake:7:in new’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0/lib/katello/tasks/pulp3_content_switchover.rake:7:in block (3 levels) in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in block in transaction’
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in block in within_new_transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize’
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in within_new_transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in transaction’
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/transactions.rb:212:in transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0/lib/katello/tasks/pulp3_content_switchover.rake:6: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_content_switchover
(See full trace by running task with --trace)

Scenario [ForemanMaintain::Scenario] failed.

The following steps ended up in failing state:

[content-switchover]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist=“content-switchover”

Yes…That looks expected since the content switchover task actually passed the first time.
Could you run foreman-rake katello:pulp3_post_migration_check to verify the migration. That should be all you need to do.

I ran that and got no output back. I’m assuming that means there are no errors.

[root@foreman01 ~]# foreman-rake katello:pulp3_post_migration_check
[root@foreman01 ~]# echo $?
0

That looks correct. The task is set up to report errors if any. Can you check once on the tasks page if you see this task: DeleteOrphanedMigratedRepositories ?

We have a current issue open to add better progress reporting on migration related tasks. :slight_smile:

I do see that task marked as successful.

Hi,

i have the same problem to running foreman-maintain advanced procedure run content-switchover. Here is my System information:

Foreman: 2.2.0-rc3
Katello: 3.17-rc1
CentOS: CentOS Linux release 7.8.2003 (Core)

foreman-tasks 3.0.0
foreman_docker 5.0.0
foreman_remote_execution 4.1.0
foreman_scc_manager Foreman 1.8.4
foreman_virt_who_configure 0.5.2
katello 3.17.0.rc1

The diferent is if i do this step:

and run foreman-rake katello:pulp3_post_migration_check i become this error:

> Rubocop not loaded.
> ERROR: docker repositories with ID [137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189] have a NULL value for version_href

the Task DeleteOrphanedMigratedRepositories is allso available and has the state successful.

if there any sugestion for the next steps to fix this problem.

kind regard Fabian

Hello @RolFa,

Could you try running the following in order:

foreman-rake katello:pulp3_migration
foreman-rake katello:pulp3_post_migration_check
foreman-rake katello:pulp3_content_switchover

hi @sajha

Here the output from the given steps.

foreman-rake katello:pulp3_migration
Rubocop not loaded.
Content Migration completed successfully
You have new mail in /var/spool/mail/root
foreman-rake katello:pulp3_post_migration_check
Rubocop not loaded.
ERROR: docker repositories with ID [137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189] have a NULL value for version_href
foreman-rake katello:pulp3_content_switchover
Rubocop not loaded.
rake aborted!
Katello::Errors::Pulp3MigrationError: Pulp 3 migration cannot run. Types file, docker have already been migrated.
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0.rc1/app/services/katello/pulp3/migration.rb:21:in initialize' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0.rc1/app/services/katello/pulp3/migration_switchover.rb:9:in new’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0.rc1/app/services/katello/pulp3/migration_switchover.rb:9:in initialize' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0.rc1/lib/katello/tasks/pulp3_content_switchover.rake:7:in new’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0.rc1/lib/katello/tasks/pulp3_content_switchover.rake:7:in block (3 levels) in <top (required)>' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in block in transaction’
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in block in within_new_transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize’
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in within_new_transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in transaction’
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.1/lib/active_record/transactions.rb:212:in transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0.rc1/lib/katello/tasks/pulp3_content_switchover.rake:6: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_content_switchover
(See full trace by running task with --trace)

kind regards
Fabian

Hey @RolFa,

We have several fixes around migration dropping in 3.17 rc2 with better detection of types and repos to be migrated. I would suggest upgrading to rc2 when it’s released (which should be soon) and re-running migration.

Thanks & Regards,
Samir Jha

I have migratet to release version 3.16 to 3.17 and the problem of pulp migration stills exists:

[root]# foreman-rake katello:pulp3_post_migration_check
Rubocop not loaded.
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
ERROR: yum repositories with ID [557,3,4,5,6,2,608,8,9,10,11,12,13,14,15,16,17,609,19,20,21,22,23,24,25,26,27,28,30,31,32,33,34,35,36,42,44,49,52,55,558,566,610,620,630,634,37,39,46,57,611,560,616,621,622,626,623,631,628,629,633,38,41,48,612,54,59,61,561,562,570,575,576,613,614,617,619,624,632,615,43,50,53,56,60,563,618,625,45,47,62,564,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,95,578,579,580,590,598,603,606,92,93,585,591,599,604,607,94,569,571,572,573,574,109,116,122,583,129,133,588,589,147,142,154,165,173,247,249,250,252,253,255,257,259,260,262,268,279,285,306,322,327,331,334,339,265,280,290,300,310,328,332,342,347,266,281,286,301,303,326,333,337,345,349,282,289,294,297,304,312,323,324,336,350,271,275,283,288,291,314,319,325,329,340,343,287,292,295,298,308,330,351,354,355,360,363,364,365,366,367,368,369,373,376,380,384,390,399,407,412,418,425,436,441,443,450,370,375,379,392,411,419,428,440,447,453,371,388,403,404,421,422,435,442,372,374,405,413,417,426,431,449,382,385,397,406,410,415,445,378,387,401,408,409,414,429,444,446,451,454,461,465,467,475,477,483,553,555,556] have a NULL value for version_href
[root]# foreman-rake katello:pulp3_migration
Rubocop not loaded.
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Migration failed, You will want to investigate: https://XXXXXXX.YYYY.com/foreman_tasks/tasks/29b89f71-d9a2-465a-a6ba-ab1c142ea3e7
rake aborted!
ForemanTasks::TaskError: Task 29b89f71-d9a2-465a-a6ba-ab1c142ea3e7: Pulp2to3MigrationClient::ApiError: Error message: the server returns an error
HTTP status code: 400
Response headers: {“date”=>“Mon, 30 Nov 2020 17:25:27 GMT”, “server”=>“gunicorn/20.0.4”, “content-type”=>“application/json”, “vary”=>“Accept,Cookie”, “allow”=>“POST, OPTIONS”, “x-frame-options”=>“SAMEORIGIN”, “content-length”=>“45”, “via”=>“1.1 XXXXXXX.YYYY.com”, “connection”=>“close”}
Response body: [“Only one migration plan can run at a time”]
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0/lib/katello/tasks/pulp3_migration.rake:17: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)
[root]# foreman-rake katello:pulp3_content_switchover
Rubocop not loaded.
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
ERROR: at least one katello_rpms record has migrated_pulp3_href NULL value

I have the same problem on CentOS 7.9 with:

katello-3.18.0-0.1.rc2.el7.noarch
foreman-2.3.0-1.el7.noarch

  $ foreman-maintain content switchover
   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
Content Migration completed successfully
Performing a check to verify everything that is needed has been migrated

Switching specified content over to pulp 3                            [FAIL]
Failed executing foreman-rake katello:pulp3_content_switchover, exit status 1:
 rake aborted!
The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/rails.rb:75:in `world'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:23:in `trigger'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:29:in `block in trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:49:in `block in rails_safe_trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:48:in `rails_safe_trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:27:in `trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:58:in `sync_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.0.rc2.1/lib/katello/tasks/pulp3_content_switchover.rake:19: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_content_switchover
(See full trace by running task with --trace)
--------------------------------------------------------------------------------
Scenario [Switch support for certain content from Pulp 2 to Pulp 3] failed.

The following steps ended up in failing state:

  [content-switchover]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="content-switchover"

And
$ grep self.rake_tasks_with_executor /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/rails/configuration.rb
self.rake_tasks_with_executor = %w(db:migrate db:seed)

what should I change this line to ?

Just upgraded from 3.17 to 3.18 and I’m having the same trouble too.

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
Starting task.
2020-12-17 15:58:28 +1030: Content migration starting. Content Migration completed successfully
Performing a check to verify everything that is needed has been migrated

Switching specified content over to pulp 3 [FAIL]
Failed executing foreman-rake katello:pulp3_content_switchover, exit status 1:
rake aborted!
The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/rails.rb:75:in world' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:23:in trigger’
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:29:in block in trigger_task' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:49:in block in rails_safe_trigger_task’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:48:in block in permit_concurrent_loads' /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/concurrency/share_lock.rb:187:in yield_shares’
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:47:in permit_concurrent_loads' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:48:in rails_safe_trigger_task’
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:27:in trigger_task' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.2/lib/foreman_tasks.rb:58:in sync_task’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.0/lib/katello/tasks/pulp3_content_switchover.rake:19: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_content_switchover
(See full trace by running task with --trace)

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

The following steps ended up in failing state:

[content-switchover]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist=“content-switchover”

Same error here with 2.3.1/3.18

I’m also facing the same issue with
foreman version: 2.3.1
katello version: 3.18

I finally got past this error by adding katello:pulp3_content_switchover to the self.rake_tasks_with_executor.

Where do you put this config?

I second this question.
Never worked with RubyOnRails and don’t know how to add “katello:pulp3_content_switchover” to “self.rake_tasks_with_executor”.
Is it seperated by comma? By whitespace? By dot? By $WHATEVER ?
Because if I look through the documentation on the internet, I currently find only lists that are defined with an “@”-symbol and the list command.

Apologies for this, this will be fixed in Katello 3.18.2

In the meantime you can edit this file: /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.0.pre.master/lib/katello/tasks/pulp3_content_switchover.rake

and change this line:

  task :pulp3_content_switchover => :environment do

to

  task :pulp3_content_switchover => "dynflow:client" do
1 Like

Thanks!