Merge pull request #624 from mhaskel/FM-2112

Remove mysqltuner, fetch with staging instead
This commit is contained in:
Travis Fields 2014-12-16 11:17:04 -08:00
commit 407e869b0f
6 changed files with 80 additions and 1031 deletions

View file

@ -1,5 +1,6 @@
fixtures:
repositories:
"stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib"
"staging": "https://github.com/nanliu/puppet-staging"
symlinks:
"mysql": "#{source_dir}"

View file

@ -347,6 +347,24 @@ The password to create for MySQL monitoring.
The hostname to allow to access the MySQL monitoring user.
####mysql::server::mysqltuner
***Note***
If using this class on a non-network-connected system you must download the mysqltuner.pl script and have it hosted somewhere accessible via `http(s)://`, `puppet://`, `ftp://`, or a fully qualified file path.
#####`ensure`
Whether the file should be `present` or `absent`. Defaults to `present`.
#####`version`
The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'.
#####`source`
Parameter to optionally specify the source. If not specified, defaults to `https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl`
####mysql::bindings
#####`install_options`

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,31 @@
#
class mysql::server::mysqltuner($ensure='present') {
# mysql performance tester
file { '/usr/local/bin/mysqltuner':
ensure => $ensure,
mode => '0550',
source => 'puppet:///modules/mysql/mysqltuner.pl',
class mysql::server::mysqltuner(
$ensure = 'present',
$version = 'v1.3.0',
$source = undef,
) {
if $source {
$_version = $source
$_source = $source
} else {
$_version = $version
$_source = "https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl"
}
if $ensure == 'present' {
class { 'staging': }
staging::file { "mysqltuner-${_version}":
source => $_source,
}
file { '/usr/local/bin/mysqltuner':
ensure => $ensure,
mode => '0550',
source => "${::staging::path}/mysql/mysqltuner-${_version}",
}
} else {
file { '/usr/local/bin/mysqltuner':
ensure => $ensure,
}
}
}

View file

@ -75,6 +75,7 @@
],
"description": "Mysql module",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"}
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"},
{"name":"nanliu/staging","version_requirement":"1.x"}
]
}

View file

@ -6,7 +6,37 @@ describe 'mysql::server::mysqltuner' do
describe "on #{pe_version} #{pe_platform}" do
let(:facts) { facts }
it { is_expected.to contain_file('/usr/local/bin/mysqltuner') }
context 'ensure => present' do
it { is_expected.to compile }
it { is_expected.to contain_staging__file('mysqltuner-v1.3.0').with({
:source => 'https://github.com/major/MySQLTuner-perl/raw/v1.3.0/mysqltuner.pl',
})
}
end
context 'ensure => absent' do
let(:params) {{ :ensure => 'absent' }}
it { is_expected.to compile }
it { is_expected.to contain_file('/usr/local/bin/mysqltuner').with(:ensure => 'absent') }
end
context 'custom version' do
let(:params) {{ :version => 'v1.2.0' }}
it { is_expected.to compile }
it { is_expected.to contain_staging__file('mysqltuner-v1.2.0').with({
:source => 'https://github.com/major/MySQLTuner-perl/raw/v1.2.0/mysqltuner.pl',
})
}
end
context 'custom source' do
let(:params) {{ :source => '/tmp/foo' }}
it { is_expected.to compile }
it { is_expected.to contain_staging__file('mysqltuner-/tmp/foo').with({
:source => '/tmp/foo',
})
}
end
end
end
end