shell_manager.cp is not working as I expect it to

0 views
Skip to first unread message

Waxie

unread,
Dec 31, 2009, 2:19:19 PM12/31/09
to AutomateIt
Hi,

I am currently in the process of evaluating automateid as a
replacement for cfengine. A significant number of our cfengine rules
are of the form

copy:
any::
/path/to/sourcedir dest=/etc/otherdir recurse=inf

The basic idea is that it copies all files in /path/to/sourcedir to /
etc/otherdir. It seems like the automateit analog is

cp("/path/to/sourcedir", "/etc/otherdir")

However, when this runs, what I get is

/etc/otherdir/sourcedir/file1
/etc/otherdir/sourcedir/file2
/etc/otherdir/file1
/etc/otherdir/file2

In other words, it is copying the sourcedir directory (and everything
under it), and then copying each of the files in the sourcedir
directory.

I worked around it by putting a trailing . on the source.

cp("/path/to/sourcedir/.", "/etc/otherdir")

The former behavior seems like a bug to me. It should either copy only
the files in sourcedir, or make a copy of sourcedir, but shouldn't be
doing both.

Reply all
Reply to author
Forward
0 new messages