--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/023d2e67e5fa5ec57f983538700661bfeda41b3e.camel%40agj.net.
Stefan Skoglund <stefan....@agj.net> writes:
fre 2021-08-13 klockan 17:55 -0500 skrev 'Nick Anderson' via help-cfengine: What's the promise?
-— "var/www/www.fakirenstenstorp.st/stefan/css_course_christinatruong." depends_on => { "NS_www_fakirenstenstorp_truong"}, copy_from => default:perms_cp( "home/stefan/Skrivbord/skaraborgfakir.github.io/christinatruong."), file_select => default:by_name( @(truong)), depth_search => default:recurse( "3"), meta => { "fakirenstenstorp", "httpd", "www.fakirenstenstorp.st"}; —is the git repo ie "home/stefan/Skrivbord/skaraborgfakir.github.io" is the clone.
Hi Stefan,
By verbose run output I mean the output of cf-agent --verbose
.
What is the value of truong
?
Really, I want to be able to run a standalone example that allows me to replicate the issue so that I can better see what is happening.
Actually, I don't think I need verbose or the value of truong
.
I was able to get the error message using this policy:
bundle agent __main__ { vars: "troung" slist => { ".*" }; files: "/tmp/css_course_christinatruong/." #depends_on => { "NS_www_fakirenstenstorp_truong"}, copy_from => default:perms_cp( "/tmp/skaraborgfakir.github.io/christinatruong/."), file_select => default:by_name( @(truong)), depth_search => default:recurse( "3"), meta => { "fakirenstenstorp", "httpd", "www.fakirenstenstorp.st"}; }
info: Created parent directory for '/tmp/css_course_christinatruong/.' info: Created directory '/tmp/css_course_christinatruong/./ch1' info: Object '/tmp/css_course_christinatruong/./ch1' had permissions 0700, changed it to 0775 info: Created directory '/tmp/css_course_christinatruong/./ch1/01_02' info: Object '/tmp/css_course_christinatruong/./ch1/01_02' had permissions 0700, changed it to 0775 info: Created directory '/tmp/css_course_christinatruong/./ch1/01_04' info: Object '/tmp/css_course_christinatruong/./ch1/01_04' had permissions 0700, changed it to 0775 info: Created directory '/tmp/css_course_christinatruong/./ch1/01_04/bilder' info: Object '/tmp/css_course_christinatruong/./ch1/01_04/bilder' had permissions 0700, changed it to 0775 error: Maximum recursion level reached at '/tmp/skaraborgfakir.github.io/christinatruong/./ch1/01_04/bilder' error: Errors encountered when actuating files promise '/tmp/css_course_christinatruong/.'
So, the policy specified recursion up to 3 levels. Bilder looks to be the third level, but perhaps something is counting the basedir as level 1, making bilder the 4th level deep.
I don't see any specific mention in the depth searches (aka 'recursion') during searches notes from the files promise type docs.
The depth
attribute in depth_search
bodies does not mention anything specifically either, though it does indicate an allowed input range starting at zero. So perhaps the Error message is being emitted because of an off by one error.
Indeed, altering the depth to 4 results in the error vanishing.
bundle agent __main__ { vars: "troung" slist => { ".*" }; files: "/tmp/css_course_christinatruong/." #depends_on => { "NS_www_fakirenstenstorp_truong"}, copy_from => default:perms_cp( "/tmp/skaraborgfakir.github.io/christinatruong/."), file_select => default:by_name( @(truong)), depth_search => default:recurse( "4"), meta => { "fakirenstenstorp", "httpd", "www.fakirenstenstorp.st"}; }
info: Created parent directory for '/tmp/css_course_christinatruong/.' info: Created directory '/tmp/css_course_christinatruong/./ch1' info: Object '/tmp/css_course_christinatruong/./ch1' had permissions 0700, changed it to 0775 info: Created directory '/tmp/css_course_christinatruong/./ch1/01_02' info: Object '/tmp/css_course_christinatruong/./ch1/01_02' had permissions 0700, changed it to 0775 info: Created directory '/tmp/css_course_christinatruong/./ch1/01_04' info: Object '/tmp/css_course_christinatruong/./ch1/01_04' had permissions 0700, changed it to 0775 info: Created directory '/tmp/css_course_christinatruong/./ch1/01_04/bilder' info: Object '/tmp/css_course_christinatruong/./ch1/01_04/bilder' had permissions 0700, changed it to 0775
I am unsure why switching from default:perms_cp
to default:no_backup_dcp
resulted in suppressing the error for you. When I tried that I still get the error and in both cases, there is no content under the bilder directory though the directory itself was created.
bundle agent __main__ { vars: "troung" slist => { ".*" }; files: "/tmp/css_course_christinatruong/." #depends_on => { "NS_www_fakirenstenstorp_truong"}, #copy_from => default:perms_cp( "/tmp/skaraborgfakir.github.io/christinatruong/."), copy_from => default:no_backup_cp( "/tmp/skaraborgfakir.github.io/christinatruong/."), file_select => default:by_name( @(truong)), depth_search => default:recurse( "3"), meta => { "fakirenstenstorp", "httpd", "www.fakirenstenstorp.st"}; }
info: Created parent directory for '/tmp/css_course_christinatruong/.' info: Created directory '/tmp/css_course_christinatruong/./ch1' info: Created directory '/tmp/css_course_christinatruong/./ch1/01_02' info: Created directory '/tmp/css_course_christinatruong/./ch1/01_04' info: Created directory '/tmp/css_course_christinatruong/./ch1/01_04/bilder' error: Maximum recursion level reached at '/tmp/skaraborgfakir.github.io/christinatruong/./ch1/01_04/bilder' error: Errors encountered when actuating files promise '/tmp/css_course_christinatruong/.'
Still, I am unsure why it errors. I don't see an error.Seems like perhaps this should instead be a verbose log.
On Monday, August 16, 2021 at 3:22:03 PM UTC-5 Nick Anderson wrote:Stefan Skoglund <stefan....@agj.net> writes:
fre 2021-08-13 klockan 17:55 -0500 skrev 'Nick Anderson' via help-cfengine: What's the promise?-— "var/www/www.fakirenstenstorp.st/stefan/css_course_christinatruong." depends_on => { "NS_www_fakirenstenstorp_truong"}, copy_from => default:perms_cp( "home/stefan/Skrivbord/skaraborgfakir.github.io/christinatruong."), file_select => default:by_name( @(truong)), depth_search => default:recurse( "3"), meta => { "fakirenstenstorp", "httpd", "www.fakirenstenstorp.st"}; —is the git repo ie "home/stefan/Skrivbord/skaraborgfakir.github.io" is the clone.Hi Stefan,
By verbose run output I mean the output of
cf-agent --verbose
.What is the value of
truong
?
Stefan Skoglund <stefan....@agj.net> writes:
mån 2021-08-16 klockan 13:36 -0700 skrev 'Nick Anderson' via help- cfengine:
The error (or report) also vanished when recursion was at infinity, but yeah….This is partly my trouble : i cant get my head around the description of recursion in the cfengine reference section about files promises….I usually do my test runs of the policy with –inform.
What part do you struggle with?
At a high level:
You make a promise about a local directory (I recorded always specifying directories suffixed with /.
in order to differentiate it from a plain file). If you want to make the promise apply to sub directories and files you add the depth_search
attribute where you can specify rules about recursion (how deep, directories to include and exclude, details about how to handle symlinks and file-system boundaries).
You can (or may be required, I can't recall off the top of my head, I seem to recall minor changes in behavior sometime in the last decade) to supply the file_select
attribute as well to specify which files should be operated on.