Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add php support #137

Merged
merged 1 commit into from

2 participants

@hunner
Owner

PHP libraries are required by many apps. This class assumes 'normal'
names for these packages, but allows other packages names to be passed
for variances such as 'php53-mysql' on RedHat and FreeBSD.

@hunner hunner Add php support
PHP libraries are required by many apps. This class assumes 'normal'
names for these packages, but allows other packages names to be passed
for variances such as 'php53-mysql' on RedHat and FreeBSD.
02c4da4
@glarizza
Collaborator

Tests look like they pass and this follows the pattern that's been used for other tech (mysql::python for example). Merging.

@glarizza glarizza merged commit 5b4e976 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 4, 2013
  1. @hunner

    Add php support

    hunner authored
    PHP libraries are required by many apps. This class assumes 'normal'
    names for these packages, but allows other packages names to be passed
    for variances such as 'php53-mysql' on RedHat and FreeBSD.
This page is out of date. Refresh to see the latest.
View
4 manifests/params.pp
@@ -41,6 +41,7 @@
$ruby_package_name = 'ruby-mysql'
$ruby_package_provider = 'gem'
$python_package_name = 'MySQL-python'
+ $php_package_name = 'php-mysql'
$java_package_name = 'mysql-connector-java'
$root_group = 'root'
$ssl_ca = '/etc/mysql/cacert.pem'
@@ -60,6 +61,7 @@
$log_error = '/var/log/mysql/error.log'
$ruby_package_name = 'libmysql-ruby'
$python_package_name = 'python-mysqldb'
+ $php_package_name = 'php5-mysql'
$java_package_name = 'libmysql-java'
$root_group = 'root'
$ssl_ca = '/etc/mysql/cacert.pem'
@@ -80,6 +82,7 @@
$ruby_package_name = 'ruby-mysql'
$ruby_package_provider = 'gem'
$python_package_name = 'databases/py-MySQLdb'
+ $php_package_name = 'php5-mysql'
$java_package_name = 'databases/mysql-connector-java'
$root_group = 'wheel'
$ssl_ca = undef
@@ -101,6 +104,7 @@
$ruby_package_name = 'ruby-mysql'
$ruby_package_provider = 'gem'
$python_package_name = 'MySQL-python'
+ $php_package_name = 'php-mysql'
$java_package_name = 'mysql-connector-java'
$root_group = 'root'
$ssl_ca = '/etc/mysql/cacert.pem'
View
20 manifests/php.pp
@@ -0,0 +1,20 @@
+# Class: mysql::php
+#
+# This class installs the php libs for mysql.
+#
+# Parameters:
+# [*ensure*] - ensure state for package.
+# can be specified as version.
+# [*packagee*] - name of package
+#
+class mysql::php(
+ $package_name = $mysql::params::php_package_name,
+ $package_ensure = 'present'
+) inherits mysql::params {
+
+ package { 'php-mysql':
+ ensure => $package_ensure,
+ name => $package_name,
+ }
+
+}
View
54 spec/classes/mysql_php_spec.rb
@@ -0,0 +1,54 @@
+require 'spec_helper'
+
+describe 'mysql::php' do
+
+ describe 'on a debian based os' do
+ let :facts do
+ { :osfamily => 'Debian'}
+ end
+ it { should contain_package('php-mysql').with(
+ :name => 'php5-mysql',
+ :ensure => 'present'
+ )}
+ end
+
+ describe 'on a freebsd based os' do
+ let :facts do
+ { :osfamily => 'FreeBSD'}
+ end
+ it { should contain_package('php-mysql').with(
+ :name => 'php5-mysql',
+ :ensure => 'present'
+ )}
+ end
+
+ describe 'on a redhat based os' do
+ let :facts do
+ {:osfamily => 'Redhat'}
+ end
+ it { should contain_package('php-mysql').with(
+ :name => 'php-mysql',
+ :ensure => 'present'
+ )}
+ describe 'when parameters are supplied' do
+ let :params do
+ {:package_ensure => 'latest', :package_name => 'php53-mysql'}
+ end
+ it { should contain_package('php-mysql').with(
+ :name => 'php53-mysql',
+ :ensure => 'latest'
+ )}
+ 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
Something went wrong with that request. Please try again.