Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3623

The content attribute for files promises should support this.promiser

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Open
    • Priority: (None)
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      Currently, the content parameter for files type promises can not expand $(this.promiser). When implemented, we should add content to [the documentation for {{this.promiser}}](https://docs.cfengine.com/docs/master/reference-special-variables-this.html#this-promiser) that indicates where it can be expected to work.

      bundle agent __main__
      {
        vars:
            "files" slist => {
                               "/tmp/this.promiser/content.txt",
                               "/tmp/this.promiser/edit_template_string.txt",
                               "/tmp/this.promiser/edit_line.txt"
            };
      
        files:
            "/tmp/this.promiser/edit_line.txt"
              create => "true",
              edit_line => lines_present( "$(this.promiser)" );
      
            "/tmp/this.promiser/edit_template_string.txt"
              create => "true",
              edit_template_string => "$(this.promiser)",
              template_method => "inline_mustache";
      
            "/tmp/this.promiser/content.txt"
              create => "true",
              content => "$(this.promiser)";
      
        reports:
            "CFEngine version: $(sys.cf_version)"; 
            "$(with) $(files)"  with => ifelse( regline( escape( $(files) ), $(files) ), "Pass", "FAIL" );
            "$(files) contains:" printfile => cat( $(files) ), unless => regline( escape( $(files) ), $(files) );
      }
      
      R: CFEngine version: 3.17.0
      R: FAIL /tmp/this.promiser/content.txt
      R: Pass /tmp/this.promiser/edit_template_string.txt
      R: Pass /tmp/this.promiser/edit_line.txt
      R: /tmp/this.promiser/content.txt contains:
      R: $(this.promiser)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel