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

edit_template_string should render a file exactly as edit_template and string_mustache do

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Rejected
    • Priority: (None)
    • Resolution: Done
    • Affects Version/s: 3.12.0
    • Fix Version/s: None
    • Component/s: Promise type: files
    • Labels:
      None
    • Complexity:
      S

      Description

      edit_template_string should render a template identically to string_mustache and edit_template.

      With 3.12.0 I find that using edit_template_string results in an empty file being created.

      Tests

      Tests: https://github.com/cfengine/core/pull/3300

      Note CONTENTS OF /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string is empty.

      It could be that there is an extra newline with report_to_file when testing string_mustache equivlence, but that can be accounted for in the test once edit_template_string is actually rendering content to the file.

      > $ cf-agent -KIf ./mustache_edit_template_string_vs_string_mustache.cf -DAUTO,DEBUG
      R: test description: Test that there is no difference when rendering the same
              mustache template with edit_template and edit_template_string
      R: /home/nickanderson/Northern.Tech/CFEngine/core/tests/acceptance/10_files/templating/edit_template_string/./../../../dcs.cf.sub SFAIL/CFE-2910
          info: Deleted file '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string'
          info: Deleted file '/tmp/TESTDIR.cfengine/pghba.conf-from-string_mustache'
          info: Created file '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string', mode 0600
      R: /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string
      R: /tmp/TESTDIR.cfengine/pghba.conf-from-string_mustache
      R: local    all    all        trust
      R: host    replication    all    primary-replication    trust
      R: host    replication    all    secondary-replication    trust
      R: 
      R: FILES DIFFER BUT SHOULD BE THE SAME
      R: CONTENTS OF /tmp/TESTDIR.cfengine/pghba.conf-from-string_mustache:
      local    all    all        trust
      host    replication    all    primary-replication    trust
      host    replication    all    secondary-replication    trust
      
      
      R: CONTENTS OF /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string:
      
      R: --- /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string	2018-10-03 12:50:55.265087539 -0500
      +++ /tmp/TESTDIR.cfengine/pghba.conf-from-string_mustache	2018-10-03 12:50:55.266087544 -0500
      @@ -0,0 +1,4 @@
      +local    all    all        trust
      +host    replication    all    primary-replication    trust
      +host    replication    all    secondary-replication    trust
      +
      R: /home/nickanderson/Northern.Tech/CFEngine/core/tests/acceptance/10_files/templating/edit_template_string/./mustache_edit_template_string_vs_string_mustache.cf FAIL
      
      
      R: /home/nickanderson/Northern.Tech/CFEngine/core/tests/acceptance/10_files/templating/edit_template_string/./../../../dcs.cf.sub SFAIL/CFE-2910
          info: Deleted file '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template'
          info: Deleted file '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string'
          info: Created file '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template', mode 0600
          info: Updated rendering of '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template' from mustache template '/home/nickanderson/Northern.Tech/CFEngine/core/tests/acceptance/10_files/templating/edit_template_string/./pghba.conf.mustache'
          info: Created file '/tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string', mode 0600
      R: /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template
      R: local    all    all        trust
      R: host    replication    all    primary-replication    trust
      R: host    replication    all    secondary-replication    trust
      R: /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string
      R: FILES DIFFER BUT SHOULD BE THE SAME
      R: CONTENTS OF /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template:
      local    all    all        trust
      host    replication    all    primary-replication    trust
      host    replication    all    secondary-replication    trust
      
      R: CONTENTS OF /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string:
      
      R: --- /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template_string	2018-10-03 12:52:17.571464604 -0500
      +++ /tmp/TESTDIR.cfengine/pghba.conf-from-edit_template	2018-10-03 12:52:17.570464600 -0500
      @@ -0,0 +1,3 @@
      +local    all    all        trust
      +host    replication    all    primary-replication    trust
      +host    replication    all    secondary-replication    trust
      R: /home/nickanderson/Northern.Tech/CFEngine/core/tests/acceptance/10_files/templating/edit_template_string/./mustache_edit_template_string_vs_edit_template.cf FAIL
      
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel