Forge Home

dirtree

The dirtree function builds an array of directories from a full directory path. The array can then be used to ensure all the required directories in a path are managed by puppet.

835,114 downloads

833,935 latest version

3.8 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.1 (latest)
  • 0.2.0
  • 0.1.1
released May 14th 2013

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'AlexCline-dirtree', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add AlexCline-dirtree
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install AlexCline-dirtree --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

AlexCline/dirtree — version 0.1.1 May 14th 2013

dirtree

This module provides the dirtree function.

The dirtree function accepts a string containing an absolute directory path and will return an array of the tree containing all the folders of that path.

Best efforts have been made to make this function compatible with both Windows and Linux systems.

Examples

dirtree('/usr/share/puppet')
Will return: ['/usr', '/usr/share', '/usr/share/puppet']

dirtree('C:\\windows\\system32\\')
Will return: ["C:\\windows", "C:\\windows\\system32"]

You can use the dirtree function in a class to enumerate all required directories if needed.

class dirtree {
  # rubysitedir = /usr/lib/ruby/site_ruby/1.8
  $dirtree = dirtree($::rubysitedir)

  # $dirtree = ['/usr', '/usr/lib', '/usr/lib/ruby', '/usr/lib/ruby/site_ruby', '/usr/lib/ruby/site_ruby/1.8',]
  ensure_resource('file', $dirtree, {'ensure' => 'directory'})
  # With the puppetlabs-stdlib 1.4.0 module, the ensure_resource function accepts an array, which will
  # create new resources with the names specified if they don't already exist.
}

Support

Please file tickets and issues using GitHub Issues

License

Copyright 2013 Alex Cline alex.cline@gmail.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.