Merge pull request #187 from RsrchBoy/topic/perl
add mysql::perl helper class
This commit is contained in:
commit
f3e5c89551
6 changed files with 110 additions and 1 deletions
|
@ -44,6 +44,7 @@ This module is based on work by David Schmitt. The following contributor have co
|
|||
* Matthias Pigulla
|
||||
* William Van Hevelingen
|
||||
* Michael Arnold
|
||||
* Chris Weyl
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -56,7 +57,12 @@ Installs the mysql-client package.
|
|||
Installs mysql bindings for java.
|
||||
|
||||
class { 'mysql::java': }
|
||||
|
||||
|
||||
### mysql::perl
|
||||
Installs mysql bindings for perl
|
||||
|
||||
class { 'mysql::perl': }
|
||||
|
||||
### mysql::php
|
||||
Installs mysql bindings for php
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
#
|
||||
# [*package_name*] - legacy parameter used to specify the client package. Should not be used going forward
|
||||
#
|
||||
# [*perl_package_name*] - The name of the perl mysql package to install
|
||||
#
|
||||
# [*perl_package_provider*] - The installation suite to use when installing the perl package.
|
||||
#
|
||||
# [*php_package_name*] - The name of the phpmysql package to install
|
||||
#
|
||||
# [*pidfile*] - The location mysql will expect the pidfile to be, and will put it when starting the service.
|
||||
|
@ -101,6 +105,8 @@ class mysql(
|
|||
$old_root_password = $mysql::params::old_root_password,
|
||||
$package_ensure = $mysql::params::package_ensure,
|
||||
$package_name = undef,
|
||||
$perl_package_name = $mysql::params::perl_package_name,
|
||||
$perl_package_provider = $mysql::params::perl_package_provider,
|
||||
$php_package_name = $mysql::params::php_package_name,
|
||||
$pidfile = $mysql::params::pidfile,
|
||||
$port = $mysql::params::port,
|
||||
|
|
|
@ -44,6 +44,7 @@ class mysql::params {
|
|||
$tmpdir = '/tmp'
|
||||
$java_package_name = 'mysql-connector-java'
|
||||
$log_error = '/var/log/mysqld.log'
|
||||
$perl_package_name = 'perl-DBD-MySQL'
|
||||
$php_package_name = 'php-mysql'
|
||||
$pidfile = '/var/run/mysqld/mysqld.pid'
|
||||
$python_package_name = 'MySQL-python'
|
||||
|
@ -86,6 +87,7 @@ class mysql::params {
|
|||
/(SLES|SLED)/ => 'ruby-mysql',
|
||||
}
|
||||
$python_package_name = 'python-mysql'
|
||||
$perl_package_name = 'perl-DBD-mysql'
|
||||
$java_package_name = 'mysql-connector-java'
|
||||
$root_group = 'root'
|
||||
$ssl_ca = '/etc/mysql/cacert.pem'
|
||||
|
@ -104,6 +106,7 @@ class mysql::params {
|
|||
$pidfile = '/var/run/mysqld/mysqld.pid'
|
||||
$config_file = '/etc/mysql/my.cnf'
|
||||
$log_error = '/var/log/mysql/error.log'
|
||||
$perl_package_name = 'libdbd-mysql-perl'
|
||||
$ruby_package_name = 'libmysql-ruby'
|
||||
$python_package_name = 'python-mysqldb'
|
||||
$php_package_name = 'php5-mysql'
|
||||
|
@ -125,6 +128,7 @@ class mysql::params {
|
|||
$pidfile = '/var/db/mysql/mysql.pid'
|
||||
$config_file = '/var/db/mysql/my.cnf'
|
||||
$log_error = "/var/db/mysql/${::hostname}.err"
|
||||
$perl_package_name = 'p5-DBD-mysql'
|
||||
$ruby_package_name = 'ruby-mysql'
|
||||
$ruby_package_provider = 'gem'
|
||||
$python_package_name = 'databases/py-MySQLdb'
|
||||
|
@ -148,6 +152,8 @@ class mysql::params {
|
|||
$socket = '/var/lib/mysql/mysql.sock'
|
||||
$config_file = '/etc/my.cnf'
|
||||
$log_error = '/var/log/mysqld.log'
|
||||
# XXX validate...
|
||||
$perl_package_name = 'perl-DBD-MySQL'
|
||||
$ruby_package_name = 'ruby-mysql'
|
||||
$ruby_package_provider = 'gem'
|
||||
$python_package_name = 'MySQL-python'
|
||||
|
|
28
manifests/perl.pp
Normal file
28
manifests/perl.pp
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Class: mysql::perl
|
||||
#
|
||||
# installs the perl bindings for mysql
|
||||
#
|
||||
# Parameters:
|
||||
# [*package_ensure*] - Ensure state for package. Can be specified as version.
|
||||
# [*package_name*] - name of package
|
||||
# [*package_provider*] - The provider to use to install the package
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
class mysql::perl (
|
||||
$package_ensure = 'present',
|
||||
$package_name = $mysql::perl_package_name,
|
||||
$package_provider = $mysql::perl_package_provider
|
||||
) inherits mysql {
|
||||
|
||||
package{ 'perl_mysql':
|
||||
ensure => $package_ensure,
|
||||
name => $package_name,
|
||||
provider => $package_provider,
|
||||
}
|
||||
|
||||
}
|
62
spec/classes/mysql_perl_spec.rb
Normal file
62
spec/classes/mysql_perl_spec.rb
Normal file
|
@ -0,0 +1,62 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::perl' do
|
||||
|
||||
describe 'on a debian based os' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian'}
|
||||
end
|
||||
it { should contain_package('perl_mysql').with(
|
||||
:name => 'libdbd-mysql-perl',
|
||||
:ensure => 'present',
|
||||
# TODO is this what we want? does this actually work
|
||||
# if the provider is blank
|
||||
:provider => ''
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'on a freebsd based os' do
|
||||
let :facts do
|
||||
{ :osfamily => 'FreeBSD'}
|
||||
end
|
||||
it { should contain_package('perl_mysql').with(
|
||||
:name => 'p5-DBD-mysql',
|
||||
:ensure => 'present',
|
||||
:provider => ''
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'on a redhat based os' do
|
||||
let :facts do
|
||||
{:osfamily => 'Redhat'}
|
||||
end
|
||||
it { should contain_package('perl_mysql').with(
|
||||
:name => 'perl-DBD-MySQL',
|
||||
:ensure => 'present',
|
||||
:provider => ''
|
||||
)}
|
||||
describe 'when parameters are supplied' do
|
||||
let :params do
|
||||
{:package_ensure => 'latest',
|
||||
:package_provider => 'zypper',
|
||||
:package_name => 'mysql_perl'}
|
||||
end
|
||||
it { should contain_package('perl_mysql').with(
|
||||
:name => 'mysql_perl',
|
||||
:ensure => 'latest',
|
||||
:provider => 'zypper'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on any other os' do
|
||||
let :facts do
|
||||
{:osfamily => 'foo'}
|
||||
end
|
||||
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(/Unsupported osfamily: foo/)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
1
tests/perl.pp
Normal file
1
tests/perl.pp
Normal file
|
@ -0,0 +1 @@
|
|||
include mysql::perl
|
Loading…
Reference in a new issue