- From: Peter Norton <
>
- To:
- Subject: [chef] Easier symlink management?
- Date: Fri, 28 Oct 2011 13:17:49 -0400
I'm migrating installations over to chef that currently do a lot of
symlinking. The actual symlinks make sense, but don't adhere to the
rails/capistrano layout deployed in the chef documentation for the
deploy mechanism. It seems to me that the deploy mechanism is more
than I want - I'd like to be able to do
symlink_dir "foo" do
user myuser
group mygroup
obj_types [ 'd', 'l', 'f' ]
source /source/filesystem/path
dest /destination/filesystem/path
end
and have all files, directories, and symlinks be symlinked from
src->dst. Instead it seems that I have to do this:
bash "create_bin_symlinks" do
# Binary symlinks don't get directories linked in.
user 'user'
group 'group'
cwd dst_dir
code <<-EOBASH
for item in $(ls #{src_dir}) ; do
if [ -x #{src_dir}/$item ] && [ ! -d #{src_dir}/$item ] ; then
[ -h #{dst_dir}/$item ] || ln -s #{src_dir}/$item #{dst_dir}/
fi
done
EOBASH
end
and tailor this a bit for each file type that I want, which means I'll
be littering a dozen cookbooks and 3x that recipes with this sort of
thing.
How could I add to the DSL to create the feature I described here? In
fact, how could I do it such that the obj_types could be augmented by
passing in a callback to a filter function so instead of just types I
could use any property of the file to determine whether or not to make
the symlink in the source and dest?
Thanks,
-Peter
- [chef] Easier symlink management?, Peter Norton, 10/28/2011
Archive powered by MHonArc 2.6.16.