Project

General

Profile

Bug #6922

Foreman runs engine seeds.d before seeds.rb

Added by Stephen Benjamin almost 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Plugins-Engines
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

#6308 introduced seeds.d support for engines, however these are run before the Engine's own seeds.rb is run.


Related issues

Related to Foreman - Feature #6308: Allow plugins to hook into DB seed orderingClosed2014-06-20

History

#1 Updated by Stephen Benjamin almost 5 years ago

  • Related to Feature #6308: Allow plugins to hook into DB seed ordering added

#2 Updated by Dominic Cleal almost 5 years ago

Can you provide any more information about what seed files you have in the plugin?

#3 Updated by Stephen Benjamin almost 5 years ago

Katello doesn't use seeds.d yet. Eric and I discussed moving Satellite branding to seeds.d as something like 99-branding.rb. This lets downstream rebase Katello freely without wiping out all the branding changes constantly. It's becoming a major headache for me, as I've now had to reapply my changes 3x.

99-branding.rb doesn't work if things in seeds.rb are applied later. I can fix my problem by moving provisioning templates to seeds.d as well if we decide to do this.

But IMHO the simplest argument for this is that engines and Foreman should have the same behavior in how they handle the ordering of seeds.rb and seeds.d.

#4 Updated by Dominic Cleal almost 5 years ago

  • Status changed from New to Need more information

I can't reproduce any ordering issue with a file called "99-branding.rb":

Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/03-auth_sources.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/04-admin.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/05-taxonomies.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/06-architectures.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/07-config_templates.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/08-partition_tables.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/10-installation_media.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/11-permissions.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/11-roles.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/11-smart_proxy_features.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/13-compute_profiles.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/15-bookmarks.rb
Seeding /home/dcleal/code/foreman/foreman_bootdisk/db/seeds.d/99-branding.rb

Also the original PR shows a test from Greg that appears to work correctly. seeds.rb sorts all seed files by their basename.

#5 Updated by Stephen Benjamin almost 5 years ago

That's not the issue I'm reporting. Katello has a seeds.rb, the way #6308 was implemented, seeds.d/* is executed BEFORE seeds.rb...

#6 Updated by Dominic Cleal almost 5 years ago

Foreman doesn't provide any mechanism to run a seeds.rb from an engine, only seeds.d/. Maybe that's to do with enhancing the db:seed rake task from the engine. I'd recommend not using seeds.rb in an engine.

#7 Updated by Stephen Benjamin almost 5 years ago

  • Status changed from Need more information to Rejected

I see, we're hooking into the rake task to get our seeds.rb processed, so we'll need to move everything to seeds.d.

Also available in: Atom PDF