-
Notifications
You must be signed in to change notification settings - Fork 794
(MODULES-6923) remove staging module #1115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,59 +7,22 @@ | |
# The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. | ||
# @param source | ||
# Source path for the mysqltuner package. | ||
# @param environment | ||
# Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' | ||
# | ||
# @param tuner_location | ||
# Destination for the mysqltuner package. | ||
class mysql::server::mysqltuner( | ||
$ensure = 'present', | ||
$version = 'v1.3.0', | ||
$source = undef, | ||
$environment = undef, # environment for staging::file | ||
$tuner_location = '/usr/local/bin/mysqltuner', | ||
) { | ||
|
||
if $source { | ||
$_version = $source | ||
$_source = $source | ||
} else { | ||
$_version = $version | ||
$_source = "https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl" | ||
} | ||
|
||
if $ensure == 'present' { | ||
# $::puppetversion doesn't exist in puppet 4.x so would break strict | ||
# variables | ||
if ! $::settings::strict_variables { | ||
$_puppetversion = $::puppetversion | ||
} else { | ||
# defined only works with puppet >= 3.5.0, so don't use it unless we're | ||
# actually using strict variables | ||
$_puppetversion = defined('$puppetversion') ? { | ||
true => $::puppetversion, | ||
default => undef, | ||
} | ||
} | ||
# see https://tickets.puppetlabs.com/browse/ENTERPRISE-258 | ||
if $_puppetversion and $_puppetversion =~ /Puppet Enterprise/ and versioncmp($_puppetversion, '3.8.0') < 0 { | ||
class { '::staging': | ||
path => '/opt/mysql_staging', | ||
} | ||
} else { | ||
class { '::staging': } | ||
} | ||
|
||
staging::file { "mysqltuner-${_version}": | ||
source => $_source, | ||
environment => $environment, | ||
} | ||
file { '/usr/local/bin/mysqltuner': | ||
ensure => $ensure, | ||
mode => '0550', | ||
source => "${::staging::path}/mysql/mysqltuner-${_version}", | ||
require => Staging::File["mysqltuner-${_version}"], | ||
} | ||
} else { | ||
file { '/usr/local/bin/mysqltuner': | ||
ensure => $ensure, | ||
} | ||
file { $tuner_location: | ||
ensure => $ensure, | ||
mode => '0550', | ||
source => $_source, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. I expected a really complicated rewrite by replacing staging with archive, but I also forgot that the file resource can now take https links <3. Since which puppet version is this supported? Does the support puppet version range within this module needs to be adjusted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double checked this before merging, but http support for file source was in 4.7 which is the lower boundary of the module: https://puppet.com/docs/puppet/4.7/type.html#file-attribute-source , so we should be good without bumping the puppet version. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,17 +8,13 @@ | |
"project_page": "http://github.com/puppetlabs/puppetlabs-mysql", | ||
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES", | ||
"dependencies": [ | ||
{ | ||
"name": "puppetlabs/translate", | ||
"version_requirement": ">= 1.0.0 < 2.0.0" | ||
}, | ||
{ | ||
"name": "puppetlabs/stdlib", | ||
"version_requirement": ">= 3.2.0 < 6.0.0" | ||
}, | ||
{ | ||
"name": "puppet/staging", | ||
"version_requirement": ">= 1.0.1 < 4.0.0" | ||
"name": "puppetlabs/translate", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the diff would be a tiny bit cleaner if this would still be on top of stdlib, but it doesn't really matter. |
||
"version_requirement": ">= 1.0.0 < 2.0.0" | ||
} | ||
], | ||
"operatingsystem_support": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,35 @@ | ||
require 'spec_helper' | ||
|
||
describe 'mysql::server::mysqltuner' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts.merge(staging_http_get: 'curl', | ||
root_home: '/root') | ||
end | ||
|
||
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 => present' do | ||
it { is_expected.to compile } | ||
it { | ||
is_expected.to contain_file('/usr/local/bin/mysqltuner') | ||
} | ||
end | ||
|
||
context 'ensure => absent' do | ||
let(:params) { { ensure: 'absent' } } | ||
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 | ||
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' } } | ||
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 | ||
it { is_expected.to compile } | ||
it { | ||
is_expected.to contain_file('/usr/local/bin/mysqltuner') | ||
} | ||
end | ||
|
||
context 'custom source' do | ||
let(:params) { { source: '/tmp/foo' } } | ||
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 | ||
it { is_expected.to compile } | ||
it { | ||
is_expected.to contain_file('/usr/local/bin/mysqltuner') | ||
} | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but GH also has a raw.github.com that's more efficient for them. Might be worth looking into but doesn't have to be part of this PR.