I have been trying to delete a local file and have been unsuccessful. Help.
/tmp/templates/delete_local_file.cf.test
#
# testing cfengine with following:
# delete local file
#
body common control
{
bundlesequence => { "createFile" , "deleteLocalFile" };
ignore_missing_bundles => "true";
require_comments => "true";
inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf"
};
version => "1.0";
}
body agent control
{
verbose => "true";
}
bundle agent createFile
{
files:
#
# the stanza below creates folders and file if it does not exist
#
"/tmp/test/create_folder1/create_file4.txt"
comment => "create file",
perms => mog("755", "root", "root"),
create => "true";
"/tmp/test/create_folder1/create_folder2/create_file5.txt"
comment => "create file",
perms => mog("755", "root", "root"),
create => "true";
"/tmp/test/create_folder1/create_folder3/create_file6.txt"
comment => "create file",
perms => mog("755", "root", "root"),
create => "true";
}
bundle agent deleteLocalFile
{
files:
"/tmp/test/create_folder1/copy_local_file.txt"
comment => "copy local file",
preserve => "true",
copy_from => myLocalCopy("/etc/hosts");
"/tmp/test/create_folder1/copy_local_file2.txt"
comment => "copy local file",
preserve => "true",
copy_from =>
myLocalCopy("/tmp/test/create_folder1/copy_local_file.txt");
"/tmp/test/create_folder1/copy_local_file.txt"
comment => "delete local file",
file_select =>
specifyFile("/tmp/test/create_folder1/copy_local_file.tx.*"),
copy_from =>
deleteFile("/tmp/test/create_folder1/copy_local_file.txt");
}
body copy_from myLocalCopy(from)
{
source => "$(from)";
}
body copy_from deleteFile(x)
{
purge => "true";
}
body file_select specifyFile(x)
{
path_name => { "$(x)" };
file_types => { "plain" };
file_result => "path_name";
}
The error I am getting is below.
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: /tmp/test/create_folder1/copy_local_file2.txt
cf3>
cf3> Comment: copy local file
cf3> .........................................................
cf3>
cf3> -> Copy file /tmp/test/create_folder1/copy_local_file2.txt from
/tmp/test/create_folder1/copy_local_file.txt check
cf3> -> /tmp/test/create_folder1/copy_local_file2.txt wasn't at destination
(copying)
cf3> -> Copying from localhost:/tmp/test/create_folder1/copy_local_file.txt
cf3> -> Copy of regular file succeeded
/tmp/test/create_folder1/copy_local_file.txt to
/tmp/test/create_folder1/copy_local_file2.txt.cfnew
cf3> -> Attempting to preserve file permissions from the source: 644
cf3> -> Object /tmp/test/create_folder1/copy_local_file2.txt had permission
600, changed it to 644
cf3> -> Updated file from
localhost:/tmp/test/create_folder1/copy_local_file.txt
cf3> Performance(Copy(localhost:/tmp/test/create_folder1/copy_local_file.txt
> /tmp/test/create_folder1/copy_local_file2.txt)): time=0.0010 secs, av=0.0009
> +/- 0.0030
cf3> Existing connection just became free...
cf3> -> Handling file existence constraints on
/tmp/test/create_folder1/copy_local_file2.txt
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: /tmp/test/create_folder1/copy_local_file.txt
cf3>
cf3> Comment: delete local file
cf3> .........................................................
cf3>
cf3> -> Handling file existence constraints on
/tmp/test/create_folder1/copy_local_file.txt
cf3> -> Copy file /tmp/test/create_folder1/copy_local_file.txt from (null)
check
cf3> Can't stat (null) in files.copyfrom promise
cf3> -> Handling file existence constraints on
/tmp/test/create_folder1/copy_local_file.txt
Regards,
j
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine