Skip to content

Commit 899d1e5

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

File tree

4 files changed

+33
-82
lines changed

4 files changed

+33
-82
lines changed

.fixtures.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
fixtures:
22
repositories:
33
"stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib"
4-
"staging": "https://github.com/voxpupuli/puppet-staging"
54
"translate": "https://github.com/puppetlabs/puppetlabs-translate"
65
symlinks:
76
"mysql": "#{source_dir}"

manifests/server/mysqltuner.pp

+7-42
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,24 @@
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-
#
10+
# @param tuner_location
11+
# Destination for the mysqltuner package.
1312
class mysql::server::mysqltuner(
1413
$ensure = 'present',
1514
$version = 'v1.3.0',
1615
$source = undef,
17-
$environment = undef, # environment for staging::file
16+
$tuner_location = '/usr/local/bin/mysqltuner',
1817
) {
19-
2018
if $source {
2119
$_version = $source
2220
$_source = $source
2321
} else {
2422
$_version = $version
2523
$_source = "https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl"
2624
}
27-
28-
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,
53-
}
54-
file { '/usr/local/bin/mysqltuner':
55-
ensure => $ensure,
56-
mode => '0550',
57-
source => "${::staging::path}/mysql/mysqltuner-${_version}",
58-
require => Staging::File["mysqltuner-${_version}"],
59-
}
60-
} else {
61-
file { '/usr/local/bin/mysqltuner':
62-
ensure => $ensure,
63-
}
25+
file { $tuner_location:
26+
ensure => $ensure,
27+
mode => '0550',
28+
source => $_source,
6429
}
6530
}

metadata.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
"project_page": "http://github.com/puppetlabs/puppetlabs-mysql",
99
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
1010
"dependencies": [
11-
{
12-
"name": "puppetlabs/translate",
13-
"version_requirement": ">= 1.0.0 < 2.0.0"
14-
},
1511
{
1612
"name": "puppetlabs/stdlib",
1713
"version_requirement": ">= 3.2.0 < 5.0.0"
1814
},
1915
{
20-
"name": "puppet/staging",
21-
"version_requirement": ">= 1.0.1 < 4.0.0"
16+
"name": "puppetlabs/translate",
17+
"version_requirement": ">= 1.0.0 < 2.0.0"
2218
}
2319
],
2420
"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_file('/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_file('/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_file('/usr/local/bin/mysqltuner')
33+
}
4334
end
4435
end

0 commit comments

Comments
 (0)