Rework the mysql::bindings to be less complex.

This removes all the internal class parameters and shrinks these classes
to be more straightforward, relying on the values set in bindings.pp.
This commit is contained in:
Ashley Penney 2013-09-13 13:11:58 -04:00
parent 6a733e9503
commit 3f9297e10e
7 changed files with 57 additions and 143 deletions

View file

@ -1,58 +1,32 @@
# Class: mysql::bindings # See README.md.
#
# This class installs various bindings for mysql.
#
# Parameters:
#
# [*java_enable*] - Boolean to determine if we should include the java bindings.
#
# [*perl_enable*] - Boolean to determine if we should include the perl bindings.
#
# [*python_enable*] - Boolean to determine if we should include the python bindings.
#
# [*ruby_enable*] - Boolean to determine if we should include the ruby bindings.
#
# [*java_package_name*] - The name of the java package containing the java connector
#
# [*java_package_ensure*] - State of the java binding packages.
#
# [*perl_package_ensure*] - State of the perl binding packages.
#
# [*perl_package_name*] - The name of the perl mysql package to install
#
# [*perl_package_provider*] - The provider to use when installing the perl package.
#
# [*python_package_ensure*] - State of the python binding packages.
#
# [*python_package_name*] - The name of the python mysql package to install
#
# [*ruby_ensure*] - State of the ruby binding packages.
#
# [*ruby_package_name*] - The name of the ruby mysql package to install
#
# [*ruby_package_provider*] - The provider to use when installing the ruby package.
#
class mysql::bindings ( class mysql::bindings (
# Boolean to determine if we should include the classes. # Boolean to determine if we should include the classes.
$java_enable = false, $java_enable = false,
$perl_enable = false, $perl_enable = false,
$php_enable = false,
$python_enable = false, $python_enable = false,
$ruby_enable = false, $ruby_enable = false,
# Settings for the various classes. # Settings for the various classes.
$java_package_ensure = $mysql::globals::java_package_ensure, $java_package_ensure = $mysql::params::java_package_ensure,
$java_package_name = $mysql::globals::java_package_name, $java_package_name = $mysql::params::java_package_name,
$perl_package_ensure = $mysql::globals::perl_package_ensure, $java_package_provider = $mysql::params::java_package_provider,
$perl_package_name = $mysql::globals::perl_package_name, $perl_package_ensure = $mysql::params::perl_package_ensure,
$perl_package_provider = $mysql::globals::perl_package_provider, $perl_package_name = $mysql::params::perl_package_name,
$python_package_ensure = $mysql::globals::python_package_ensure, $perl_package_provider = $mysql::params::perl_package_provider,
$python_package_name = $mysql::globals::python_package_name, $php_package_ensure = $mysql::params::php_package_ensure,
$ruby_package_ensure = $mysql::globals::ruby_package_ensure, $php_package_name = $mysql::params::php_package_name,
$ruby_package_name = $mysql::globals::ruby_package_name, $php_package_provider = $mysql::params::php_package_provider,
$ruby_package_provider = $mysql::globals::ruby_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
) inherits mysql::globals { ) inherits mysql::globals {
if $java_enable { include '::mysql::bindings::java' } if $java_enable { include '::mysql::bindings::java' }
if $perl_enable { include '::mysql::bindings::perl' } if $perl_enable { include '::mysql::bindings::perl' }
if $php_enable { include '::mysql::bindings::php' }
if $python_enable { include '::mysql::bindings::python' } if $python_enable { include '::mysql::bindings::python' }
if $ruby_enable { include '::mysql::bindings::ruby' } if $ruby_enable { include '::mysql::bindings::ruby' }

View file

@ -1,24 +1,10 @@
# Class: mysql::bindings::java # Private class
# class mysql::bindings::java {
# This class installs the mysql-java-connector.
#
# Parameters:
# [*package_name*] - The name of the mysql java package.
# [*package_ensure*] - Ensure state for package. Can be specified as version.
# Actions:
#
# Requires:
#
# Sample Usage:
#
class mysql::bindings::java (
$package_ensure = $mysql::bindings::java_package_ensure,
$package_name = $mysql::bindings::java_package_name
) inherits mysql::globals {
package { 'mysql-connector-java': package { 'mysql-connector-java':
ensure => $package_ensure, ensure => $mysql::bindings::java_package_ensure,
name => $package_name, name => $mysql::bindings::java_package_name,
provider => $mysql::bindings::java_package_provider,
} }
} }

View file

@ -1,28 +1,10 @@
# Class: mysql::bindings::perl # Private class
# class mysql::bindings::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::bindings::perl (
$package_ensure = $mysql::bindings::perl_package_ensure,
$package_name = $mysql::bindings::perl_package_name,
$package_provider = $mysql::bindings::perl_package_provider
) inherits mysql::globals {
package{ 'perl_mysql': package{ 'perl_mysql':
ensure => $package_ensure, ensure => $mysql::bindings::perl_package_ensure,
name => $package_name, name => $mysql::bindings::perl_package_name,
provider => $package_provider, provider => $mysql::bindings::perl_package_provider,
} }
} }

10
manifests/bindings/php.pp Normal file
View file

@ -0,0 +1,10 @@
# Private class: See README.md
class mysql::bindings::php {
package { 'php-mysql':
ensure => $mysql::bindings::php_package_ensure,
name => $mysql::bindings::php_package_name,
provider => $mysql::bindings::php_package_provider,
}
}

View file

@ -1,25 +1,10 @@
# Class: mysql::bindings::python # Private class
# class mysql::bindings::python {
# This class installs the python libs for mysql.
#
# Parameters:
# [*package_ensure*] - Ensure state for package. Can be specified as version.
# [*package_name*] - Name of package
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
class mysql::bindings::python(
$package_ensure = $mysql::bindings::python_package_ensure,
$package_name = $mysql::bindings::python_package_name
) inherits mysql::globals {
package { 'python-mysqldb': package { 'python-mysqldb':
ensure => $package_ensure, ensure => $mysql::bindings::python_package_ensure,
name => $package_name, name => $mysql::bindings::python_package_name,
provider => $mysql::bindings::python_package_provider,
} }
} }

View file

@ -1,28 +1,10 @@
# Class: mysql::bindings::ruby # Private class
# class mysql::bindings::ruby {
# installs the ruby 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::bindings::ruby (
$package_ensure = $mysql::bindings::ruby_package_ensure,
$package_name = $mysql::bindings::ruby_package_name,
$package_provider = $mysql::bindings::ruby_package_provider
) inherits mysql::globals {
package{ 'ruby_mysql': package{ 'ruby_mysql':
ensure => $package_ensure, ensure => $mysql::bindings::ruby_package_ensure,
name => $package_name, name => $mysql::bindings::ruby_package_name,
provider => $package_provider, provider => $mysql::bindings::ruby_package_provider,
} }
} }

View file

@ -1,19 +1,14 @@
# Class: mysql::php
#
# This class installs the php libs for mysql.
#
# Parameters:
# [*package_ensure*] - Ensure state for package. Can be specified as version.
# [*package_name*] - The name of package
#
class mysql::php( class mysql::php(
$package_ensure = 'present', $package_ensure = $mysql::params::php_package_name,
$package_name = $mysql::php_package_name $package_name = $mysql::params::php_package_name,
) inherits mysql { ) inherits mysql::params {
package { 'php-mysql': notify { "mysql::php has been renamed to mysql::bindings::php and this
ensure => $package_ensure, backwards compatibility shim will be removed on 01/01/2014.": }
name => $package_name,
class { 'mysql::bindings::php':
package_ensure => $package_ensure,
package_name => $package_name,
} }
} }