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

Select Status


managed_directory (6) Versions 0.3.0

Provides the managed_directory resource

cookbook 'managed_directory', '= 0.3.0', :supermarket
cookbook 'managed_directory', '= 0.3.0'
knife supermarket install managed_directory
knife supermarket download managed_directory
Quality 60%


Provides a custom resource to declare that a directory's contents are
entirely managed by Chef. When a node is converged, any files present
in the managed_directory that are not managed by Chef will be removed.



Known to work on CentOS and OS X. Should work on other Unix-like



Ensure that a directory contains only files put there by Chef in this
run. Any other files will be removed.


  • :clean - Remove any unmanaged files.

Attribute Parameters

  • path - (name attribute) The absolute path to the directory to be managed.
  • clean_files - Boolean to determine whether unmanaged files should be removed. Default is true.
  • clean_links - Boolean to determine whether unmanaged links should be removed. Default is true.
  • clean_directories - Boolean to determine whether unmanaged subdirectories should be removed. Default is false.



Include the default recipe in a run list to make the resource
available in your run.


The 'test' recipe illustrates use of the managed_directory resource.


The 'test_directories' recipe illustrates use of the managed_directory
resource when having it clean up unwanted subdirectories.


  • The directory to be managed must already exist. If you also need
    to ensure that the directory exists, use the Directory resource

  • If you require subdirectories to be managed as well, be sure to set the
    clean_directories attribute to true

  • A file is considered to be managed if there is a resource with a
    name attribute equal to the file's full path. It will do the wrong
    thing if this assumption is not true for the contents of your

  • Files managed by resources created after this resource is converged
    (eg, from within a ruby_block or resource later in the run list) will
    be incorrectly identified as "unmanaged", and then deleted. They
    will be recreated later in the run, but this creates a window where
    the file is missing.

License and Author

- Zachary Stevens (zts)
- Gregory Ruiz-Ade (gkra)
- Heig Gregorian (hgregorian)

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,
See the License for the specific language governing permissions and
limitations under the License.


This file is used to list changes made in each version of the managed_directory cookbook.


  • converted from LWRP to custom resource
  • fixed potential false positive where resource reported an update
  • fixed issue where non-path named resources were skipped
  • Chef 13 compatible


  • Fix bug for subdirectories when clean_directories is false. This would cause the subdirectory to be handed to the file resource in the provider, which would then cause chef-client to abort.


  • Added cleaning of subdirectories
  • Added separate handling of links, which were formerly handled by the file resource, as managing links via file resources is deprecated
  • Added attributes to control handling of files, directories and links
    • clean_files and clean_links default to true to preserve existing behavior
    • clean_directories defaults to false to preserve existing behavior
  • Updated tests to current ChefSpec and ServerSpec, following examples from ChefDK's chef generate cookbook output
  • Updated Test Kitchen to current CentOS (6.6)
  • Updated for new behaviors
  • Added ChefSpec matchers for test-ability


  • add chefspec tests
  • FIX don't blow up when resource names are symbols
    • Thanks to Mark Friedgan (hubrix) for this fix.

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 passed 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, and your repo must contain a file

License 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, and your repo must contain a file

Version Tag Metric

0.3.0 passed this metric