This repository was archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes that weren't properly merged - The `wsgi.py` link is no longer needed since one was made in `config.pp`. So that code is no longer necessary. This block wasn't merged in. - Removing subscription to `$local_settings_py_file`. It is not defined when `config_gunicorn.pp` is evaluated. As it turns out, it can be safely removed. * New variable means WorkingDirectory doesn't need /graphite on the end * Only run race condition fix after initial db creation It used to `exec` on every run, now it won't. * Only bump systemd on install * Add service provider definition for Debian-based OSs Debian 8 was not starting carbon-cache because it didn't know it had to reload the systemd definitions. So I coded in a params for it, like was done for redhat-based OSs. This allowed for simplified logic in `config.pp`. * Adding provider to gunicorn service Ubuntu 15.10 has some weird race condition or something, where the service would sometimes start and sometimes not. Explicitly specifying the service provider seems to have no such error. * Set RedHat service provider based on OS version Rather than blanketing everything with RedHat and using OS version checks, I have coded in what the `service_provider` should be. * Adding rspec for config_gunicorn and updating the others * Fix for float vs string problem
- Loading branch information
1 parent
2f1578a
commit 2b3364c
Showing
9 changed files
with
231 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,4 +91,4 @@ | |
|
||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
require 'spec_helper' | ||
|
||
describe 'graphite::config_gunicorn', :type => 'class' do | ||
|
||
shared_context 'all platforms' do | ||
it { is_expected.to compile.with_all_deps } | ||
it { is_expected.to contain_class('graphite::params') } | ||
end | ||
|
||
shared_context 'RedHat supported platforms' do | ||
it { is_expected.to contain_package('python-gunicorn').with({ :name => 'python-gunicorn', :ensure => 'installed' }) } | ||
end | ||
|
||
shared_context 'RedHat 6 platforms' do | ||
it { is_expected.to contain_file('/etc/init.d/gunicorn').with({ | ||
'ensure' => 'file', | ||
'mode' => '0755'}) } | ||
it { is_expected.to contain_service('gunicorn').with({ | ||
'ensure' => 'running', | ||
'enable' => 'true', | ||
'hasrestart' => 'true', | ||
'hasstatus' => 'false', | ||
'provider' => 'redhat'}). | ||
that_requires( | ||
['Package[python-gunicorn]', | ||
'File[/opt/graphite/conf/graphite_wsgi.py]', | ||
'File[/etc/init.d/gunicorn]']) } | ||
end | ||
|
||
shared_context 'RedHat 7 platforms' do | ||
it { is_expected.to contain_exec('gunicorn-reload-systemd') } | ||
it { is_expected.to contain_file('/etc/systemd/system/gunicorn.service').with({ | ||
'ensure' => 'file', | ||
'mode' => '0644'}).that_notifies('Exec[gunicorn-reload-systemd]') } | ||
it { is_expected.to contain_file('/etc/systemd/system/gunicorn.socket').with({ | ||
'ensure' => 'file', | ||
'mode' => '0755'}).that_notifies('Exec[gunicorn-reload-systemd]') } | ||
it { is_expected.to contain_file('/etc/tmpfiles.d/gunicorn.conf').with({ | ||
'ensure' => 'file', | ||
'mode' => '0644'}).that_notifies('Exec[gunicorn-reload-systemd]') } | ||
it { is_expected.to contain_service('gunicorn').with({ | ||
'ensure' => 'running', | ||
'enable' => 'true', | ||
'hasrestart' => 'true', | ||
'hasstatus' => 'false', | ||
'provider' => 'systemd'}). | ||
that_requires( | ||
['Package[python-gunicorn]', | ||
'Exec[gunicorn-reload-systemd]', | ||
'File[/opt/graphite/conf/graphite_wsgi.py]']) } | ||
end | ||
|
||
shared_context 'Debian supported platforms' do | ||
it { is_expected.to contain_package('gunicorn').with({ :name => 'gunicorn', :ensure => 'installed' }) } | ||
it { is_expected.to contain_file('/etc/gunicorn.d').with({ | ||
'ensure' => 'directory', | ||
'path' => '/etc/gunicorn.d'}) } | ||
it { is_expected.to contain_file('/etc/gunicorn.d/graphite').with({ | ||
'ensure' => 'file', | ||
'mode' => '0644', | ||
'before' => 'Package[gunicorn]' }).that_requires('File[/etc/gunicorn.d]') } | ||
it { is_expected.to contain_service('gunicorn').with({ | ||
'ensure' => 'running', | ||
'enable' => 'true', | ||
'hasrestart' => 'true', | ||
'hasstatus' => 'false'}). | ||
that_requires( | ||
['Package[gunicorn]', | ||
'File[/opt/graphite/conf/graphite_wsgi.py]']) } | ||
end | ||
|
||
#shared_context 'Debian sysv platforms' do | ||
#it { is_expected.to contain_service('gunicorn').with({ | ||
#'ensure' => 'running', | ||
#'enable' => 'true', | ||
#'hasrestart' => 'true', | ||
#'hasstatus' => 'false', | ||
#'provider' => 'debian'}). | ||
#that_requires( | ||
#['Package[gunicorn]', | ||
#'File[/opt/graphite/conf/graphite_wsgi.py']) } | ||
#end | ||
|
||
#shared_context 'Debian systemd platforms' do | ||
#it { is_expected.to contain_service('gunicorn').with({ | ||
#'ensure' => 'running', | ||
#'enable' => 'true', | ||
#'hasrestart' => 'true', | ||
#'hasstatus' => 'false', | ||
#'provider' => 'systemd'}). | ||
#that_requires( | ||
#['Package[gunicorn]', | ||
#'File[/opt/graphite/conf/graphite_wsgi.py']) } | ||
#end | ||
|
||
context 'Unsupported OS' do | ||
let(:facts) {{ :osfamily => 'unsupported', :operatingsystem => 'UnknownOS' }} | ||
it { is_expected.to raise_error(Puppet::Error, /unsupported os,.+\./ )} | ||
end | ||
|
||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
let :pre_condition do | ||
'class { ::graphite: gr_web_server => nginx }' | ||
end | ||
|
||
it_behaves_like 'all platforms' | ||
|
||
case facts[:osfamily] | ||
when 'Debian' then | ||
it_behaves_like 'Debian supported platforms' | ||
when 'RedHat' then | ||
it_behaves_like 'RedHat supported platforms' | ||
case facts[:operatingsystemrelease] | ||
when /^6/ then | ||
it_behaves_like 'RedHat 6 platforms' | ||
when /^7/ then | ||
it_behaves_like 'RedHat 7 platforms' | ||
else | ||
it { is_expected.to raise_error(Puppet::Error,/unsupported os,.+\./ )} | ||
end | ||
else | ||
it { is_expected.to raise_error(Puppet::Error, /unsupported os,.+\./ )} | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.