Forum: CFEngine Help
Subject: expand_template("$(this.promiser).tpl") does not work
Author: svenXY
Link to topic: https://cfengine.com/forum/read.php?3,22861,22861#msg-22861

Hi again,


body common control
{
          bundlesequence  => { 'test' };
            inputs         => { "cfengine_stdlib.cf" };
}

bundle agent test
{
  vars:
    "no" int => 
getfields("${sys.host}:.*","${sys.workdir}/inputs/test.cfg",":","appcfg");

  files:
    "/tmp/fnord.cfg"
      handle => "fill_file_from_tpl_and_cfg",
      create => "true",
      edit_line => expand_template("${this.promiser}.tpl");
}


yields:


cf3>       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3>       BUNDLE expand_template( {'$(this.promiser).tpl'} )
cf3>       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3> 
cf3> Initiate variable convergence...
cf3>     ? Augment scope expand_template with templatefile (s)
cf3>      ??  Private class context
cf3> 
cf3> 
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>       insert_lines in bundle expand_template
cf3>       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> 
cf3> 
cf3>     .........................................................
cf3>     Promise handle: 
cf3>     Promise made by: $(this.promiser).tpl
cf3> 
cf3>     Comment:  Expand variables in the template file
cf3>     .........................................................
cf3> 
cf3> Could not read file $(this.promiser).tpl
cf3>  !!! System reports error for fopen: "No such file or directory"


I think it would be cool if we could select a template for a file by using 
$(this.promiser).

Is this a bug or a feature request?

Thanks,
Sven

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

Reply via email to