Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

compat_resource (55) Versions 12.5.21

Backports functionality introduced in the latest chef-client releases to any chef-client from 12.1 onwards

Berkshelf/Librarian
Policyfile
Knife
cookbook 'compat_resource', '= 12.5.21'
cookbook 'compat_resource', '= 12.5.21', :supermarket
knife cookbook site install compat_resource
knife cookbook site download compat_resource
README
Dependencies
Changelog
Quality 100%

compat_resource cookbook

Build Status Cookbook Version

This cookbook brings the custom resource syntax from Chef 12.5 to earlier Chef 12.X releases.

Converting cookbooks from the old resource model to the new

Boilerplate

  1. Depend on compat_resource
    • Descend resources from ChefCompat::Resource
    • Set resource_name in the class instead of the constructor
  2. Convert Attributes to Properties
    • Rename attribute -> property
    • Move set_or_return -> property
    • Take kind_of/equal_to/regexes and make them types
    • Use true/false/nil instead of TrueClass/FalseClass/NilClass
    • Remove default: nil (it's the default)
  3. Convert Top-Level Providers to Actions
    • Create any resources that don't already exist (for example in multi-provider cases) and descend from the base resource
    • Remove allowed_actions / @actions
    • @action -> default_action
    • Move provides and action :x to the resource
    • Remove use_inline_resources and def whyrun_safe?
    • Move other methods to action_class.class_eval do

Now you have everything in a resource, are using properties, and have gotten rid of a bunch of boilerplate. Of course, this is just getting it moved. Now you can start to really use the new features. And if you're making resources for the first time, congrats--you probably didn't have to do very much of this :)

Advanced Concepts

  1. Resource Inheritance
  2. Resources That Are Different On Each OS?
  3. Coercion: Handling User Input
  4. Lazy Defaults
  5. Using Load Current Resource
  6. Using Converge If Changed
  7. Defaults Are For Creation
  8. Shared types: using a type multiple places

Requirements

Platforms

  • All platforms supported by Chef

Chef

  • Chef 12.0+

Cookbooks

  • none

Usage

To use this cookbook, put depends 'compat_resource' in the metadata.rb of your cookbook. Once this is done, you can use all the new custom resource features to define resources. It Just Works.

For example, if you create resources/myresource.rb, myresource can use property, load_current_value and action (no need to create a provider). If you want to create Resource classes directly, extend from ChefCompat::Resource instead of Chef::Resource. Properties, current value loading, converge_if_changed, and resource_name will all function the same across versions.

Custom Resources?

Curious about how to use custom resources? Here are the 12.5 docs:

License & Authors

Author: John Keiser (jkeiser@chef.io)

Copyright: 2015, Chef Software, Inc. ``` Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

acme Applicable Versions
activemq Applicable Versions
apparmor Applicable Versions
apt Applicable Versions
audit Applicable Versions
autofs Applicable Versions
backslasher-python Applicable Versions
bar Applicable Versions
baragon Applicable Versions
build-essential Applicable Versions
cerner_tomcat Applicable Versions
chef-apt-docker Applicable Versions
chef-ingredient Applicable Versions
chef-vault Applicable Versions
chef-yum-docker Applicable Versions
chef_client_updater Applicable Versions
chef_hostname Applicable Versions
chef_nginx Applicable Versions
chef_slack Applicable Versions
cloudpassage Applicable Versions
couchdb Applicable Versions
cron Applicable Versions
djbdns Applicable Versions
docker Applicable Versions
docker 2.0.0
docker 2.0.1
docker 2.0.2
docker 2.0.3
docker 2.0.4
docker 2.1.0
docker 2.1.1
docker 2.1.2
docker 2.1.3
docker 2.1.4
docker 2.1.5
docker 2.1.6
docker 2.1.7
docker 2.1.8
docker 2.1.9
docker 2.1.10
docker 2.1.11
docker 2.1.12
docker 2.1.13
docker 2.1.14
docker 2.1.15
docker 2.1.16
docker 2.1.17
docker 2.1.18
docker 2.1.19
docker 2.1.20
docker 2.1.21
docker 2.1.22
docker 2.1.23
docker 2.2.0
docker 2.2.1
docker 2.2.2
docker 2.2.3
docker 2.2.4
docker 2.2.5
docker 2.2.6
docker 2.2.7
docker 2.2.8
docker 2.2.9
docker 2.2.10
docker 2.2.11
docker 2.3.0
docker 2.3.1
docker 2.3.2
docker 2.3.3
docker 2.3.4
docker 2.3.5
docker 2.3.6
docker 2.3.7
docker 2.3.8
docker 2.3.9
docker 2.3.10
docker 2.3.11
docker 2.3.12
docker 2.3.13
docker 2.3.14
docker 2.3.15
docker 2.3.16
docker 2.3.17
docker 2.3.18
docker 2.3.19
docker 2.3.20
docker 2.3.21
docker 2.3.22
docker 2.3.23
docker 2.4.0
docker 2.4.1
docker 2.4.2
docker 2.4.3
docker 2.4.4
docker 2.4.5
docker 2.4.6
docker 2.4.7
docker 2.4.8
docker 2.4.9
docker 2.4.10
docker 2.4.11
docker 2.4.12
docker 2.4.13
docker 2.4.14
docker 2.4.15
docker 2.4.16
docker 2.4.17
docker 2.4.18
docker 2.4.19
docker 2.4.20
docker 2.4.21
docker 2.4.22
docker 2.4.23
docker 2.4.24
docker 2.4.25
docker 2.4.26
docker 2.5.0
docker 2.5.1
docker 2.5.2
docker 2.5.3
docker 2.5.4
docker 2.5.5
docker 2.5.6
docker 2.5.7
docker 2.5.8
docker 2.6.0
docker 2.6.1
docker 2.6.2
docker 2.6.3
docker 2.6.4
docker 2.6.5
docker 2.6.6
docker 2.6.7
docker 2.6.8
docker 2.7.0
docker 2.7.1
docker 2.8.0
docker 2.9.0
docker 2.9.1
docker 2.9.2
docker 2.9.3
docker 2.9.4
docker 2.9.5
docker 2.9.6
docker 2.9.7
docker 2.9.8
docker 2.9.9
docker 2.9.10
docker 2.11.0
docker 2.11.1
docker 2.12.0
docker 2.13.0
docker 2.13.1
docker 2.13.2
docker 2.13.3
docker 2.13.4
docker 2.13.5
docker 2.13.6
docker 2.13.7
docker 2.13.8
docker 2.13.9
docker 2.13.10
docker 2.13.11
docker 2.14.0
docker 2.14.1
docker 2.14.2
docker 2.14.3
docker 2.14.4
docker-engine Applicable Versions
dsc_contrib Applicable Versions
elasticsearch-curator Applicable Versions
erlang Applicable Versions
etcd Applicable Versions
etcd-client Applicable Versions
exabgp Applicable Versions
flyway-cli Applicable Versions
forked_audit Applicable Versions
glassfish Applicable Versions
gluster Applicable Versions
haproxy Applicable Versions
hopsworks Applicable Versions
httpd Applicable Versions
iis-lb Applicable Versions
ilo Applicable Versions
influxdb Applicable Versions
iptables Applicable Versions
jenkins Applicable Versions
jumpcloud Applicable Versions
kibana5-gm Applicable Versions
languages Applicable Versions
logrotate Applicable Versions
memcached Applicable Versions
microsoft_azure Applicable Versions
mingw Applicable Versions
mule Applicable Versions
multipackage Applicable Versions
nginx Applicable Versions
nodejs Applicable Versions
nodesource Applicable Versions
nscd Applicable Versions
ohai Applicable Versions
oneview Applicable Versions
oracle-client Applicable Versions
os-hardening Applicable Versions
osquery Applicable Versions
overwatch Applicable Versions
postfixadmin Applicable Versions
postgresql Applicable Versions
push-jobs Applicable Versions
redhat_subscription_manager Applicable Versions
redis-omnibus Applicable Versions
reprepro Applicable Versions
rsyslog Applicable Versions
rubyzip Applicable Versions
s3_dir Applicable Versions
salt Applicable Versions
samba Applicable Versions
selinux_policy Applicable Versions
snort Applicable Versions
ssh_known_hosts Applicable Versions
stegosoc-windows Applicable Versions
supermarket-omnibus-cookbook Applicable Versions
systemd Applicable Versions
tomcat Applicable Versions
trusted_certificate Applicable Versions
weave Applicable Versions
weblogic Applicable Versions
yum-amazon Applicable Versions
yum-atomic Applicable Versions
yum-atrpms Applicable Versions
yum-centos Applicable Versions
yum-chef Applicable Versions
yum-elrepo Applicable Versions
yum-epel Applicable Versions
yum-erlang_solutions Applicable Versions
yum-fedora Applicable Versions
yum-ius Applicable Versions
yum-mysql-community Applicable Versions
yum-percona Applicable Versions
yum-pgdg Applicable Versions
yum-remi-chef Applicable Versions
yum-repoforge Applicable Versions

Foodcritic Metric
            

12.5.21 passed this metric