-
Notifications
You must be signed in to change notification settings - Fork 794
parameterize mysqld config_dir #492
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
Conversation
In case I haven't said that yet, we'll also need spec/acceptance tests for this. Do you think you could add those? |
I just ran rspec spec/acceptance tests, with the following result: Notice: /Stage[main]/Main/Mysql_user[ashp@localhost]/ensure: created
Notice: Finished catalog run in 0.41 seconds
centos-64-x64 executed in 1.69 seconds
Exited: 2
should work without errors
centos-64-x64 $ mysql -NBe "select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'"
1
centos-64-x64 executed in 0.04 seconds
should find the user
removing temporory ssh-config files per-vagrant box
Destroying vagrant boxes
[centos-64-x64] Forcing shutdown of VM...
[centos-64-x64] Destroying VM and associated drives...
Failures:
1) config dir location File "/etc/alternativedir" should be dir
Failure/Error: it { should be_dir }
NoMethodError:
undefined method `dir?' for File "/etc/alternativedir":Serverspec::Type::File
# ./spec/acceptance/mysql_server_config_spec.rb:29:in `block (3 levels) in <top (required)>'
Finished in 9 minutes 14 seconds
98 examples, 1 failure
Failed examples:
rspec ./spec/acceptance/mysql_server_config_spec.rb:29 # config dir location File "/etc/alternativedir" should be dir |
I've updated the tests. Should work now. |
Okay, so… your stuff seems to be working fine, so I'll merge that in… (as soon as you have rebased). However, the beaker tests are failing, and I think @apenney might know why: Destroying vagrant boxes
[centos-64-x64] Forcing shutdown of VM...
[centos-64-x64] Destroying VM and associated drives...
Failures:
1) mysql::server::account_security class running puppet code should work with no errors
Failure/Error: apply_manifest(pp, :catch_failures => true)
Beaker::Host::CommandFailure:
Host 'centos-64-x64' exited with 1 running:
env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest.pp.C25XaR
Last 10 lines of output were:
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Warning: Could not retrieve fact fqdn
Notice: Compiled catalog for centos-64-x64 in environment production in 1.02 seconds
Error: Parameter name failed on Mysql_user[root@]: Invalid database user root@ at /etc/puppet/modules/mysql/manifests/server/account_security.pp:11
Wrapped exception:
Invalid database user root@
# ./spec/acceptance/mysql_account_delete_spec.rb:11:in `block (3 levels) in <top (required)>'
2) mysql::server::account_security class running puppet code accounts should delete accounts
Failure/Error: shell("mysql -e 'show grants for [email protected];'", :acceptable_exit_codes => 1)
Beaker::Host::CommandFailure:
Host 'centos-64-x64' exited with 127 running:
mysql -e 'show grants for [email protected];'
Last 10 lines of output were:
bash: mysql: command not found
# ./spec/acceptance/mysql_account_delete_spec.rb:17:in `block (4 levels) in <top (required)>'
3) mysql::server::backup class should work with no errors when configuring mysql backups
Failure/Error: apply_manifest(pp, :catch_failures => true) do |r|
Beaker::Host::CommandFailure:
Host 'centos-64-x64' exited with 6 running:
env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest.pp.mwVmXz
Last 10 lines of output were:
Warning: /Stage[main]/Mysql::Server::Backup/Mysql_grant[myuser@localhost/*.*]: Skipping because of failed dependencies
Notice: /Stage[main]/Main/Mysql::Db[backup2]/Mysql_grant[backup@localhost/backup2.*]: Dependency Package[mysql-server] has failures: true
Notice: /Stage[main]/Main/Mysql::Db[backup2]/Mysql_grant[backup@localhost/backup2.*]: Dependency Mysql_database[backup2] has failures: true
Notice: /Stage[main]/Main/Mysql::Db[backup2]/Mysql_grant[backup@localhost/backup2.*]: Dependency Mysql_user[backup@localhost] has failures: true
Notice: /Stage[main]/Main/Mysql::Db[backup2]/Mysql_grant[backup@localhost/backup2.*]: Dependency Package[mysql_client] has failures: true
Notice: /Stage[main]/Main/Mysql::Db[backup2]/Mysql_grant[backup@localhost/backup2.*]: Dependency Mysql_user[root@localhost] has failures: true
Warning: /Stage[main]/Main/Mysql::Db[backup2]/Mysql_grant[backup@localhost/backup2.*]: Skipping because of failed dependencies
Error: Could not find a suitable provider for mysql_user
Info: Creating state file /var/lib/puppet/state/state.yaml
Notice: Finished catalog run in 12.62 seconds
# ./spec/acceptance/mysql_backup_spec.rb:30:in `block (3 levels) in <top (required)>'
4) mysql::server::backup class mysqlbackup.sh should run mysqlbackup.sh with no errors
Failure/Error: expect(r.stderr).to eq("")
expected: ""
got: "/usr/local/sbin/mysqlbackup.sh: line 35: mysqldump: command not found\n"
(compared using ==)
Diff:
@@ -1 +1,2 @@
+/usr/local/sbin/mysqlbackup.sh: line 35: mysqldump: command not found
# ./spec/acceptance/mysql_backup_spec.rb:42:in `block (4 levels) in <top (required)>'
# ./spec/acceptance/mysql_backup_spec.rb:41:in `block (3 levels) in <top (required)>'
5) mysql_grant complex test setup mysql::server
Failure/Error: apply_manifest(pp, :catch_failures => true)
Beaker::Host::CommandFailure:
Host 'centos-64-x64' exited with 1 running:
env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply --verbose --detailed-exitcodes /tmp/apply_manifest.pp.fjha4Z
Last 10 lines of output were:
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Warning: Could not retrieve fact fqdn
Notice: Compiled catalog for centos-64-x64 in environment production in 0.09 seconds
Error: Parameter user failed on Mysql_grant[web@/*.*]: Invalid user web@ at /tmp/apply_manifest.pp.fjha4Z:43
Wrapped exception:
Invalid user web@
# ./spec/acceptance/types/mysql_grant_spec.rb:256:in `block (3 levels) in <top (required)>'
Finished in 7 minutes 41 seconds
98 examples, 5 failures
Failed examples:
rspec ./spec/acceptance/mysql_account_delete_spec.rb:5 # mysql::server::account_security class running puppet code should work with no errors
rspec ./spec/acceptance/mysql_account_delete_spec.rb:16 # mysql::server::account_security class running puppet code accounts should delete accounts
rspec ./spec/acceptance/mysql_backup_spec.rb:5 # mysql::server::backup class should work with no errors when configuring mysql backups
rspec ./spec/acceptance/mysql_backup_spec.rb:40 # mysql::server::backup class mysqlbackup.sh should run mysqlbackup.sh with no errors
rspec ./spec/acceptance/types/mysql_grant_spec.rb:206 # mysql_grant complex test setup mysql::server |
squashed and fixed up, please review :) |
@@ -17,4 +17,4 @@ | |||
<% end %> | |||
<% end -%> | |||
|
|||
!includedir /etc/mysql/conf.d/ | |||
!includedir <%= @scope.lookupvar($mysql::server::config_dir) %>/conf.d |
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 shouldn't be necessary.
It should just be @config_dir
.
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 think this also causes the travis failures.
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.
Also, I don't think @config_dir
is within the scope. $options
is explicitly pulled into the scope in mysql::server::config
. Maybe it's a good idea to do the same with config_dir
.
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: scope.lookupvar('mysql::server::config_dir')
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.
Thanks, let's see what happens now!
Why are all travis tests failing now? |
Looks like all the failures are related to:
So you'll need to take a look at this test before we can merge it. |
}) | ||
end | ||
it do | ||
should contain_file('/etc/mysql-alternative/my.cnf').with_content( |
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 file location is the value of $config_file
which in this case should be /etc/my.cnf
since the osfamily
fact is set to RedHat
.
Just noticed this pullrequest after I prepared own one :( Please look at pullrequest #508 |
This ensures config dir is overridable so we can install MySQL 5.5 from http://wiki.centos.org/AdditionalResources/Repositories/SCL