Here is a self contained example.

######################
body common control {
     bundlesequence => { "test" };
}

bundle common g {
     classes:

         "all" expression => "any";
}

bundle agent test {

     files:

     "/tmp/foobar"
         copy_from => local_cp("/tmp/src-foobar"),
         comment => "check contents only";

     reports:

         all::
}
body copy_from local_cp(from)
{
source      => "$(from)";
compare     => "digest";
}

Target and source files:

-rw------- 1 neil neil 9 2010-01-05 20:07 /tmp/foobar
-rw-r--r-- 1 neil neil 9 2010-01-05 20:08 /tmp/src-foobar

Both files are currently identical in contents but not permissions.
However, since the files promise makes no promise about permissions I
expect it to do nothing.

cf-agent -KnIf ./test.cf
  -> Object /tmp/foobar had permission 600, changed it to 644

It would seem that the agent assumes that the source file has the
correct permissions.  There is something called 'preserve' that "Whether
or not the copy preserves the permissions on the source files."  So is
this set to true by default?  Let's try by adding 
preserve => "false";
to our body and retry.

cf-agent -KnIf ./test.cf
  -> Object /tmp/foobar had permission 600, changed it to 644

For completeness I'll try setting preserve to true.

cf-agent -KnIf ./test.cf
  -> Object /tmp/foobar had permission 600, changed it to 644

No difference.

Why is the agent trying to change permissions?  Is this expected
behaviour?  Is this desired behaviour?

Sincerely,
-- 
Neil Watson
Linux/UNIX Consultant
http://watson-wilson.ca
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to