File tree 4 files changed +14
-48
lines changed
4 files changed +14
-48
lines changed Original file line number Diff line number Diff line change 1
1
fixtures :
2
2
repositories :
3
3
" stdlib " : " https://github.com/puppetlabs/puppetlabs-stdlib"
4
- " staging " : " https://github.com/voxpupuli/puppet-staging "
4
+ " archive " : " https://github.com/voxpupuli/puppet-archive "
5
5
" translate " : " https://github.com/puppetlabs/puppetlabs-translate"
6
6
symlinks :
7
7
" mysql " : " #{source_dir}"
Original file line number Diff line number Diff line change 3
3
$ensure = ' present' ,
4
4
$version = ' v1.3.0' ,
5
5
$source = undef ,
6
- $environment = undef , # environment for staging::file
7
6
) {
8
7
9
8
if $source {
10
- $_version = $source
11
9
$_source = $source
12
10
} else {
13
- $_version = $version
14
11
$_source = " https://github.com/major/MySQLTuner-perl/raw/${version} /mysqltuner.pl"
15
12
}
16
13
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' ,
53
20
}
54
21
}
Original file line number Diff line number Diff line change 17
17
"version_requirement" : " >= 3.2.0 < 5.0.0"
18
18
},
19
19
{
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"
22
22
}
23
23
],
24
24
"operatingsystem_support" : [
Original file line number Diff line number Diff line change 4
4
on_supported_os . each do |os , facts |
5
5
context "on #{ os } " do
6
6
let ( :facts ) do
7
- facts . merge ( staging_http_get : 'curl' ,
8
- root_home : '/root' )
7
+ facts . merge ( root_home : '/root' )
9
8
end
10
9
11
10
context 'ensure => present' do
12
11
it { is_expected . to compile }
13
12
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' )
15
14
}
16
15
end
17
16
18
17
context 'ensure => absent' do
19
18
let ( :params ) { { ensure : 'absent' } }
20
19
21
20
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' ) }
23
22
end
24
23
25
24
context 'custom version' do
26
25
let ( :params ) { { version : 'v1.2.0' } }
27
26
28
27
it { is_expected . to compile }
29
28
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' )
31
30
}
32
31
end
33
32
36
35
37
36
it { is_expected . to compile }
38
37
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' )
40
39
}
41
40
end
42
41
end
You can’t perform that action at this time.
0 commit comments