Forum: CFEngine Help
Subject: Re: Edit selected files
Author: lauwersw
Link to topic: https://cfengine.com/forum/read.php?3,17747,24236#msg-24236

Hi,

Sorry for reviving an old thread, but i'm hitting a very similar problem. I 
could solve it with the examples listed in the bug report 0000190, but they 
don't seem to work for me. With the last example just one randomly selected 
file is edited. Permissions are applied to all files, but the edit_lines 
statement will always be executed once. The other files are noticed, but not 
edited. So if even that option doesn't work...


bundle agent testing
{
files:
  any::
    "/home/test/tmp/.*/testf.*"
      create => "true",
      edit_line => myedit;
}


bundle edit_line myedit
{
insert_lines:
  any::
    "one two three test";
}



Gives:


cf3>       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3>       BUNDLE testing
cf3>       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3> 
cf3> Initiate variable convergence...
cf3> 
cf3>      +  Private classes augmented:
cf3> 
cf3>      -  Private classes diminished:
cf3> 
cf3> 
cf3> 
cf3>    =========================================================
cf3>    files in bundle testing (1)
cf3>    =========================================================
cf3> 
cf3> 
cf3>     .........................................................
cf3>     Promise handle: 
cf3>     Promise made by: /home/test/tmp/.*/testf.*
cf3>     .........................................................
cf3> 
cf3>  -> Using regex pathtype for /home/test/tmp/.*/testf.* (see pathtype)
cf3> Directory /home/test in search path /home/test/tmp/.*/testf.* is 
controlled by another user (uid 501) - trusting its content is potentially 
risky (possible race)
cf3> Promise (version not specified) belongs to bundle 'testing' in file 
'/var/cfengine/inputs/app.cf' near line 6
cf3>  -> Using regex pathtype for /home/test/tmp/b/testf.* (see pathtype)
cf3> Directory /home/test in search path /home/test/tmp/b/testf.* is controlled 
by another user (uid 501) - trusting its content is potentially risky (possible 
race)
cf3> Promise (version not specified) belongs to bundle 'testing' in file 
'/var/cfengine/inputs/app.cf' near line 6
cf3>  -> Using expanded file base path /home/test/tmp/b/testfb
cf3>  -> File "/home/test/tmp/b/testfb" exists as promised
cf3>  -> Handling file existence constraints on /home/test/tmp/b/testfb
cf3>  -> Handling file edits in edit_line bundle myedit
cf3> 
cf3>       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3>       BUNDLE myedit
cf3>       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3> 
cf3> Initiate variable convergence...
cf3>      ??  Private class context
cf3> 
cf3> 
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>       insert_lines in bundle myedit
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> 
cf3> 
cf3>     .........................................................
cf3>     Promise handle: 
cf3>     Promise made by: one two three test
cf3>     .........................................................
cf3> 
cf3>  -> Promised line "one two three test" exists within selected region of 
/home/test/tmp/b/testfb (promise kept)
cf3>      ??  Private class context
cf3> 
cf3> 
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>       insert_lines in bundle myedit
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> 
cf3> 
cf3>     .........................................................
cf3>     Promise handle: 
cf3>     Promise made by: one two three test
cf3>     .........................................................
cf3> 
cf3>  -> This promise has already been verified
cf3>      ??  Private class context
cf3> 
cf3> 
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>       insert_lines in bundle myedit
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> 
cf3> 
cf3>     .........................................................
cf3>     Promise handle: 
cf3>     Promise made by: one two three test
cf3>     .........................................................
cf3> 
cf3>  -> This promise has already been verified
cf3>  -> No edit changes to file /home/test/tmp/b/testfb need saving
cf3>  -> Handling file existence constraints on /home/test/tmp/b/testfb
cf3>  -> Using regex pathtype for /home/test/tmp/c/testf.* (see pathtype)
cf3> Directory /home/test in search path /home/test/tmp/c/testf.* is controlled 
by another user (uid 501) - trusting its content is potentially risky (possible 
race)
cf3> Promise (version not specified) belongs to bundle 'testing' in file 
'/var/cfengine/inputs/app.cf' near line 6
cf3>  -> Using expanded file base path /home/test/tmp/c/testfc
cf3>  -> File "/home/test/tmp/c/testfc" exists as promised
cf3>  -> Handling file existence constraints on /home/test/tmp/c/testfc
cf3>  -> This promise has already been verified
cf3>  -> Handling file existence constraints on /home/test/tmp/c/testfc
cf3>  -> Using regex pathtype for /home/test/tmp/a/testf.* (see pathtype)
cf3> Directory /home/test in search path /home/test/tmp/a/testf.* is controlled 
by another user (uid 501) - trusting its content is potentially risky (possible 
race)
cf3> Promise (version not specified) belongs to bundle 'testing' in file 
'/var/cfengine/inputs/app.cf' near line 6
cf3>  -> Using expanded file base path /home/test/tmp/a/testfa
cf3>  -> File "/home/test/tmp/a/testfa" exists as promised
cf3>  -> Handling file existence constraints on /home/test/tmp/a/testfa
cf3>  -> This promise has already been verified
cf3>  -> Handling file existence constraints on /home/test/tmp/a/testfa
cf3> 
cf3>      +  Private classes augmented:
cf3> 
cf3>      -  Private classes diminished:


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to