cookbook 'summary_handlers', '~> 0.3.0'
summary_handlers (3) Versions 0.3.0 Follow0
Installs/Configures some handlers that summerise the Chef run in terms of Resource and Recipe
cookbook 'summary_handlers', '~> 0.3.0', :supermarket
knife supermarket install summary_handlers
knife supermarket download summary_handlers
summary-handlers Cookbook
This cookbook includes three report handlers.
Cookbook Summary
The cookbook summary is a list of cookbooks that have been pulled down as part of the run list (or dependencies).
Recipe Summary
The recipe summary is designed for situations for helping to see if a community cookbook has been added as a dependency but no longer required as it lists all recipes and marks those that have not been loaded.
Resource Summary
The resource summary is for larger cookbooks with a lot of resources to summerise the resources that have been loaded into the resource queue. The report has two modes, output the resources grouped by type or by cookbook recipe.
There are two sorting options
* By Type; the output is resource type followed by recipe name
* By Cookbook; the output is recipe name followed by resources
The overall intention of the summary handlers is for development time using Test Kitchen, not production but it could be added as part of a regular run list.
Output is using puts rather than Chef::Log, if you fork and change the code to use Chef::Log and there is no output check your Log level!
If the cookbook proves to be popular I will distribute the core as a gem to make it even easier to install and use!
Requirements
- ChefDK, can be found here https://downloads.chef.io/chef-dk/
- Vagrant
- Virtual Box
- Windows/Linux box file
- Cookbook to add the summary handlers to
Tested with ChefDK 0.62
Attributes
summary-handlers::default
Key | Type | Description | Default |
---|---|---|---|
['summary-handlers']['cookbook-summary-report'] |
boolean | If default recipe called add cookbook-summary | true |
['summary-handlers']['recipe-summary-report'] |
boolean | If default recipe called add recipe-summary | true |
['summary-handlers']['resource-summary-report'] |
boolean | If default recipe called add resource-summary | true |
summary-handlers::resource_summary
NB: Key is abbreviated, the key path starts with ['summary-handlers']['resource-summary']
Simple add below for full attribute name, i.e ['summary-handlers']['resource-summary']['report_type']
Key | Type | Description | Default |
---|---|---|---|
['report_type'] |
Symbol | :by_cookbook or :by_type | :by_cookbook |
['report_format'] |
Symbol | :template, :json or :yaml | :template |
['updated_only'] |
boolean | Show only updated resources | false |
['user_filter'] |
Proc | Proc for user filter | nil |
The user_filter will allow you to filter resource summary to just the resources you are interested in, the filter can be any valid resouce property.
Example setting for
default['summary-handlers']['resource-summary']['user_filter'] = proc {|resource| resource.method == user_criteria}
This setting will need to be done in your wrapper cookbook attributes or recipe file as it requires Ruby proc.
Usage
If using Test Kitchen and Berkshelf then add to your Berksfile, summary_handlers is available on Git or Public Chef Supermarket.
Git
cookbook 'summary_handlers', git: 'https://github.com/chrisgit/chef-summary_handlers'
Public Supermarket
````
source 'https://supermarket.chef.io'
metadata
cookbook 'summary_handlers'
````
Change you test suite run list to include summary handlers (.kitchen.yml or .kitchen.local.yml)
suites:
- name: default
run_list: ["recipe[summary_handlers]","recipe[my_cookbook]"]
attributes: { ... }
Use the attributes section of the test suite to get the desired behavior.
Alternatively, you can add this cookbook as a dependency in your cookbook, to do that update your cookbooks metadata file
depends 'summary_handlers'
Then add an include_recipe in default.rb (or one of the recipes used by your cookbook)
include_recipe 'summary_handlers
Contributing
Please see CONTRIBUTING.md and read the CODE_OF_CONDUCT.md
License and Authors
Please see LICENSE
Authors: Chris Sullivan
Dependent cookbooks
chef_handler >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
summary-handlers CHANGELOG
This file is used to list changes made in each version of the summary-handlers cookbook.
0.3.0
- [Chris Sullivan] - Updated due to https://blog.chef.io/2017/04/19/find-better-cookbooks-supermarket/ Added a sub cookbooks for test / example output.
0.2.6
- [Chris Sullivan] - Applied Rubocop rules to code
0.2.6
- [Chris Sullivan] - Re-added unit tests
0.2.5
- [Chris Sullivan] - Fix FC064 and FC065
0.2.4
- [Chris Sullivan] - Remove Berksfile.lock
0.2.3
- [Chris Sullivan] - Added updated only option for resource summary, refactored
0.2.2
- [Chris Sullivan] - Cookbook report and refactoring of Recipe Summary
0.2.1
- [Chris Sullivan] - Slight change in format of reports
0.2.0
- [Chris Sullivan] - Simplify code and change format of reports
0.1.0
- [Chris Sullivan] - Initial release of summary-handlers
Check the Markdown Syntax Guide for help with Markdown.
The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.
Collaborator Number Metric
0.3.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.3.0 failed this metric
FC121: Cookbook depends on cookbook made obsolete by Chef 14: summary_handlers/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.3.0 passed this metric
Testing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.3.0 failed this metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.3.0 failed this metric
FC121: Cookbook depends on cookbook made obsolete by Chef 14: summary_handlers/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.3.0 passed this metric
Testing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.3.0 failed this metric
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.3.0 passed this metric
Testing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.3.0 failed this metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number