Skip to content

Commit 28c6e39

Browse files
author
tphoney
committed
(MODULES-6923) replace staging module with archive
1 parent 0915ae1 commit 28c6e39

File tree

4 files changed

+36
-72
lines changed

4 files changed

+36
-72
lines changed

.fixtures.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fixtures:
22
repositories:
3+
"archive": "https://github.com/voxpupuli/puppet-archive"
34
"stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib"
4-
"staging": "https://github.com/voxpupuli/puppet-staging"
55
"translate": "https://github.com/puppetlabs/puppetlabs-translate"
66
symlinks:
77
"mysql": "#{source_dir}"

manifests/server/mysqltuner.pp

+7-34
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,31 @@
77
# The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'.
88
# @param source
99
# Source path for the mysqltuner package.
10-
# @param environment
11-
# Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80'
12-
#
1310
class mysql::server::mysqltuner(
1411
$ensure = 'present',
1512
$version = 'v1.3.0',
1613
$source = undef,
17-
$environment = undef, # environment for staging::file
1814
) {
19-
15+
$tuner_location = '/usr/local/bin/mysqltuner'
2016
if $source {
2117
$_version = $source
2218
$_source = $source
2319
} else {
2420
$_version = $version
2521
$_source = "https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl"
2622
}
27-
2823
if $ensure == 'present' {
29-
# $::puppetversion doesn't exist in puppet 4.x so would break strict
30-
# variables
31-
if ! $::settings::strict_variables {
32-
$_puppetversion = $::puppetversion
33-
} else {
34-
# defined only works with puppet >= 3.5.0, so don't use it unless we're
35-
# actually using strict variables
36-
$_puppetversion = defined('$puppetversion') ? {
37-
true => $::puppetversion,
38-
default => undef,
39-
}
40-
}
41-
# see https://tickets.puppetlabs.com/browse/ENTERPRISE-258
42-
if $_puppetversion and $_puppetversion =~ /Puppet Enterprise/ and versioncmp($_puppetversion, '3.8.0') < 0 {
43-
class { '::staging':
44-
path => '/opt/mysql_staging',
45-
}
46-
} else {
47-
class { '::staging': }
48-
}
49-
50-
staging::file { "mysqltuner-${_version}":
51-
source => $_source,
52-
environment => $environment,
24+
archive { $tuner_location:
25+
ensure => $ensure,
26+
source => $_source,
5327
}
54-
file { '/usr/local/bin/mysqltuner':
28+
file { $tuner_location:
5529
ensure => $ensure,
5630
mode => '0550',
57-
source => "${::staging::path}/mysql/mysqltuner-${_version}",
58-
require => Staging::File["mysqltuner-${_version}"],
31+
require => Archive[$tuner_location],
5932
}
6033
} else {
61-
file { '/usr/local/bin/mysqltuner':
34+
file { $tuner_location:
6235
ensure => $ensure,
6336
}
6437
}

metadata.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
1010
"dependencies": [
1111
{
12-
"name": "puppetlabs/translate",
13-
"version_requirement": ">= 1.0.0 < 2.0.0"
12+
"name": "puppet/archive",
13+
"version_requirement": ">= 3.2.0 < 4.0.0"
1414
},
1515
{
1616
"name": "puppetlabs/stdlib",
1717
"version_requirement": ">= 3.2.0 < 5.0.0"
1818
},
1919
{
20-
"name": "puppet/staging",
21-
"version_requirement": ">= 1.0.1 < 4.0.0"
20+
"name": "puppetlabs/translate",
21+
"version_requirement": ">= 1.0.0 < 2.0.0"
2222
}
2323
],
2424
"operatingsystem_support": [
+24-33
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
11
require 'spec_helper'
22

33
describe 'mysql::server::mysqltuner' do
4-
on_supported_os.each do |os, facts|
5-
context "on #{os}" do
6-
let(:facts) do
7-
facts.merge(staging_http_get: 'curl',
8-
root_home: '/root')
9-
end
10-
11-
context 'ensure => present' do
12-
it { is_expected.to compile }
13-
it {
14-
is_expected.to contain_staging__file('mysqltuner-v1.3.0').with(source: 'https://github.com/major/MySQLTuner-perl/raw/v1.3.0/mysqltuner.pl')
15-
}
16-
end
4+
context 'ensure => present' do
5+
it { is_expected.to compile }
6+
it {
7+
is_expected.to contain_archive('/usr/local/bin/mysqltuner')
8+
}
9+
end
1710

18-
context 'ensure => absent' do
19-
let(:params) { { ensure: 'absent' } }
11+
context 'ensure => absent' do
12+
let(:params) { { ensure: 'absent' } }
2013

21-
it { is_expected.to compile }
22-
it { is_expected.to contain_file('/usr/local/bin/mysqltuner').with(ensure: 'absent') }
23-
end
14+
it { is_expected.to compile }
15+
it { is_expected.to contain_file('/usr/local/bin/mysqltuner').with(ensure: 'absent') }
16+
end
2417

25-
context 'custom version' do
26-
let(:params) { { version: 'v1.2.0' } }
18+
context 'custom version' do
19+
let(:params) { { version: 'v1.2.0' } }
2720

28-
it { is_expected.to compile }
29-
it {
30-
is_expected.to contain_staging__file('mysqltuner-v1.2.0').with(source: 'https://github.com/major/MySQLTuner-perl/raw/v1.2.0/mysqltuner.pl')
31-
}
32-
end
21+
it { is_expected.to compile }
22+
it {
23+
is_expected.to contain_archive('/usr/local/bin/mysqltuner')
24+
}
25+
end
3326

34-
context 'custom source' do
35-
let(:params) { { source: '/tmp/foo' } }
27+
context 'custom source' do
28+
let(:params) { { source: '/tmp/foo' } }
3629

37-
it { is_expected.to compile }
38-
it {
39-
is_expected.to contain_staging__file('mysqltuner-/tmp/foo').with(source: '/tmp/foo')
40-
}
41-
end
42-
end
30+
it { is_expected.to compile }
31+
it {
32+
is_expected.to contain_archive('/usr/local/bin/mysqltuner')
33+
}
4334
end
4435
end

0 commit comments

Comments
 (0)