Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit 2e81de6

Browse files
committed
Merge pull request #271 from echocat/develop
backmerge for release 6.0.2
2 parents 5690e45 + c5ce34f commit 2e81de6

File tree

13 files changed

+136
-163
lines changed

13 files changed

+136
-163
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2016-04-11 - 6.0.2 (Bugfix release)
2+
3+
#### Bugfixes:
4+
5+
- (debfe5d) remove parameter `gr_pid_dir` and use `gr_storage_dir` instead.
6+
- RedHat init scripts use correct `gr_base_dir` for graphite.
7+
18
## 2016-04-01 - 6.0.1 (Bugfix release)
29

310
#### Features:

Gemfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,14 @@ def location_for(place, version = nil)
1111
end
1212

1313
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || '~> 4')
14-
gem 'facter', '>= 2.0'
14+
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'] || '~> 2')
1515
gem 'puppetlabs_spec_helper', '>= 0.1.0', :require => false
1616
gem 'puppet-lint', '>= 0.3.2', :require => false
1717
gem 'rspec-puppet', '>= 2.3.2', :require => false
18+
gem 'rspec-puppet-facts', :require => false
1819
gem 'metadata-json-lint', :require => false
1920
gem 'rake', '< 11.0.0' # rubi <1.9 versus rake 11.0.0 workaround
2021

21-
if ENV['COVERAGE'] == 'yes'
22-
gem 'simplecov', :require => false
23-
gem 'coveralls', :require => false
24-
end
25-
2622
if File.exists? "#{__FILE__}.local"
2723
eval(File.read("#{__FILE__}.local"), binding)
2824
end

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ Default is '/opt/graphite'. Set base install location of Graphite. This forms th
373373

374374
#####`gr_storage_dir`
375375

376-
Default is '${gr_base_dir}/storage'. Set location of base storage files. When not installing using pip a typical location for this may be '/opt/carbon'.
376+
Default is '${gr_base_dir}/storage'. Set location of base storage files. When not installing using pip a typical location for this may be '/opt/carbon'. This dir is also used as pid dir on RedHat.
377377

378378
#####`gr_local_data_dir`
379379

manifests/config.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
$::graphite::rrd_dir_REAL,
110110
$::graphite::whitelists_dir_REAL,
111111
$::graphite::graphiteweb_log_dir_REAL,
112-
$::graphite::gr_pid_dir,
113112
"${::graphite::base_dir_REAL}/bin"]:
114113
ensure => directory,
115114
group => $gr_web_group_REAL,

manifests/config_apache.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
hasstatus => true;
9292
}
9393

94+
95+
9496
# Deploy configfiles
9597
file {
9698
"${::graphite::params::apache_dir}/ports.conf":
@@ -104,14 +106,15 @@
104106
Package[$::graphite::params::apache_wsgi_pkg],
105107
],
106108
notify => Service[$::graphite::params::apache_service_name];
109+
107110
"${::graphite::params::apacheconf_dir}/graphite.conf":
108111
ensure => file,
109112
content => template($::graphite::gr_apache_conf_template),
110113
group => $::graphite::config::gr_web_group_REAL,
111114
mode => '0644',
112115
owner => $::graphite::config::gr_web_user_REAL,
113116
require => [
114-
File[$::graphite::gr_storage_dir],
117+
File[$::graphite::storage_dir_REAL],
115118
File["${::graphite::params::apache_dir}/ports.conf"],
116119
],
117120
notify => Service[$::graphite::params::apache_service_name];

manifests/init.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@
671671
$gr_graphiteweb_webapp_dir = undef,
672672
$gr_graphiteweb_storage_dir = '/var/lib/graphite-web',
673673
$gr_graphiteweb_install_lib_dir = undef,
674-
$gr_pid_dir = '/var/run',
675674
$gr_apache_logdir = '/var/log/httpd/graphite-web',
676675
$gunicorn_arg_timeout = 30,
677676
$gunicorn_bind = 'unix:/var/run/graphite.sock',

metadata.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dwerder-graphite",
3-
"version": "6.0.1",
3+
"version": "6.0.2",
44
"source": "https://github.com/echocat/puppet-graphite.git",
55
"author": "Daniel Werdermann",
66
"license": "Apache-2.0",
@@ -64,6 +64,5 @@
6464
"name": "puppet",
6565
"version_requirement": ">= 3.0.0 < 5.0.0"
6666
}
67-
],
68-
"description": "Graphite module"
67+
]
6968
}

spec/classes/config_spec.rb

Lines changed: 72 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,6 @@
22

33
describe 'graphite::config', :type => 'class' do
44

5-
shared_context 'Unsupported OS' do
6-
it { is_expected.to raise_error(Puppet::Error,/unsupported os,.+\./ )}
7-
end
8-
9-
shared_context 'Debian unsupported platforms' do
10-
it { is_expected.to raise_error(Puppet::Error,/Unsupported Debian release/) }
11-
end
12-
13-
shared_context 'RedHat unsupported platforms' do
14-
it { is_expected.to raise_error(Puppet::Error,/Unsupported RedHat release/) }
15-
end
16-
17-
shared_context 'supported platforms' do
18-
it { is_expected.to contain_class('graphite::params') }
19-
it { is_expected.to contain_exec('Initial django db creation') }
20-
it { is_expected.to contain_class('graphite::config_apache') }
21-
22-
# cron check
23-
it { is_expected.to contain_file('/opt/graphite/bin/carbon-logrotate.sh').with({
24-
'ensure' => 'file', 'mode' => '0544', 'content' => /^CARBON_LOGS_PATH="\/opt\/graphite\/storage\/log"$/ }) }
25-
it { is_expected.to contain_cron('Rotate carbon logs').with({
26-
'command' => '/opt/graphite/bin/carbon-logrotate.sh',
27-
'hour' => '3',
28-
'minute' => '15',
29-
'require' => 'File[/opt/graphite/bin/carbon-logrotate.sh]',
30-
'user' => 'root',}) }
31-
end
32-
335
shared_context 'RedHat supported platforms' do
346
it { is_expected.to contain_file('/opt/graphite/storage/whisper').with({
357
'ensure' => 'directory', 'owner' => 'apache', 'group' => 'apache', 'mode' => '0755', }) }
@@ -44,13 +16,32 @@
4416
'ensure' => 'file', 'owner' => 'apache', 'group' => 'apache', 'mode' => '0644' }).that_requires('Package[httpd]') }
4517
it { is_expected.to contain_file('/opt/graphite/webapp/graphite/graphite_wsgi.py').with({
4618
'ensure' => 'link', 'target' => '/opt/graphite/conf/graphite_wsgi.py', 'require' => 'File[/opt/graphite/conf/graphite_wsgi.py]' }) }
19+
it { is_expected.to contain_service('carbon-cache').with({
20+
'ensure' => 'running',
21+
'enable' => 'true',
22+
'hasrestart' => 'true',
23+
'hasstatus' => 'true',
24+
'provider' => 'redhat',
25+
'require' => 'File[/etc/init.d/carbon-cache]' }) }
4726
end
4827

4928
shared_context 'RedHat 6 platforms' do
29+
it { is_expected.to contain_file('/etc/init.d/carbon-cache').with({
30+
'ensure' => 'file',
31+
'content' => /^GRAPHITE_DIR="\/opt\/graphite"$/,
32+
'mode' => '0750',
33+
'require' => 'File[/opt/graphite/conf/carbon.conf]',
34+
'notify' => [] }) }
5035
end
5136

5237
shared_context 'RedHat 7 platforms' do
5338
it { is_expected.to contain_exec('graphite-reload-systemd') }
39+
it { is_expected.to contain_file('/etc/init.d/carbon-cache').with({
40+
'ensure' => 'file',
41+
'content' => /^GRAPHITE_DIR="\/opt\/graphite"$/,
42+
'mode' => '0750',
43+
'require' => 'File[/opt/graphite/conf/carbon.conf]',
44+
'notify' => /graphite-reload-systemd/ }) }
5445
end
5546

5647
shared_context 'Debian supported platforms' do
@@ -67,50 +58,69 @@
6758
'ensure' => 'file', 'owner' => 'www-data', 'group' => 'www-data', 'mode' => '0644' }).that_requires('Package[apache2]') }
6859
it { is_expected.to contain_file('/opt/graphite/webapp/graphite/graphite_wsgi.py').with({
6960
'ensure' => 'link', 'target' => '/opt/graphite/conf/graphite_wsgi.py', 'require' => 'File[/opt/graphite/conf/graphite_wsgi.py]' }) }
61+
it { is_expected.to contain_service('carbon-cache').only_with({
62+
'ensure' => 'running',
63+
'enable' => 'true',
64+
'hasrestart' => 'true',
65+
'hasstatus' => 'true',
66+
'provider' => nil,
67+
'require' => 'File[/etc/init.d/carbon-cache]' }) }
68+
it { is_expected.to contain_file('/etc/init.d/carbon-cache').with({
69+
'ensure' => 'file',
70+
'content' => /^GRAPHITE_DIR="\/opt\/graphite"$/,
71+
'mode' => '0750',
72+
'require' => 'File[/opt/graphite/conf/carbon.conf]',
73+
'notify' => [] }) }
74+
end
75+
76+
77+
context 'Unsupported OS' do
78+
let(:facts) {{ :osfamily => 'unsupported', :operatingsystem => 'UnknownOS' }}
79+
it { is_expected.to raise_error(Puppet::Error,/unsupported os,.+\./ )}
7080
end
7181

72-
# Loop through various contexts
73-
[ { :osfamily => 'Debian', :lsbdistcodename => 'capybara', :operatingsystem => 'Debian' },
74-
{ :osfamily => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystem => 'Debian' },
75-
{ :osfamily => 'Debian', :lsbdistcodename => 'trusty', :operatingsystem => 'Debian' },
76-
{ :osfamily => 'FreeBSD', :operatingsystemrelease => '8.4-RELEASE-p27', :operatingsystem => 'FreeBSD' },
77-
{ :osfamily => 'RedHat', :operatingsystemrelease => '5.0', :operatingsystem => 'CentOS' },
78-
{ :osfamily => 'RedHat', :operatingsystemrelease => '6.6', :operatingsystem => 'CentOS' },
79-
{ :osfamily => 'RedHat', :operatingsystemrelease => '7.1', :operatingsystem => 'CentOS' },
80-
].each do |myfacts|
82+
on_supported_os.each do |os, facts|
83+
context "on #{os}" do
84+
let(:facts) do
85+
facts
86+
end
87+
let :pre_condition do
88+
'include ::graphite'
89+
end
90+
91+
it { is_expected.to compile.with_all_deps }
92+
it { is_expected.to contain_class('graphite::params') }
93+
it { is_expected.to contain_exec('Initial django db creation') }
94+
it { is_expected.to contain_class('graphite::config_apache') }
8195

82-
context 'OS %s %s' % myfacts.values do
83-
let :facts do myfacts end
84-
let :pre_condition do 'include ::graphite' end
96+
# cron check
97+
it { is_expected.to contain_file('/opt/graphite/bin/carbon-logrotate.sh').with({
98+
'ensure' => 'file', 'mode' => '0544', 'content' => /^CARBON_LOGS_PATH="\/opt\/graphite\/storage\/log"$/ }) }
99+
it { is_expected.to contain_cron('Rotate carbon logs').with({
100+
'command' => '/opt/graphite/bin/carbon-logrotate.sh',
101+
'hour' => '3',
102+
'minute' => '15',
103+
'require' => 'File[/opt/graphite/bin/carbon-logrotate.sh]',
104+
'user' => 'root',}) }
85105

86-
case myfacts[:osfamily]
106+
case facts[:osfamily]
87107
when 'Debian' then
88-
case myfacts[:lsbdistcodename]
89-
when 'capybara' then
90-
it_behaves_like 'Debian unsupported platforms'
91-
else
92-
it_behaves_like 'supported platforms'
93-
it_behaves_like 'Debian supported platforms'
94-
95-
end
108+
it_behaves_like 'Debian supported platforms'
96109
when 'RedHat' then
97-
case myfacts[:operatingsystemrelease]
98-
when /^[6-7]/ then
99-
it_behaves_like 'supported platforms'
100-
it_behaves_like 'RedHat supported platforms'
101-
case myfacts[:operatingsystemrelease]
102-
when /^6/ then
103-
it_behaves_like 'RedHat 6 platforms'
104-
when /^7/ then
105-
it_behaves_like 'RedHat 7 platforms'
106-
end
107-
110+
it_behaves_like 'RedHat supported platforms'
111+
case facts[:operatingsystemrelease]
112+
when /^6/ then
113+
it_behaves_like 'RedHat 6 platforms'
114+
when /^7/ then
115+
it_behaves_like 'RedHat 7 platforms'
108116
else
109-
it_behaves_like 'RedHat unsupported platforms'
117+
it { is_expected.to raise_error(Puppet::Error,/unsupported os,.+\./ )}
110118
end
111119
else
112-
it_behaves_like 'Unsupported OS'
120+
it { is_expected.to raise_error(Puppet::Error,/unsupported os,.+\./ )}
113121
end
122+
114123
end
115124
end
125+
116126
end

spec/classes/graphite_spec.rb

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,23 @@
22

33
describe 'graphite', :type => 'class' do
44

5-
shared_context 'supported' do
6-
it { is_expected.to contain_anchor('graphite::begin').that_comes_before(
7-
'Class[graphite::install]') }
8-
it { is_expected.to contain_class('graphite::install').that_notifies(
9-
'Class[graphite::config]') }
10-
it { is_expected.to contain_class('graphite::config').that_comes_before(
11-
'Anchor[graphite::end]') }
12-
it { is_expected.to contain_anchor('graphite::end') }
13-
end
14-
155
context 'Unsupported OS' do
166
let(:facts) {{ :osfamily => 'unsupported', :operatingsystem => 'UnknownOS' }}
177
it { is_expected.to raise_error(Puppet::Error,/unsupported os,.+\./ )}
188
end
199

20-
context 'RedHat supported platforms' do
21-
['6.5','7.5'].each do | operatingsystemrelease |
22-
let(:facts) {{ :osfamily => 'RedHat', :operatingsystemrelease => operatingsystemrelease}}
23-
describe "Release #{operatingsystemrelease}" do
24-
it_behaves_like 'supported'
10+
on_supported_os.each do |os, facts|
11+
context "on #{os}" do
12+
let(:facts) do
13+
facts
2514
end
26-
end
27-
end
15+
16+
it { is_expected.to compile.with_all_deps }
17+
it { is_expected.to contain_anchor('graphite::begin').that_comes_before('Class[graphite::install]') }
18+
it { is_expected.to contain_class('graphite::install').that_notifies('Class[graphite::config]') }
19+
it { is_expected.to contain_class('graphite::config').that_comes_before('Anchor[graphite::end]') }
20+
it { is_expected.to contain_anchor('graphite::end') }
2821

29-
context 'RedHat unsupported platforms' do
30-
['5.0'].each do | operatingsystemrelease |
31-
let(:facts) {{ :osfamily => 'RedHat', :operatingsystemrelease => operatingsystemrelease}}
32-
describe "Redhat #{operatingsystemrelease} fails" do
33-
it { expect { is_expected.to contain_class('graphite')}.to raise_error(Puppet::Error, /Unsupported RedHat release/) }
34-
end
35-
end
36-
end
37-
38-
context 'Debian supported platforms' do
39-
['trusty','squeeze', 'vivid', 'precise'].each do | lsbdistcodename |
40-
let(:facts) {{ :osfamily => 'Debian', :lsbdistcodename => lsbdistcodename}}
41-
describe "Lsbdistcodename #{lsbdistcodename}" do
42-
it_behaves_like 'supported'
43-
end
44-
end
45-
end
46-
47-
context 'Debian unsupported platforms' do
48-
['capybara'].each do | lsbdistcodename |
49-
let(:facts) {{ :osfamily => 'Debian', :lsbdistcodename => lsbdistcodename}}
50-
describe "Debian #{lsbdistcodename} fails" do
51-
it { expect { is_expected.to contain_class('graphite')}.to raise_error(Puppet::Error, /Unsupported Debian release/) }
52-
end
5322
end
5423
end
5524

spec/spec_helper.rb

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
if ENV['COVERAGE'] == 'yes'
2-
require 'simplecov'
3-
require 'coveralls'
4-
5-
SimpleCov.formatters = [
6-
SimpleCov::Formatter::HTMLFormatter,
7-
Coveralls::SimpleCov::Formatter
8-
]
9-
10-
#Coveralls.wear!
11-
SimpleCov.start do
12-
add_filter '/spec/'
13-
add_filter '/.vendor/'
14-
end
15-
end
16-
17-
RSpec.configure do |c|
18-
c.after(:suite) do
19-
RSpec::Puppet::Coverage.report!
2+
RSpec.configure do |c|
3+
c.after(:suite) do
4+
RSpec::Puppet::Coverage.report!
5+
end
206
end
217
end
228

239
require 'puppetlabs_spec_helper/module_spec_helper'
10+
require 'rspec-puppet-facts'
11+
include RspecPuppetFacts

0 commit comments

Comments
 (0)