Skip to content
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

Use // to specify postgresl database #65

Merged
merged 1 commit into from
Mar 27, 2017

Conversation

ehelms
Copy link
Member

@ehelms ehelms commented Mar 24, 2017

No description provided.

@ehelms
Copy link
Member Author

ehelms commented Mar 24, 2017

Testing to see if this solves all of the issues I am seeing before I merge it.

@ehelms ehelms force-pushed the set-database-url branch 4 times, most recently from 0e6a786 to 9239d18 Compare March 25, 2017 17:02
@Klaas-
Copy link

Klaas- commented Mar 25, 2017

@ehelms this is a good point to use the spec tests, I've been meaning to do that in puppet-katello but I thought my changes were safe here :D in any case I think the Service tomcat dependency is really needed, the rest should be okay. I propose to add spectests like these:

git diff spec/classes/candlepin_database_spec.rb
diff --git a/spec/classes/candlepin_database_spec.rb b/spec/classes/candlepin_database_spec.rb
index cfa0a8d..d9b4e3f 100644
--- a/spec/classes/candlepin_database_spec.rb
+++ b/spec/classes/candlepin_database_spec.rb
@@ -57,6 +57,8 @@ describe 'candlepin::database' do
 
           it {should contain_class('candlepin::database::postgresql') }
           it {should_not contain_class('candlepin::database::mysql') }
+          it {should contain_exec('cpdb').that_comes_before('Service[tomcat]') }
+          it {should contain_postgresql__server__role("#{db_user}").that_comes_before('Postgresql::Server::Database[candlepin]
 
           it do
             should contain_concat__fragment('PostgreSQL Database Configuration').

@ehelms
Copy link
Member Author

ehelms commented Mar 25, 2017 via email

@ehelms ehelms force-pushed the set-database-url branch 4 times, most recently from 88ddc87 to 89d28d4 Compare March 25, 2017 23:47
@ehelms
Copy link
Member Author

ehelms commented Mar 26, 2017

I need to fix the tests, but turns out the culprit was the refreshonly. Previously this had a notiify via a dependency chain that would trigger that refresonly as far as I can tell. Removing that with my other updates got things passing,

@Klaas-
Copy link

Klaas- commented Mar 26, 2017

the tests are failing because you inserted the == "true" - thats redundant I'd say but if you want to make it explicit I think you need to use == true. I didn't remove anything as far as notifications, maybe thats from another change. The refreshonly shouldn't be needed if you use creates, the question is more like do we want cpdb to run more than once - for example if package candlepin upgrades do we want to rerun that migration?

@Klaas-
Copy link

Klaas- commented Mar 26, 2017

correct that, you already fixed the == true statements :)
this lint error is because you need to clean some whitespaces in the lines: https://github.com/ehelms/puppet-candlepin/blob/89d28d4a676cdc4d45b3e97026530b369afeb1b4/manifests/database/postgresql.pp#L45-L58
when you remove the refreshonly the indentation for the => changes

@ehelms
Copy link
Member Author

ehelms commented Mar 26, 2017

Updated to fix the linting issues. @Klaas- thats a good idea, given a new Candlepin package might have new migrations worth runninng. That would involve putting a notify on the cpdb for Package[candlepin] ?

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The travis file is modulesynced so that's going to te overridden. Other than that it looks correct.

@ehelms
Copy link
Member Author

ehelms commented Mar 26, 2017

I reverted that travis change. I thought for some crazy reason it was a puppet version issue. Given 3.8 is the current latest version of the 3 line I wonder if our tests should be using that? Or if it matters?

@ekohl
Copy link
Member

ekohl commented Mar 26, 2017

Since we have ~> 3.5 we do use 3.8. It's just not very obvious.

@@ -41,21 +39,24 @@
}

if $init_db {
# Temporary direct use of liquibase to initially migrate the candlepin database
# until support is added in cpdb - https://bugzilla.redhat.com/show_bug.cgi?id=1044574
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this bug is closed per 0.9 and katello 3.3 includes 3.3, can we go back to cpdb?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, we could file an issue to do that in a separate PR when we've got the time.

@Klaas-
Copy link

Klaas- commented Mar 27, 2017

sorry for the double post - I put it into the wrong PR first :)

@ehelms I looked at the code again with a fresh pair of eyes this morning. The change I made changed a ~> to -> and that messed up the refreshonly - sorry.

In regard to changing migrations to run when an update of candlepin is noticed: this only makes sense if you actually upgrade through puppet (ie not using yum update manually). I'm not sure how this would handle inside kafo. Currently katello updates are done (following the docs) via yum update. That would mean that during the puppet run the package does not change. Keeping that in mind I'd say the migrations should rather be inside the package post scriptlets or something like that. We should just remove the refreshonly and use the creates statement - that ensures its only run once and finishes with exit 0. If it fails the "&& touch /var/lib/candlepin/cpdb_done" should not be executed and its rerun on next puppet run until it succeeds.

@ehelms ehelms merged commit 7b6f0ca into theforeman:master Mar 27, 2017
@ekohl
Copy link
Member

ekohl commented Mar 27, 2017

@Klaas- I might have been the one who suggested that.

Regarding the upgrade I agree. The way the installer upgrade could force a cpdb run is simply by removing /var/lib/candlepin/cpdb_done before running puppet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants