From c9ed37096ca7d743ddefe6372f173cfe018b3d85 Mon Sep 17 00:00:00 2001 From: tphoney Date: Wed, 29 Aug 2018 14:25:14 +0100 Subject: [PATCH] (MODULES-6923) remove staging module --- .fixtures.yml | 1 - manifests/server/mysqltuner.pp | 51 +++--------------- metadata.json | 8 +-- spec/classes/mysql_server_mysqltuner_spec.rb | 57 +++++++++----------- 4 files changed, 33 insertions(+), 84 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 099f1347c..ca905cbf6 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,7 +1,6 @@ fixtures: repositories: "stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib" - "staging": "https://github.com/voxpupuli/puppet-staging" "translate": "https://github.com/puppetlabs/puppetlabs-translate" "cron_core": "https://github.com/puppetlabs/puppetlabs-cron_core.git" symlinks: diff --git a/manifests/server/mysqltuner.pp b/manifests/server/mysqltuner.pp index b337f50ca..329a534d8 100644 --- a/manifests/server/mysqltuner.pp +++ b/manifests/server/mysqltuner.pp @@ -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, } } diff --git a/metadata.json b/metadata.json index d16708c35..608824d45 100644 --- a/metadata.json +++ b/metadata.json @@ -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", + "version_requirement": ">= 1.0.0 < 2.0.0" } ], "operatingsystem_support": [ diff --git a/spec/classes/mysql_server_mysqltuner_spec.rb b/spec/classes/mysql_server_mysqltuner_spec.rb index 3bca3d94e..ec31f1b2a 100644 --- a/spec/classes/mysql_server_mysqltuner_spec.rb +++ b/spec/classes/mysql_server_mysqltuner_spec.rb @@ -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