Install MySQL client and daemon dev libraries.

This commit is contained in:
Aaron Hicks 2014-05-09 13:17:44 +12:00
parent c57600e4f0
commit b2090194f5
6 changed files with 148 additions and 62 deletions

View file

@ -6,6 +6,8 @@ class mysql::bindings (
$php_enable = false,
$python_enable = false,
$ruby_enable = false,
$client_dev = false,
$daemon_dev = false,
# Settings for the various classes.
$java_package_ensure = $mysql::params::java_package_ensure,
$java_package_name = $mysql::params::java_package_name,
@ -21,7 +23,13 @@ class mysql::bindings (
$python_package_provider = $mysql::params::python_package_provider,
$ruby_package_ensure = $mysql::params::ruby_package_ensure,
$ruby_package_name = $mysql::params::ruby_package_name,
$ruby_package_provider = $mysql::params::ruby_package_provider
$ruby_package_provider = $mysql::params::ruby_package_provider,
$client_dev_package_ensure = $mysql::params::client_dev_package_ensure,
$client_dev_package_name = $mysql::params::client_dev_package_name,
$client_dev_package_provider = $mysql::params::client_dev_package_provider,
$daemon_dev_package_ensure = $mysql::params::daemon_dev_package_ensure,
$daemon_dev_package_name = $mysql::params::daemon_dev_package_name,
$daemon_dev_package_provider = $mysql::params::daemon_dev_package_provider
) inherits mysql::params {
if $java_enable { include '::mysql::bindings::java' }
@ -29,5 +37,7 @@ class mysql::bindings (
if $php_enable { include '::mysql::bindings::php' }
if $python_enable { include '::mysql::bindings::python' }
if $ruby_enable { include '::mysql::bindings::ruby' }
if $client_dev { include '::mysql::bindings::client_dev' }
if $daemon_dev { include '::mysql::bindings::daemon_dev' }
}

View file

@ -0,0 +1,14 @@
# Private class
class mysql::bindings::client_dev {
if $mysql::bindings::client_dev_package_name {
package { 'mysql-client_dev':
ensure => $mysql::bindings::client_dev_package_ensure,
name => $mysql::bindings::client_dev_package_name,
provider => $mysql::bindings::client_dev_package_provider,
}
} else {
warning("No MySQL client development package configured for ${::operatingsystem}.")
}
}

View file

@ -0,0 +1,14 @@
# Private class
class mysql::bindings::daemon_dev {
if $mysql::bindings::daemon_dev_package_name {
package { 'mysql-daemon_dev':
ensure => $mysql::bindings::daemon_dev_package_ensure,
name => $mysql::bindings::daemon_dev_package_name,
provider => $mysql::bindings::daemon_dev_package_provider,
}
} else {
warning("No MySQL daemon development package configured for ${::operatingsystem}.")
}
}

View file

@ -21,6 +21,10 @@ class mysql::params {
$python_package_provider = undef
$ruby_package_ensure = 'present'
$ruby_package_provider = undef
$client_dev_package_ensure = 'present'
$client_dev_package_provider = undef
$daemon_dev_package_ensure = 'present'
$daemon_dev_package_provider = undef
case $::osfamily {
@ -75,6 +79,8 @@ class mysql::params {
$php_package_name = 'php-mysql'
$python_package_name = 'MySQL-python'
$ruby_package_name = 'ruby-mysql'
$client_dev_package_name = 'libmysqlclient-devel'
$daemon_dev_package_name = 'mysql-devel'
}
'Suse': {
@ -116,6 +122,8 @@ class mysql::params {
/OpenSuSE/ => 'rubygem-mysql',
/(SLES|SLED)/ => 'ruby-mysql',
}
$client_dev_package_name = 'libmysqlclient-devel'
$daemon_dev_package_name = 'mysql-devel'
}
'Debian': {
@ -143,6 +151,8 @@ class mysql::params {
'trusty' => 'ruby-mysql',
default => 'libmysql-ruby',
}
$client_dev_package_name = 'libmysqlclient-dev'
$daemon_dev_package_name = 'mysqld-dev'
}
'FreeBSD': {
@ -166,6 +176,9 @@ class mysql::params {
$php_package_name = 'php5-mysql'
$python_package_name = 'databases/py-MySQLdb'
$ruby_package_name = 'databases/ruby-mysql'
# The libraries installed by these packages are included in client and server packages, no installation required.
$client_dev_package_name = undef
$daemon_dev_package_name = undef
}
default: {
@ -191,6 +204,9 @@ class mysql::params {
$php_package_name = 'php-mysql'
$python_package_name = 'MySQL-python'
$ruby_package_name = 'ruby-mysql'
# The libraries installed by these packages are included in client and server packages, no installation required.
$client_dev_package_name = undef
$daemon_dev_package_name = undef
}
default: {

View file

@ -14,6 +14,8 @@ when 'RedHat'
if fact('operatingsystemmajrelease') == '7'
ruby_package_provider = 'gem'
end
client_dev_package = 'libmysqlclient-devel'
daemon_dev_package = 'mysql-devel'
when 'Suse'
java_package = 'mysql-connector-java'
perl_package = 'perl-DBD-mysql'
@ -25,6 +27,8 @@ when 'Suse'
when /(SLES|SLED)/
ruby_package = 'ruby-mysql'
end
client_dev_package = 'libmysqlclient-devel'
daemon_dev_package = 'mysql-devel'
when 'Debian'
java_package = 'libmysql-java'
perl_package = 'libdbd-mysql-perl'
@ -35,12 +39,16 @@ when 'Debian'
else
ruby_package = 'libmysql-ruby'
end
client_dev_package = 'libmysqlclient-dev'
daemon_dev_package = 'mysqld-dev'
when 'FreeBSD'
java_package = 'databases/mysql-connector-java'
perl_package = 'p5-DBD-mysql'
php_package = 'php5-mysql'
python_package = 'databases/py-MySQLdb'
ruby_package = 'ruby-mysql'
client_dev_package = nil
daemon_dev_package = nil
else
case operatingsystem
when 'Amazon'
@ -49,6 +57,8 @@ else
php_package = 'php5-mysql'
python_package = 'MySQL-python'
ruby_package = 'ruby-mysql'
client_dev_package = nil
daemon_dev_package = nil
end
end
@ -82,21 +92,29 @@ describe 'mysql::bindings class', :unless => UNSUPPORTED_PLATFORMS.include?(fact
php_enable => true,
python_enable => true,
ruby_enable => true,
client_dev => true,
daemon_dev => true,
java_package_ensure => present,
perl_package_ensure => present,
php_package_ensure => present,
python_package_ensure => present,
ruby_package_ensure => present,
client_dev_ensure => present,
daemon_dev_ensure => present,
java_package_name => #{java_package},
perl_package_name => #{perl_package},
php_package_name => #{php_package},
python_package_name => #{python_package},
ruby_package_name => #{ruby_package},
client_dev_package_name => #{client_dev_package},
daemon_dev_package_name => #{daemon_dev_package},
java_package_provider => undef,
perl_package_provider => undef,
php_package_provider => undef,
python_package_provider => undef,
ruby_package_provider => #{ruby_package_provider},
client_dev_provider => undef,
daemon_dev_provider => undef,
}
EOS

View file

@ -7,9 +7,11 @@ describe 'mysql::bindings' do
'php_enable' => true,
'python_enable' => true,
'ruby_enable' => true,
'client_dev' => true,
'daemon_dev' => true,
}}
shared_examples 'bindings' do |osfamily, operatingsystem, operatingsystemrelease, java_name, perl_name, php_name, python_name, ruby_name|
shared_examples 'bindings' do |osfamily, operatingsystem, operatingsystemrelease, java_name, perl_name, php_name, python_name, ruby_name, client_dev_name, daemon_dev_name|
let :facts do
{ :osfamily => osfamily, :operatingsystem => operatingsystem,
:operatingsystemrelease => operatingsystemrelease, :root_home => '/root',
@ -31,11 +33,23 @@ describe 'mysql::bindings' do
:name => ruby_name,
:ensure => 'present'
)}
if client_dev_name
it { should contain_package('mysql-client_dev').with(
:name => client_dev_name,
:ensure => 'present'
)}
end
if daemon_dev_name
it { should contain_package('mysql-daemon_dev').with(
:name => daemon_dev_name,
:ensure => 'present'
)}
end
end
context 'Debian' do
it_behaves_like 'bindings', 'Debian', 'Debian', '7.4','libmysql-java', 'libdbd-mysql-perl', 'php5-mysql', 'python-mysqldb', 'libmysql-ruby'
it_behaves_like 'bindings', 'Debian', 'Ubuntu', '14.04', 'libmysql-java', 'libdbd-mysql-perl', 'php5-mysql', 'python-mysqldb', 'libmysql-ruby'
it_behaves_like 'bindings', 'Debian', 'Debian', '7.4','libmysql-java', 'libdbd-mysql-perl', 'php5-mysql', 'python-mysqldb', 'libmysql-ruby', 'libmysqlclient-dev', 'mysqld-dev'
it_behaves_like 'bindings', 'Debian', 'Ubuntu', '14.04', 'libmysql-java', 'libdbd-mysql-perl', 'php5-mysql', 'python-mysqldb', 'libmysql-ruby', 'libmysqlclient-dev', 'mysqld-dev'
end
context 'freebsd' do
@ -43,8 +57,8 @@ describe 'mysql::bindings' do
end
context 'redhat' do
it_behaves_like 'bindings', 'RedHat', 'RedHat', '6.5', 'mysql-connector-java', 'perl-DBD-MySQL', 'php-mysql', 'MySQL-python', 'ruby-mysql'
it_behaves_like 'bindings', 'RedHat', 'OpenSuSE', '11.3', 'mysql-connector-java', 'perl-DBD-MySQL', 'php-mysql', 'MySQL-python', 'ruby-mysql'
it_behaves_like 'bindings', 'RedHat', 'RedHat', '6.5', 'mysql-connector-java', 'perl-DBD-MySQL', 'php-mysql', 'MySQL-python', 'ruby-mysql', 'libmysqlclient-devel', 'mysql-devel'
it_behaves_like 'bindings', 'RedHat', 'OpenSuSE', '11.3', 'mysql-connector-java', 'perl-DBD-MySQL', 'php-mysql', 'MySQL-python', 'ruby-mysql', 'libmysqlclient-devel', 'mysql-devel'
end
describe 'on any other os' do