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

RSS

fileutils (25) Versions 2.1.14

Recursively modify (chown, chmod) owner, group, mode settings or delete files and directories

Policyfile
Berkshelf
Knife
cookbook 'fileutils', '= 2.1.14', :supermarket
cookbook 'fileutils', '= 2.1.14'
knife supermarket install fileutils
knife supermarket download fileutils
README
Dependencies
Changelog
Quality 33%

Description

This cookbook provides the fileutils resource. The resource can be used to set attributes
on all of the files in a directory and subdirectory. We've had years of people
complaining that the directory recursive mode, which is in fact a parent operation,
does not work on subdirectories and files. In this cookbook recursive refers
to subdirectories and the files contained inside them.

Requirements

Developed for RHEL and Solaris servers.

Resource Parameters

The fileutils resource will accept two actions.

  • :change is used to modify ownership and permission mode bit settings.
  • :delete is used to remove files and directories. :delete always functions in a recursive mode.
Action Parameter Use
:change path Specify the starting path or file. The path must exist for anything to be done.
owner Set the owner of the files and directories to this value.
group Set the group of the files and directories to this value.
file_mode Set the permission mode for files. Specify octal numbers or mode change symbols
directory_mode Set the permission mode for directories. Specify octal numbers or mode change symbols
recursive Boolean. Use top down traversal from the starting path. Default is true. When recursive is false only the initial directory and contents are changed.
only_files Boolean. Only change files. Default is false.
only_directories Boolean. Only change directories. Default is false.
pattern Regex. Match to filter the basename of files and directories.
follow_symlink Boolean. Continue on past symlinks. Very dangerous option with a high risk of changing unintended files. Default is false!
quiet Boolean. Suppress output for changing each file. Default is false.
Action Parameter Use
:delete path Specify the starting path or file.
recursive Delete always functions in recursive mode.
only_files Boolean. Only delete files. Default is false.
pattern Regex. Match to filter the basename of files and directories.
follow_symlink Boolean. Continue on past symlinks. Very dangerous option with a high risk of deleting unintended files. Default is false!
force Boolean. Use the for option with FileUtils.
quiet Boolean. Supress output for deleting each file. Default is false.

Mode bit settings

You may specify the mode as a numeric value.

0o600, 0600, '0600' and 420 will all create the same numeric setting.
Note that '600' is treated as decimal 600 and is not the same as '0600'
which is treated as octal 600.

You may use symbolic settings. Pick from the who list and add
or subtract access permissions. The code tries to mimic the
chmod command.

Who

  • u Owning user
  • g Owning group
  • o Others
  • a Everyone

Permissions

  • r Read
  • w Write
  • x Search/execute
  • s Assign user
  • t Sticky bit

Examples

  • '+r' Adds read permissions to all files
  • 'g+r' Adds read permissions for the group to all files
  • 'o-w' Removes write permissions for other from all files

Usage

A good example of why you would use the fileutils resource would be
setting attributes on files and directories after directory and file
resources have created things. Notice that fileutils and directory
resources treat recursive as moving in opposite directions.

# Create some directories
dir '/export/home/my/stuff/deep' do
  recursive true  # creates parents
end

# Set the owner on multiple directories
fileutils '/export/home/my' do # Set the child nodes
  owner 'my'
end

# Empty a directory
fileutils '/export/home/my' do
  action :delete
end

# Set mode attributes
fileutils '/export/home/my' do # Set the child nodes
  file_mode ['o+r', 'g+w']
  directory_mode ['o+rx', 'g+wrx']
end

# Change only the top level directory and it's files
# should not change .../stuff/**
fileutils '/export/home/my' do
  recursive false
  files_only true
  file_mode ['0700']
end

Author

  • Mark Gibbons

Acknowlegments

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

CHANGELOG for fileutils

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

2.1.14 - 2024-05-03

2.1.13 - 2023-12-27

2.1.12 - 2023-11-01

  • Update Platforms

2.1.11 - 2023-10-31

  • Fix markdown errors
  • Update standardfiles

2.1.10 - 2023-09-28

2.1.9 - 2023-09-04

2.1.8 - 2023-05-17

2.1.7 - 2023-05-03

2.1.6 - 2023-04-01

2.1.5 - 2023-03-02

  • Standardise files with files in sous-chefs/repo-management

2.1.4 - 2023-02-15

  • Standardise files with files in sous-chefs/repo-management

2.1.3 - 2023-02-15

  • Replace delivery with reusable GitHub workflows
  • Configure Renovate

2.1.2 - 2023-02-14

  • Remove delivery folder

2.1.1 - 2022-01-18

2.1.0 - 2021-08-16

2.0.1 - 2021-06-01

2.0.0 - 2021-05-24

  • resolved cookstyle error: libraries/delete_help.rb:11:32 convention: Style/ExpandPathArguments
  • resolved cookstyle error: spec/unit/libraries/dir_spec.rb:1:9 convention: Style/RedundantFileExtensionInRequire
  • support Chef 17
  • minimum Chef version is 15.3

1.4.0 (2020-07-31)

  • Add rspec testing to the github actions
  • Add integration testing to the github actions
  • resolved cookstyle error: resources/default.rb:12:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/default.rb:13:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/default.rb:30:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/default.rb:31:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/default.rb:32:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/default.rb:35:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties

1.3.0

  • Try to treat the mode settings for files and groups more consistently.
  • Allow numeric and string settings for mode values
  • Cookstyle updates

1.2.0

  • Add a quite option to turn off the detail output from file changes and deletes

1.1.7

  • Change the cookbook description

1.1.6

  • Fix setting the gid and uid

1.1.5

  • Add Travis tests

1.1.4

  • Add contributers and testing files.
  • metadata changes to pass quality metrics

1.1.3

  • Apache license in metadata

1.1.2

  • Minor clean up, add author

1.1.0

  • Clean up what recursive means

1.0.2

  • Support chefci (now being sent to internal supermarket via chefci)

1.0.1

  • Fix boundary condition bugs

1.0.0

  • Initial version

Collaborator Number Metric
            

2.1.14 passed this metric

Contributing File Metric
            

2.1.14 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

Cookstyle Metric
            

2.1.14 passed this metric

No Binaries Metric
            

2.1.14 failed this metric

Failure: Cookbook should not contain binaries. Found:
fileutils/files/default/vendor/cache/walk-0.1.0.gem
fileutils/files/default/vendor/walk-0.1.0.gem

Testing File Metric
            

2.1.14 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
            

2.1.14 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