-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from RsrchBoy/topic/perl
add mysql::perl helper class
- Loading branch information
Showing
6 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include mysql::perl |