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

managed_directory (5) Versions 0.1.0

Provides the managed_directory resource

Berkshelf/Librarian
Policyfile
Knife
cookbook 'managed_directory', '= 0.1.0'
cookbook 'managed_directory', '= 0.1.0', :supermarket
knife cookbook site install managed_directory
knife cookbook site download managed_directory
README
Dependencies
Quality 0%

Description

Provides an LWRP 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.

Requirements

Platform

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

Resource/Provider

managed_directory

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

Actions

  • :clean - Remove any unmanaged files.

Attribute Parameters

  • path - (name attribute) The absolute path to the directory to be managed.

Usage

default

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

test

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

Caveats

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

  • This doesn't even try to cope with subdirectories (managed or otherwise) inside the managed_directory.

  • 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 directory.

  • Files managed by resources created after this LWRP is converged (eg, from within a ruby_block or LWRP 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

Author: Zachary Stevens (zts@cryptocracy.com)

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.

Foodcritic Metric
            

0.1.0 failed this metric

FC031: Cookbook without metadata file: /tmp/cook/eca2e96dda9b08ccf1a65153/managed_directory/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/eca2e96dda9b08ccf1a65153/managed_directory/metadata.rb:1