Skip to content

Commit ae9b356

Browse files
committed
allow installing non-version locked package on Red Hat with repo method
fixed spec syntax error, and locking json_pure to compatible version for rbuy 1.9
1 parent 6d54c09 commit ae9b356

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ group :test do
55
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.6.0'
66
gem 'metadata-json-lint'
77
gem "puppet-lint"
8-
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
8+
gem "rspec-puppet"
99
gem "puppet-syntax"
1010
gem "puppetlabs_spec_helper"
1111
gem "toml"
12+
gem 'json_pure', '<= 1.8.3', :require => false if RUBY_VERSION.to_f <= 1.9
1213
end
1314

1415
group :development do

manifests/install.pp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
default => $real_archive_source,
1919
}
2020
}
21-
21+
2222
case $::grafana::install_method {
2323
'docker': {
2424
docker::image { 'grafana/grafana':
@@ -107,8 +107,13 @@
107107
}
108108
}
109109

110+
if ($::grafana::version == 'installed' or $::grafana::version == 'latest' or $::grafana::version == 'present') {
111+
$package_ensure = $::grafana::version
112+
} else {
113+
$package_ensure = "${::grafana::version}-${::grafana::rpm_iteration}"
114+
}
110115
package { $::grafana::package_name:
111-
ensure => "${::grafana::version}-${::grafana::rpm_iteration}",
116+
ensure => $package_ensure,
112117
require => Package['fontconfig']
113118
}
114119
}

spec/classes/grafana_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@
139139
it { should contain_package('grafana').with_ensure('present') }
140140
end
141141
end
142+
143+
context 'redhat' do
144+
let(:facts) {{
145+
:osfamily => 'RedHat',
146+
}}
147+
148+
it { should compile.with_all_deps }
149+
describe 'install the package' do
150+
it { should contain_package('grafana').with_ensure('present') }
151+
end
152+
end
142153
end
143154

144155
context 'archive install method' do

0 commit comments

Comments
 (0)