-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run migrations if there are pending migrations #778
Conversation
This is an alternative solution to (#776) for at least handling the migrate part of the database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this because of the simplicity. Looks like we should also drop those settings from Foreman itself after it's been merged.
4042601
to
b11564c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker to merge, but any thoughts about seeding? I think the refresh can be used to always seed when we migrate, but I wonder about cases where we need to seed without a migration. Since we currently don't that either, I'd be fine with leaving that out.
Once the build is green I'm happy to merge this.
b11564c
to
ff72a49
Compare
I went that route originally -- assume if migration that seed should happen. And had the same thought, seed doesn't require a migration. The seeds are tougher because by design they ought to be idempotent but I think your desire is that the exec is idempotent. So rather than let |
ff72a49
to
92331aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the seeding happens because notifications have a transitive property. It's not written in the current tests, but you can:
it { should contain_foreman__rake('db:migrate').that_notifies('Foreman::Rake[db:seed]') }
That actually passes which means that every time a migration happens, a seeding also happens. It's fairly safe to assume that this is enough. Time will tell if there's ever a case something needs to be seeded to work but doesn't have a DB migration.
manifests/rake.pp
Outdated
@@ -14,6 +15,7 @@ | |||
logoutput => 'on_failure', | |||
refreshonly => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be false
when unless is set. Otherwise the whole trick still doesn't work.
A plugin adding notifications is an example of seed with no migration, e.g. theforeman/foreman_ansible@d37ad23#diff-90c017e7983b50d96418476d81b442db |
You still need to change the
Without this change that isn't covered either. Let's get this in and think about seeding in the next stage. |
92331aa
to
7348620
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer an explicit test that passes in an unless to foreman::rake
. In https://github.com/theforeman/puppet-foreman/compare/master...ekohl:fixes?expand=1 I've written one.
7348620
to
0807d90
Compare
0807d90
to
d78e335
Compare
d78e335
to
91ddc9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test is failing on this.
Also odd that prometheus is failing. I already disabled that on Debian but now it's failing on centos as well. Perhaps that really is broken.
This drops relying on a settings entry in favor of lettings Rails tell us when there are migrations that need to be applied.
91ddc9c
to
7e3de11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on green tests
Looks like further debugging needed as its failing for CentOS 7. |
Are you reading what I'm writing?
Since then it also looks like master is showing the same issue. That means I'd be ok with just merging this. Alternatively first merging a PR that disables the test similar to c0b9611 |
Sorry, I was. The output just made me think it was a regular curl status check that was failing. I do see now that the test description mentions prometheus. |
This drops relying on a settings entry in favor of lettings Rails
tell us when there are migrations that need to be applied.