Skip to content

Instantly share code, notes, and snippets.

@schlueter
Last active August 29, 2015 14:01
Show Gist options
  • Save schlueter/f3889a1298940ca63eec to your computer and use it in GitHub Desktop.
Save schlueter/f3889a1298940ca63eec to your computer and use it in GitHub Desktop.
Recursively create folders with chef
split_path = path.split('/')
split_path.each_with_index.map do | _, index |
# Reconstruct each path that makes up the target path and ensure they are created
partial_path = ::File.join split_path.slice(0, index + 1)
next if partial_path == ''
directory partial_path do
owner node[:oracle][:database][:install_user]
group node[:oracle][:database][:install_group]
mode 0775
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment