Skip to content

Commit 995ab52

Browse files
authored
Merge pull request #126 from syseleven/fix-version-parameter
Change default of version parameter to 'installed'
2 parents e652fec + d783ed6 commit 995ab52

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ Defaults to 'grafana-server'.
342342

343343
##### `version`
344344

345-
The version of Grafana to install and manage. Defaults to the latest version of
346-
Grafana available at the time of module release.
345+
The version of Grafana to install and manage. Defaults to 'installed'
347346

348347
##### `sysconfig_location`
349348

manifests/init.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#
5555
# [*version*]
5656
# The version of Grafana to install and manage.
57-
# Defaults to the latest version of Grafana available at the time of module release.
57+
# Defaults to 'installed'
5858
#
5959
# [*repo_name*]
6060
# When using 'repo' install_method, the repo to look for packages in.
@@ -122,7 +122,7 @@
122122
Enum['stable', 'testing'] $repo_name = $::grafana::params::repo_name,
123123
String $rpm_iteration = $::grafana::params::rpm_iteration,
124124
String $service_name = $::grafana::params::service_name,
125-
String $version = $::grafana::params::version,
125+
String $version = 'installed',
126126
Hash $plugins = {},
127127
Hash $provisioning_dashboards = {},
128128
Hash $provisioning_datasources = {},

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
$package_name = 'grafana'
1515
$rpm_iteration = '1'
1616
$repo_name = 'stable'
17-
$version = '4.5.1'
1817
$create_subdirs_provisioning = false
1918
$provisioning_dashboards_file = '/etc/grafana/provisioning/dashboards/puppetprovisioned.yaml'
2019
$provisioning_datasources_file = '/etc/grafana/provisioning/datasources/puppetprovisioned.yaml'
20+
2121
case $facts['os']['family'] {
2222
'Archlinux': {
2323
$manage_package_repo = false

spec/acceptance/class_spec.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require 'spec_helper_acceptance'
22

33
describe 'grafana class' do
4+
# Create dummy module directorty
5+
shell('mkdir -p /etc/puppetlabs/code/environments/production/modules/my_custom_module/files/dashboards')
6+
47
context 'default parameters' do
58
# Using puppet_apply as a helper
69
it 'works idempotently with no errors' do
@@ -35,7 +38,7 @@ class { 'grafana':
3538
type => 'prometheus',
3639
access => 'proxy',
3740
url => 'http://localhost:9090/prometheus',
38-
isDefault => true,
41+
isDefault => false,
3942
},
4043
],
4144
},
@@ -76,7 +79,7 @@ class { 'grafana':
7679
type => 'prometheus',
7780
access => 'proxy',
7881
url => 'http://localhost:9090/prometheus',
79-
isDefault => true,
82+
isDefault => false,
8083
},
8184
],
8285
},
@@ -96,8 +99,8 @@ class { 'grafana':
9699
},
97100
],
98101
},
99-
provisioning_dashboards_file => '/opt/grafana/conf/provisioning/dashboards/dashboard.yaml',
100-
provisioning_datasources_file => '/opt/grafana/conf/provisioning/datasources/datasources.yaml'
102+
provisioning_dashboards_file => '/etc/grafana/provisioning/dashboards/dashboard.yaml',
103+
provisioning_datasources_file => '/etc/grafana/provisioning/datasources/datasources.yaml'
101104
}
102105
EOS
103106

spec/classes/grafana_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
context 'with parameter install_method is set to package' do
3838
let(:params) do
3939
{
40-
install_method: 'package'
40+
install_method: 'package',
41+
version: '4.5.1'
4142
}
4243
end
4344

@@ -113,7 +114,7 @@
113114
end
114115

115116
describe 'install the package' do
116-
it { is_expected.to contain_package('grafana').with_ensure('4.5.1') }
117+
it { is_expected.to contain_package('grafana').with_ensure('installed') }
117118
end
118119
when 'RedHat'
119120
describe 'yum repo dependencies first' do
@@ -126,7 +127,7 @@
126127
end
127128

128129
describe 'install the package' do
129-
it { is_expected.to contain_package('grafana').with_ensure('4.5.1-1') }
130+
it { is_expected.to contain_package('grafana').with_ensure('installed') }
130131
end
131132
end
132133
end
@@ -167,7 +168,8 @@
167168
context 'with parameter install_method is set to archive' do
168169
let(:params) do
169170
{
170-
install_method: 'archive'
171+
install_method: 'archive',
172+
version: '4.5.1'
171173
}
172174
end
173175

0 commit comments

Comments
 (0)