File tree Expand file tree Collapse file tree 4 files changed +14
-48
lines changed
Expand file tree Collapse file tree 4 files changed +14
-48
lines changed Original file line number Diff line number Diff line change 11fixtures :
22 repositories :
33 " stdlib " : " https://github.com/puppetlabs/puppetlabs-stdlib"
4- " staging " : " https://github.com/voxpupuli/puppet-staging "
4+ " archive " : " https://github.com/voxpupuli/puppet-archive "
55 " translate " : " https://github.com/puppetlabs/puppetlabs-translate"
66 symlinks :
77 " mysql " : " #{source_dir}"
Original file line number Diff line number Diff line change 33 $ensure = ' present' ,
44 $version = ' v1.3.0' ,
55 $source = undef ,
6- $environment = undef , # environment for staging::file
76) {
87
98 if $source {
10- $_version = $source
119 $_source = $source
1210 } else {
13- $_version = $version
1411 $_source = " https://github.com/major/MySQLTuner-perl/raw/${version} /mysqltuner.pl"
1512 }
1613
17- if $ensure == ' present' {
18- # $::puppetversion doesn't exist in puppet 4.x so would break strict
19- # variables
20- if ! $::settings::strict_variables {
21- $_puppetversion = $::puppetversion
22- } else {
23- # defined only works with puppet >= 3.5.0, so don't use it unless we're
24- # actually using strict variables
25- $_puppetversion = defined (' $puppetversion' ) ? {
26- true => $::puppetversion ,
27- default => undef ,
28- }
29- }
30- # see https://tickets.puppetlabs.com/browse/ENTERPRISE-258
31- if $_puppetversion and $_puppetversion =~ /Puppet Enterprise/ and versioncmp($_puppetversion, ' 3.8.0' ) < 0 {
32- class { '::staging' :
33- path => ' /opt/mysql_staging' ,
34- }
35- } else {
36- class { '::staging' : }
37- }
38-
39- staging::file { "mysqltuner-${_version}" :
40- source => $_source,
41- environment => $environment ,
42- }
43- file { '/usr/local/bin/mysqltuner' :
44- ensure => $ensure ,
45- mode => ' 0550' ,
46- source => " ${::staging::path} /mysql/mysqltuner-${_version}" ,
47- require => Staging::File [" mysqltuner-${_version}" ],
48- }
49- } else {
50- file { '/usr/local/bin/mysqltuner' :
51- ensure => $ensure ,
52- }
14+ archive { '/usr/local/bin/mysqltuner' :
15+ ensure => $ensure ,
16+ source => $_source,
17+ }
18+ file { '/usr/local/bin/mysqltuner' :
19+ mode => ' 0550' ,
5320 }
5421}
Original file line number Diff line number Diff line change 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" : " puppet/archive " ,
21+ "version_requirement" : " >= 2.3.0 < 3 .0.0"
2222 }
2323 ],
2424 "operatingsystem_support" : [
Original file line number Diff line number Diff line change 44 on_supported_os . each do |os , facts |
55 context "on #{ os } " do
66 let ( :facts ) do
7- facts . merge ( staging_http_get : 'curl' ,
8- root_home : '/root' )
7+ facts . merge ( root_home : '/root' )
98 end
109
1110 context 'ensure => present' do
1211 it { is_expected . to compile }
1312 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' )
13+ is_expected . to contain_archive ( '/usr/local/bin/ mysqltuner') . with ( source : 'https://github.com/major/MySQLTuner-perl/raw/v1.3.0/mysqltuner.pl' )
1514 }
1615 end
1716
1817 context 'ensure => absent' do
1918 let ( :params ) { { ensure : 'absent' } }
2019
2120 it { is_expected . to compile }
22- it { is_expected . to contain_file ( '/usr/local/bin/mysqltuner' ) . with ( ensure : 'absent' ) }
21+ it { is_expected . to contain_archive ( '/usr/local/bin/mysqltuner' ) . with ( ensure : 'absent' ) }
2322 end
2423
2524 context 'custom version' do
2625 let ( :params ) { { version : 'v1.2.0' } }
2726
2827 it { is_expected . to compile }
2928 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' )
29+ is_expected . to contain_archive ( '/usr/local/bin/ mysqltuner') . with ( source : 'https://github.com/major/MySQLTuner-perl/raw/v1.2.0/mysqltuner.pl' )
3130 }
3231 end
3332
3635
3736 it { is_expected . to compile }
3837 it {
39- is_expected . to contain_staging__file ( 'mysqltuner-/tmp/foo ') . with ( source : '/tmp/foo' )
38+ is_expected . to contain_archive ( '/usr/local/bin/mysqltuner ') . with ( source : '/tmp/foo' )
4039 }
4140 end
4241 end
You can’t perform that action at this time.
0 commit comments