Skip to content

Commit

Permalink
Fix testing, fix graphite plugin recipe bugs, cleanup (+12 squashed c…
Browse files Browse the repository at this point in the history
…ommits)

Squashed commits:
[10a37f9] Cleaner attribute listing
[269f9e7] Moving the plugin packages out of attributes and into recipe

Easier to test this part of the recipe if implemented this way. Chefspec/rspec was having a hard time rendering what packages were needed for the install, this took out the abstraction and allowed rspec to just work..
[992224f] Lacking consistency
[ac9ce9d] Adding explicit action for rspec testing
[ddb614e] Adding rspec documentation and color output

Make it much easier to parse the test output to see what is going wrong and where.
[442968c] Adding supported platforms definition to call in tests

Saw this implementation method in the apache2 cookbook, very useful to quickly add testing for all your supported platforms. See default_spec test for a test implementation example
[28ae93e] Lacking consistency
[19dcff6] Completely reworked, added more tests as well
[ec58006] Adding new spec test for the graphite plugin recipe
[8986ec7] This test never really worked right, removed
[9245fa9] Condense tests, adding testing for the graphite plugin

Includes test for the files being pulled down for the plugin, content of files and the cronjob being added
[dbee4c0] CHANGELOG Update/Cleanup

 * Standardize markdown formatting current and past entries
 * Add new content related to release 3.0.3
  • Loading branch information
GitBytes committed May 17, 2016
1 parent 4974fe3 commit 9fbcdfd
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 210 deletions.
2 changes: 0 additions & 2 deletions .rspec

This file was deleted.

140 changes: 77 additions & 63 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,100 +3,114 @@ CHANGELOG
Chef-Bareos Cookbook
--------------------

3.0.2
3.0.3
-----
- Ian Smith
#### Ian Smith
* Decided to change who owned all of the graphite_plugin bits
1. Bareos plugin still seems to have some debugging code that will not only PRINT your password to the command line if done by hand, but will also EMAIL your main director password to whatever account owns, say, a cronjob (i.e. root). Seems like a security flaw? I submitted bugfix bareos/bareos-contrib/#14 to address this issue, waiting for merge. If you need an immediate fixed source, use my GitBytes/bareos-contrib fork. Sorry about that..
1. Pretty much wherever root was, I changed to bareos in the plugin recipe.
* Cleanup README and CHANGELOG raw syntax for GitHub and Supermarket rendering
* Add new chefspec/rspec unit tests, cleanup existing tests
1. Removed unused `.rspec` config file
1. Removed `repo_spec` test, never quite worked right
1. Added `:documentation` and `color` output to chefspec/rspec testing
1. Added `graphite_plugin_spec` test
1. Condensed and cleaned up `default_spec` test, tests both the `repo` and `client` recipes on top of the implied `default` recipe
1. Added ability to easily run tests against a variety of preset supported platforms via `spec/unit/support/supported_platforms` definition file (see `default_spec` test for example usage)
* Add new/optimize serverspec integration tests
1. Condense tests for overall functionality of Bareos
1. New graphite plugin testing: plugin, config, cronjob
* Bump patch version to `3.0.3` (tag v3.0.3)

- Complete re-work of cookbook, which includes the rework bits from version 2.0
- Adding various features including:
* Templates populated from hash tables
* Up to date README
* Graphite plugin deployment recipe
* Migrate to postgresql cookbook version 4+
* Better testing (rspec), testing against current ruby, need some more rspec tests but no time
* Various other updates and enhancements, see README for details
* Supermarket Release...finally
- ***NOTE*** This release adds functionality that is not backwards compatible. Version lock until you have time to test the migration to version 3.0+
3.0.2
-----
#### Ian Smith

* Complete re-work of cookbook, which includes the rework bits from version 2.0
* Adding various features including:
* Templates populated from hash tables
* Up to date README
* Graphite plugin deployment recipe
* Migrate to postgresql cookbook version 4+
* Better testing (rspec), testing against current ruby, need some more rspec tests but no time
* Various other updates and enhancements, see README for details
* Supermarket Release...finally
* ***NOTE*** This release adds functionality that is not backwards compatible. Version lock until you have time to test the migration to version 3.0+

2.2.13
------
- Ian Smith

- Near complete refactoring of how the cookbook works
#### Ian Smith
* Near complete refactoring of how the cookbook works
* Adding various ways to add configs based on hashes. Examples in attributes/default.rb
- Updating README for usage details
- If you are not prepared to use this cookbook version, please lock cookbook version to < 2.0.0
- TODO: Refactor main bareos-dir/sd/fd configs to be fully based on hashes like other configs
* Updating README for usage details
* If you are not prepared to use this cookbook version, please lock cookbook version to < 2.0.0
* TODO: Refactor main bareos-dir/sd/fd configs to be fully based on hashes like other configs
* Remaining attributes support primary bareos-dir/sd/fd configs mostly, used elsewhere but not much

1.0.4
-----
- Ian Smith

- Updating and validating Kitchen testing with new methods
- Adding ability to use custom Storage Daemon Configs via wrapper recipe
- Fixed a race condition that was likely to come up both in testing and production
#### Ian Smith
* Updating and validating Kitchen testing with new methods
* Adding ability to use custom Storage Daemon Configs via wrapper recipe
* Fixed a race condition that was likely to come up both in testing and production
* Was missing client config on fresh install so restart of dir would fail
- Limiting cookbook support for debian to ~>7.0 until we can test on 8+
- Refined storage recipe to correctly create client configs based on BOTH role search and solo instances, may need a bit more tuning but should work in most cases
- Creating basic Full, Inc, and Diff pools even if not used, just as a place holder (default)
- Minor fixes
- Larger version bump for version clarity
- Updated Docs
- Adding support for Fedora and RHEL 6/7
- Reworked the available repos to some better logic
* Limiting cookbook support for debian to ~>7.0 until we can test on 8+
* Refined storage recipe to correctly create client configs based on BOTH role search and solo instances, may need a bit more tuning but should work in most cases
* Creating basic Full, Inc, and Diff pools even if not used, just as a place holder (default)
* Minor fixes
* Larger version bump for version clarity
* Updated Docs
* Adding support for Fedora and RHEL 6/7
* Reworked the available repos to some better logic

0.1.4
-----
- Ian Smith

- Updating README
- Revamping server.rb recipe to better utilize the bareos-dir.d directory
#### Ian Smith
* Updating README
* Revamping server.rb recipe to better utilize the bareos-dir.d directory
* Moving ALL host config files to the bareos-dir.d/hosts/ directory
* Revamping director config and moving host bits to seperate host.conf.erb template
* Revamping director config and moving host bits to separate host.conf.erb template
* Adding feature for host based custom pools based on true/false attribute
* Adding ability to fill in a block for virtual-full backup logic (not complete yet)
- Revamping storage.rb and storage template to what I am thinking was meant to happen originally
- Adding new kitchen suite and tests to verify host pools work
- Bugfixes
- Updating Kitchen Tests and ChefSpec Configs to match for verifying
* Revamping storage.rb and storage template to what I am thinking was meant to happen originally
* Adding new kitchen suite and tests to verify host pools work
* Bugfixes
* Updating Kitchen Tests and ChefSpec Configs to match for verifying
* Addressing race condition in ChefSpec tests where debian was taking
longer than expected to start the director

0.1.3
-----
- Ian Smith

- Updating README
- Updating CHANGELOG
- Updating metadata file
#### Ian Smith
* Updating README
* Updating CHANGELOG
* Updating metadata file

0.1.2
-----
- Leonard TAVAE

- The License has changed (Apache 2.0)
- The cookbook now passed foodcritic, rubocop and tailor with success
- Some minor bugs fix

- Ian Smith

- Updating Cookbook to use ChefDK >0.6.0
- Updating Docs
- Updating Postgresql Logic/Commands
- Updating a couple of template bits for the director
#### Leonard TAVAE
* The License has changed (Apache 2.0)
* The cookbook now passed foodcritic, rubocop and tailor with success
* Some minor bugs fix

#### Ian Smith
* Updating Cookbook to use ChefDK >0.6.0
* Updating Docs
* Updating Postgresql Logic/Commands
* Updating a couple of template bits for the director
* Adding new attributes, working on more for future implementation
- Updating Kitchen suites/platforms/provisioner
* Updating Kitchen suites/platforms/provisioner
* Adding some test roles for tests
- Updating chefspec/rspec/serverspec testing
- Updating TravisCI testing parameters so they are more standard
* Updating chefspec/rspec/serverspec testing
* Updating TravisCI testing parameters so they are more standard

0.1.1
-----
- Leonard TAVAE - Major release
#### Leonard TAVAE
* Major release

0.1.0
-----
- Leonard TAVAE - Initial release of bareos

#### Leonard TAVAE
* Initial release of bareos
- - -
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,13 @@ A new plugin that will send statistics to a graphite server which can then be us

| Attribute | Default Value | Description
|------------------|---------------|------------
| ['bareos']['plugins']['graphite']['packages'] | varies on platform | Default packages needed to get the plugin to work
| ['bareos']['plugins']['graphite']['plugin_path'] | '/usr/sbin' | Default location for the plugin that runs in a defined cron job
| ['bareos']['plugins']['graphite']['config_path'] | '/etc/bareos' | Default directory for the plugin config
| ['bareos']['plugins']['graphite']['search_query'] | 'roles:bareos_director' | Default search string to populate the director name
| ['bareos']['plugins']['graphite']['server'] | 'graphite' | Placeholder string for the graphite server DNS name
| ['bareos']['plugins']['graphite']['graphite_port'] | '2003' | Default graphite communication port
| ['bareos']['plugins']['graphite']['graphite_data_prefix'] | 'bareos.' | Default prefix for graphite data
| ['bareos']['plugins']['graphite']['graphite_plugin_src_url'] | 'https://raw.githubusercontent.com/bareos/bareos-contrib/master/misc/performance/graphite/bareos-graphite-poller.py' | Default URL to the plugin
| ['bareos']['plugins']['graphite']['graphite_plugin_src_url'] | See attributes file | Default URL to the plugin

## Recipes

Expand Down
8 changes: 1 addition & 7 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,14 @@
default['bareos']['workstation']['name'] = node['fqdn']

# Graphite Plugin Default Attributes
default['bareos']['plugins']['graphite']['packages'] = if platform_family?('rhel') && node['platform_version'].to_i == 6
%w(python python-bareos python-requests python-fedora-django)
else
%w(python python-bareos python-requests python-django)
end

default['bareos']['plugins']['graphite']['plugin_path'] = '/usr/sbin'
default['bareos']['plugins']['graphite']['config_path'] = '/etc/bareos'
default['bareos']['plugins']['graphite']['search_query'] = 'roles:bareos_director'
default['bareos']['plugins']['graphite']['server'] = 'graphite'
default['bareos']['plugins']['graphite']['graphite_port'] = '2003'
default['bareos']['plugins']['graphite']['graphite_data_prefix'] = 'bareos.'
default['bareos']['plugins']['graphite']['graphite_plugin_src_url'] = 'https://raw.githubusercontent.com/bareos/bareos-contrib/master/misc/performance/graphite/bareos-graphite-poller.py'
defualt['bareos']['plugins']['graphite']['mailto'] = 'bareos'
default['bareos']['plugins']['graphite']['mail_to'] = 'bareos'

##############################
# Examples - Default Hashes #
Expand Down
8 changes: 5 additions & 3 deletions recipes/graphite_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

include_recipe 'chef-bareos::repo'

node['bareos']['plugins']['graphite']['packages'].each do |py_pkg|
package py_pkg
if platform_family?('rhel') && node['platform_version'].to_i == 6
package ['python', 'python-bareos', 'python-requests', 'python-fedora-django']
else
package ['python', 'python-bareos', 'python-requests', 'python-django']
end

directory node['bareos']['plugins']['graphite']['config_path']
Expand All @@ -45,7 +47,7 @@
#{node['bareos']['plugins']['graphite']['plugin_path']}/bareos-graphite-poller.py\
-c #{node['bareos']['plugins']['graphite']['config_path']}/graphite-poller.conf
EOH
mailto node['bareos']['plugins']['mailto']
mailto node['bareos']['plugins']['graphite']['mail_to']
user 'bareos'
minute '5'
end
2 changes: 2 additions & 0 deletions recipes/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@
components ['/']
distribution ''
key node['bareos']['gpgkey']
action :add
end
apt_repository 'bareos_contrib' do
uri node['bareos']['contrib_baseurl']
components ['/']
distribution ''
key node['bareos']['contrib_gpgkey']
action :add
end
else
Chef::Log.fatal('OS is not currently supported by this cookbook, submit enhancement request or PR')
Expand Down
7 changes: 7 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
require 'chefspec'
require 'chefspec/berkshelf'

Dir['./spec/support/**/*.rb'].sort.each { |f| require f }

RSpec.configure do |config|
config.formatter = :documentation
config.color = true
end

at_exit { ChefSpec::Coverage.report! }
7 changes: 7 additions & 0 deletions spec/support/supported_platforms.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def supported_platforms
_platforms = {
'ubuntu' => ['14.04'],
'redhat' => ['6.6', '7.1'],
'centos' => ['6.7', '7.2.1511']
}
end
Loading

0 comments on commit 9fbcdfd

Please sign in to comment.