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


puppet_compat (6) Versions 1.1.1

HWRP for ini_setting and file_line resources

cookbook 'puppet_compat', '= 1.1.1'
cookbook 'puppet_compat', '= 1.1.1', :supermarket
knife supermarket install puppet_compat
knife supermarket download puppet_compat
Quality 88%

puppet_compat Cookbook

Build Status Cookbook Version

While doing migration from Puppet to Chef I can easily map all Puppet resources to the Chef ones. All except two: - file_line - ini_setting (pe_ini_setting)

These two just don't have a counterpart in the Chef world. This cookbook provides exactly these two resources as HWRP.


This cookbook need iniparse GEM to be installed.


  • Debian-family Linux Distributions
  • RedHat-family Linux Distributions
  • Fedora
  • openSUSE


  • Chef 12.1+
  • Chef 13+
  • Chef 14+


  • default takes care that iniparse GEM used by the HWPR is installed


Just add to your cookbook metadata.rb ruby depends 'puppet_compat'

and you can use file_line and ini_setting resources in you recipes.


The file line resource has the same properties, like in puppet except it has action instead of ensure. ```ruby file_line 'Add a line' do path '/tmp/test.cfg' line 'line: ADD' end

file_line 'Delete with match' do path '/tmp/test.cfg' match 'todelete' match_for_absence true action :delete end

file_line 'Delete the line' do path '/tmp/test.cfg' line 'yetanother: delete' action :delete enda

file_line 'Change one line with match' do path '/tmp/test.cfg' match 'tochange' line 'tochange: changed' end ```


Usage of ini_setting is also pretty close to the Puppet one. Ensure is also replaced with action. The only one addition - you may provide the format of parameter=value separator. Although it is against INI standard some software is sensitive to it, so param=value or param = value for some software packeges is important. For these non-standard following software you cat provide separator property: ruby ini_setting 'Set option' do path '/tmp/test.ini' section 'test' setting 'option_add' value 'added' separator '=' end ini_setting 'Set option with spaces' do path '/tmp/test.ini' section 'test' setting 'option_add' value 'added' separator ' = ' end The rest of usage cases are selfexplanatory: ruby ini_setting 'Delete option' do path '/tmp/test.ini' section 'test' setting 'option_two' action :delete end ini_setting 'Change option' do path '/tmp/test.ini' section 'test' setting 'option_chg' value 'nice' end ini_setting 'Delete section' do path '/tmp/test.ini' section 'bad_section' action :delete end Known bug - the following resource will fail if file /tmp/test.ini does not contain any options without a section: ruby ini_setting 'Set option outside sections' do path '/tmp/test.ini' setting 'option_add' value 'added' end This is caused by the bug in iniparse GEM, see:

ini_setting extensions

Based on practical use of the ini_setting resource I've made some extensions, which are not supported by puppet version of the resource. This extension is useful when you need to do a number of changes in ini file. In puppet inplementation it is usualy solved by calling ini_settings using create_resources() function. For Chef implementation I've decided to make it easy: properties section and setting may by a hash or array.

set multiple setting within one section

In this case you need to pass to setting property the hash of key-value pairs like this one: ruby default['settings_test'] = { 'one' => 'a', 'two' => 'b', } Property value should not be used in this case.

set multiple settings in multiple sections

In this case you need to pass to section property the hash, where keys are section names and values are hashes like in previous case. For example: ruby default['sections_test'] = { 'testsec1' => { 'set1' => 10, 'set2' => 20, }, 'testsec2' => { 'set21' => 100, 'set22' => 200, }, } With both methods above it is possible to change existing settings/sections or add a new ones.

delete multiple settings within a section

Just pass to setting property array with the settings names that should be deleted

delete multiple settings in multiple sections

In this case you need to pass to section property the hash, where keys are section names and values are arrays with settings names to delete.

delete multiple sections

Also possible. For this pass to section property array with section names to be deleted.

License & Authors

  • Author:: Stanislav Voroniy ( ```text Copyright 2017-2018, Stanislav Voroniy

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

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

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric

1.1.1 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

1.1.1 passed this metric

Foodcritic Metric

1.1.1 passed this metric

No Binaries Metric

1.1.1 passed this metric

Publish Metric

1.1.1 passed this metric

Supported Platforms Metric

1.1.1 passed this metric

Testing File Metric

1.1.1 passed this metric

Version Tag Metric

1.1.1 passed this metric