Sha256: 727c87472dd644d0030fbfbd60223a0c4b5a36dd2c289361f16d8052352921ce

Contents?: true

Size: 1.17 KB

Versions: 19

Compression:

Stored size: 1.17 KB

Contents

# @summary Like the unix command mkdir_p except with puppet code.
# This creates file resources for all directories and utilizes the dir_split() function
# to get a list of all the descendant directories.  You will have no control over any other parameters
# for the file resource.  If you wish to control the file resources you can use the dir_split() function
# and get an array of directories for use in your own code.  Please note this does not use an exec resource.
#
# @param dirs [Variant[Stdlib::Absolutepath, Array[Stdlib::Absolutepath]]] - the path(s) to create
# @return [Array[Stdlib::Absolutepath]]
# @example How to use
#  extlib::mkdir_p('/opt/puppetlabs/bin') => ['/opt', '/opt/puppetlabs', '/opt/puppetlabs/bin']
# @note splits the given directories into paths that are then created using file resources
# @note if you wish to create the directories manually you can use the extlib::dir_split() function in the same manner
function extlib::mkdir_p(Variant[Stdlib::Absolutepath, Array[Stdlib::Absolutepath]] $dirs) >> Array[Stdlib::Absolutepath] {
  $dirs_array = extlib::dir_split($dirs)
  @file{$dirs_array:
    ensure => directory,
  }
  realize(File[$dirs_array])
  $dirs_array
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
puppet-debugger-1.4.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-1.3.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-1.2.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-1.1.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-1.0.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.19.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.18.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.17.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.16.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.15.2 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.15.1 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.15.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.14.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.13.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.12.3 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.12.2 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.12.1 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.12.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp
puppet-debugger-0.11.0 spec/fixtures/modules/extlib/functions/mkdir_p.pp