spam in output/previous enterprise 3.18

22 views
Skip to first unread message

Stefan Skoglund

unread,
Aug 13, 2021, 6:47:24 PM8/13/21
to help-cfengine
for some reason or another i get messages like this:

---
root@asus:/var/cfengine# cat outputs/previous
error: Maximum recursion level reached at '/home/stefan/Skrivbord/skaraborgfakir.github.io/christinatruong/./ch1/01_04/bilder'
error: Errors encountered when actuating files promise' /var/www/www.fakirenstenstorp.st/stefan/css_course_christinatruong/.'
error: Method 'ensure_configuration' failed in some repairs
error: Method 'env_main' failed in some repairs
---

I have a recursive copy, so how do i write a correct recursive copy
with a ignore list and a normal max depth ?

Nick Anderson

unread,
Aug 13, 2021, 6:55:53 PM8/13/21
to Stefan Skoglund, help-cfengine
What's the promise?



--
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

unread,
Aug 13, 2021, 7:36:17 PM8/13/21
to Nick Anderson, help-cfengine
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"};
---


https://github.com/skaraborgfakir/skaraborgfakir.github.io

is the git repo ie "/home/stefan/Skrivbord/skaraborgfakir.github.io/" is the clone.

Nick Anderson

unread,
Aug 13, 2021, 8:35:18 PM8/13/21
to Stefan Skoglund, help-cfengine
Hum, can you please post the verbose run output?

Stefan Skoglund

unread,
Aug 14, 2021, 4:35:54 PM8/14/21
to Nick Anderson, help-cfengine
fre 2021-08-13 klockan 19:35 -0500 skrev 'Nick Anderson' via help-
cfengine:
> Hum, can you please post the verbose run output?
>

vars:

files:

Stefan Skoglund

unread,
Aug 15, 2021, 2:10:11 PM8/15/21
to Nick Anderson, help-cfengine
fre 2021-08-13 klockan 19:35 -0500 skrev 'Nick Anderson' via help-
cfengine:
> Hum, can you please post the verbose run output?
>
>
> On Fri, Aug 13, 2021, 6:36 PM Stefan Skoglund <
> stefan....@agj.net> wrote:
> > 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"};
> > ---
> >
> >
> > https://github.com/skaraborgfakir/skaraborgfakir.github.io
> >
> > is the git repo ie
> > "/home/stefan/Skrivbord/skaraborgfakir.github.io/" is the clone.
> >

this was funny:
the error disappeared when i did this:
--
"/var/www/www.fakirenstenstorp.st/stefan/css_course_christinatruong/."
handle => "NS_www_fakirenstenstorp_kopiera_ur_truong",
depends_on => { "NS_www_fakirenstenstorp_truong"},
# copy_from => default:perms_cp( "/home/stefan/Skrivbord/skaraborgfakir.github.io/christinatruong"),
copy_from => default:no_backup_dcp( "/home/stefan/Skrivbord/skaraborgfakir.github.io/christinatruong"),
file_select => by_name( @(truong)),
depth_search => default:recurse( "inf"),
meta => { "fakirenstenstorp", "httpd", "www.fakirenstenstorp.st"};
---
---
body file_select by_name(names)
# @brief Select files that match `names`
# @param names A regular expression
{
leaf_name => { @(names)};
file_types => { "plain" };
file_result => "leaf_name.file_types";
}
---

though i dont think the special file_select is really necessary, the default:by_name should be enough

Nick Anderson

unread,
Aug 16, 2021, 4:22:03 PM8/16/21
to Stefan Skoglund, Nick Anderson, help-cfengine

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.

Nick Anderson

unread,
Aug 16, 2021, 4:36:10 PM8/16/21
to help-cfengine

Stefan Skoglund

unread,
Aug 17, 2021, 4:24:36 AM8/17/21
to Nick Anderson, help-cfengine
mån 2021-08-16 klockan 13:36 -0700 skrev 'Nick Anderson' via help-
cfengine:
> https://tracker.mender.io/browse/CFE-3732

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.

Stefan Skoglund

unread,
Aug 17, 2021, 4:27:45 AM8/17/21
to Nick Anderson, help-cfengine
mån 2021-08-16 klockan 13:36 -0700 skrev 'Nick Anderson' via help-cfengine:
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?

"truong"
      slist => { "example\.html", "test\.css", "index\.html", ".*jpg"};

Nick Anderson

unread,
Aug 17, 2021, 2:25:30 PM8/17/21
to Stefan Skoglund, Nick Anderson, help-cfengine

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.

Reply all
Reply to author
Forward
0 new messages