Erlend,

look at the following line in your body copy_from:

preserve => "true";

it directs Cfengine to preserve file permissions taken from source.
Your source file obviously has permissiions 644.

2010/12/22 Erlend Leganger <erlend.legan...@gmail.com>:
> After upgrading from cf v3.0.2 to v3.1.2, my simple file copying
> promises cannot set proper perms for files any more. Or to be more
> precise - the correct file access is set and then immediately reset
> again. This flip-flopping forces all my file copying policies to kick
> in every time cfengine runs and all files which should have anything
> else than 644 are not correct.
>
> The bug must be something really simple, but I can't see it. What am I
> doing wrong? Below is a complete flip-flopping example.
>
> - Erlend
>
> r...@nrsscdev01:master$ cat tester.cf
> #------------------------------------------------------------------------
> body common control{
>   bundlesequence=>{"tester"};
> }
>
> #------------------------------------------------------------------------
> bundle agent tester{
> files:
>   any::
>      "/.rhosts"
>         copy_from=>tester_cp_file("localhost",
>            "/export/cfengine/depot/rhosts.standard"),
>         perms=>tester_perms("root","sys","600");
>   }
>
> #------------------------------------------------------------------------
> body perms tester_perms(o,g,m){
>   owners=>{"$(o)"};
>   groups=>{"$(g)"};
>   mode=>"$(m)";
> }
>
> #------------------------------------------------------------------------
> body copy_from tester_cp_file(server, path) {
>   servers => { "${server}" };
>   encrypt => "true";
>   trustkey => "true";
>   source => "${path}";
>   compare => "digest";
>   preserve => "true";
>   verify => "true";
>   purge => "true";
> }
> r...@nrsscdev01:master$
> r...@nrsscdev01:master$
> r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent -KIf ./tester.cf
>  -> Object /.rhosts had permission 644, changed it to 600
>  -> Object /.rhosts had permission 600, changed it to 644
> r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent -KIf ./tester.cf
>  -> Object /.rhosts had permission 644, changed it to 600
>  -> Object /.rhosts had permission 600, changed it to 644
> r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent -KIf ./tester.cf
>  -> Object /.rhosts had permission 644, changed it to 600
>  -> Object /.rhosts had permission 600, changed it to 644
> r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent -KIf ./tester.cf
>  -> Object /.rhosts had permission 644, changed it to 600
>  -> Object /.rhosts had permission 600, changed it to 644
> r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent --version
> This comprises cf-agent core community version 3.1.2 - Copyright
> Copyright (C) Cfengine AS 2008,2010-
> r...@nrsscdev01:master$
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>



-- 
SY, Seva Gluschenko.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to