Forum: CFEngine Help
Subject: Re: file content to a class
Author: bahamat
Link to topic: https://cfengine.com/forum/read.php?3,25931,25932#msg-25932

Use the readfile() function.

Here's an exampe:


bundle agent example {

vars:

  "classfromfile" string => readfile("/etc/file_with_a_class_in_it", "80");

classes:

  "$(classfromfile)" expression => fileexists("/etc/file_with_a_class_in_it");

reports:

  class1::
    "File contained string: class1";

  class2::
    "File contained string: class2";

}


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

Reply via email to