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,22 +6,30 @@ 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,
$java_package_provider = $mysql::params::java_package_provider,
$perl_package_ensure = $mysql::params::perl_package_ensure,
$perl_package_name = $mysql::params::perl_package_name,
$perl_package_provider = $mysql::params::perl_package_provider,
$php_package_ensure = $mysql::params::php_package_ensure,
$php_package_name = $mysql::params::php_package_name,
$php_package_provider = $mysql::params::php_package_provider,
$python_package_ensure = $mysql::params::python_package_ensure,
$python_package_name = $mysql::params::python_package_name,
$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
$java_package_ensure = $mysql::params::java_package_ensure,
$java_package_name = $mysql::params::java_package_name,
$java_package_provider = $mysql::params::java_package_provider,
$perl_package_ensure = $mysql::params::perl_package_ensure,
$perl_package_name = $mysql::params::perl_package_name,
$perl_package_provider = $mysql::params::perl_package_provider,
$php_package_ensure = $mysql::params::php_package_ensure,
$php_package_name = $mysql::params::php_package_name,
$php_package_provider = $mysql::params::php_package_provider,
$python_package_ensure = $mysql::params::python_package_ensure,
$python_package_name = $mysql::params::python_package_name,
$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,
$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

@ -10,17 +10,21 @@ class mysql::params {
$server_service_manage = true
$server_service_enabled = true
# mysql::bindings
$bindings_enable = false
$java_package_ensure = 'present'
$java_package_provider = undef
$perl_package_ensure = 'present'
$perl_package_provider = undef
$php_package_ensure = 'present'
$php_package_provider = undef
$python_package_ensure = 'present'
$python_package_provider = undef
$ruby_package_ensure = 'present'
$ruby_package_provider = undef
$bindings_enable = false
$java_package_ensure = 'present'
$java_package_provider = undef
$perl_package_ensure = 'present'
$perl_package_provider = undef
$php_package_ensure = 'present'
$php_package_provider = undef
$python_package_ensure = 'present'
$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 {
@ -61,20 +65,22 @@ class mysql::params {
$pidfile = '/var/run/mysqld/mysqld.pid'
}
$basedir = '/usr'
$datadir = '/var/lib/mysql'
$root_group = 'root'
$socket = '/var/lib/mysql/mysql.sock'
$ssl_ca = '/etc/mysql/cacert.pem'
$ssl_cert = '/etc/mysql/server-cert.pem'
$ssl_key = '/etc/mysql/server-key.pem'
$tmpdir = '/tmp'
$basedir = '/usr'
$datadir = '/var/lib/mysql'
$root_group = 'root'
$socket = '/var/lib/mysql/mysql.sock'
$ssl_ca = '/etc/mysql/cacert.pem'
$ssl_cert = '/etc/mysql/server-cert.pem'
$ssl_key = '/etc/mysql/server-key.pem'
$tmpdir = '/tmp'
# mysql::bindings
$java_package_name = 'mysql-connector-java'
$perl_package_name = 'perl-DBD-MySQL'
$php_package_name = 'php-mysql'
$python_package_name = 'MySQL-python'
$ruby_package_name = 'ruby-mysql'
$java_package_name = 'mysql-connector-java'
$perl_package_name = 'perl-DBD-MySQL'
$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,24 +122,26 @@ class mysql::params {
/OpenSuSE/ => 'rubygem-mysql',
/(SLES|SLED)/ => 'ruby-mysql',
}
$client_dev_package_name = 'libmysqlclient-devel'
$daemon_dev_package_name = 'mysql-devel'
}
'Debian': {
$client_package_name = 'mysql-client'
$server_package_name = 'mysql-server'
$client_package_name = 'mysql-client'
$server_package_name = 'mysql-server'
$basedir = '/usr'
$config_file = '/etc/mysql/my.cnf'
$datadir = '/var/lib/mysql'
$log_error = '/var/log/mysql/error.log'
$pidfile = '/var/run/mysqld/mysqld.pid'
$root_group = 'root'
$server_service_name = 'mysql'
$socket = '/var/run/mysqld/mysqld.sock'
$ssl_ca = '/etc/mysql/cacert.pem'
$ssl_cert = '/etc/mysql/server-cert.pem'
$ssl_key = '/etc/mysql/server-key.pem'
$tmpdir = '/tmp'
$basedir = '/usr'
$config_file = '/etc/mysql/my.cnf'
$datadir = '/var/lib/mysql'
$log_error = '/var/log/mysql/error.log'
$pidfile = '/var/run/mysqld/mysqld.pid'
$root_group = 'root'
$server_service_name = 'mysql'
$socket = '/var/run/mysqld/mysqld.sock'
$ssl_ca = '/etc/mysql/cacert.pem'
$ssl_cert = '/etc/mysql/server-cert.pem'
$ssl_key = '/etc/mysql/server-key.pem'
$tmpdir = '/tmp'
# mysql::bindings
$java_package_name = 'libmysql-java'
$perl_package_name = 'libdbd-mysql-perl'
@ -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,17 +14,21 @@ 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'
php_package = 'apache2-mod_php53'
python_package = 'python-mysql'
java_package = 'mysql-connector-java'
perl_package = 'perl-DBD-mysql'
php_package = 'apache2-mod_php53'
python_package = 'python-mysql'
case operatingsystem
when /OpenSuSE/
ruby_package = 'rubygem-mysql'
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