Slackbot
06/13/2023, 10:16 PMYorokobi
06/13/2023, 10:20 PMYorokobi
06/13/2023, 10:20 PMPatrick Rynhart
06/13/2023, 10:20 PMPatrick Rynhart
06/13/2023, 10:21 PMPatrick Rynhart
06/13/2023, 10:24 PMfile { '/some/long/path/with/parents/that/do/not/exist/on/disk/yet':
ensure => 'directory',
owner => 'tomcat',
group => 'tomcat',
recurse => true,
}Patrick Rynhart
06/13/2023, 10:24 PMInfo: Applying configuration version 'rhs-dev-cf877fee152'
Error: Cannot create /some/long/path/with/parents/that/do/not/exist/on/disk/yet; parent directory /some/long/path/with/parents/that/do/not/exist/on/disk does not exist
Error: /Stage[main]/Dspace_modern/File[/some/long/path/with/parents/that/do/not/exist/on/disk/yet]/ensure: change from 'absent' to 'directory' failed: Cannot create /some/long/path/with/parents/that/do/not/exist/on/disk/yet; parent directory /some/long/path/with/parents/that/do/not/exist/on/disk does not existSkylar Thompson
06/13/2023, 10:25 PMparent_dirs that uses reduce, looking up parameters from Hiera so we can make sure that any common path elements get the same ownership/permissions regardless of where parent_dirs is called from.
define parent_dirs (
Hash $params = {
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0755',
},
) {
$parent_dirs_params = lookup('parent_dirs::params',Hash[String,Hash],undef,{})
$title.split('/').reduce([]) | $sub_path,$d | {
$new_path = $sub_path + $d
$new_path_join = $new_path.join('/')
if $new_path_join =~ /^\// {
# Use the params hash as defaults if any values aren't set in parent_dirs::params for a particular path
ensure_resource('file',$new_path_join,($params + pick($parent_dirs_params[$new_path_join],{})))
}
$new_path
}
}Patrick Rynhart
06/13/2023, 10:26 PMSkylar Thompson
06/13/2023, 10:26 PMPatrick Rynhart
06/13/2023, 10:27 PMYorokobi
06/13/2023, 10:27 PM/ and ensure => directory on each element.Patrick Rynhart
06/13/2023, 10:28 PMPatrick Rynhart
06/13/2023, 10:29 PMSkylar Thompson
06/13/2023, 10:29 PMPatrick Rynhart
06/13/2023, 10:31 PMkenyon
06/14/2023, 12:32 AMPatrick Rynhart
06/14/2023, 5:17 AMBrian Schonecker
06/14/2023, 3:11 PM