Puppet Function: wmflib::dir::normalise
- Defined in:
- modules/wmflib/functions/dir/normalise.pp
- Function type:
- Puppet Language
Summary
Takes a directory or list of directories and returns a normalised version.Overview
Currently all this means is that we ensure all directories have the trailing slash removed Further we ensure strings are converted to one element arrays
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'modules/wmflib/functions/dir/normalise.pp', line 12
function wmflib::dir::normalise(
Variant[Stdlib::Unixpath, Array[Stdlib::Unixpath]] $dirs
) >> Array[Stdlib::Unixpath] {
[$dirs].flatten.unique.map |$dir| {
# special case for root dir
if $dir == '/' {
$dir
} elsif $dir.stdlib::end_with('/') {
$dir[0,-2]
} else {
$dir
}
}.flatten.unique
}
|