Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-4648

Problem of indentation with epp()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.1.0
    • Fix Version/s: PUP 3.8.2, PUP 4.2.0
    • Component/s: DOCS, Language
    • Labels:
      None
    • Environment:

      I'm on Ubuntu Trusty (updated). I have followed the documentation for the installation of Puppet 4 server.

    • Template:
    • Story Points:
      1
    • Sprint:
      Language 2015-06-10
    • Release Notes:
      Bug Fix

      Description

      Hi,

      I have just tried the epp() function in a basic module with this code:

      class test {
        file { '/tmp/a':
          ensure  => present,
          content => epp('test/foo.epp', { 'a'=> '1234', 'b' => '5678',}),
        }
      }
      

      Here is my embedded puppet template foo.epp:

      <%- |$a, $b| -%>
      blabla blabla
      blabla blabla
        Should be indented
        Should be indented <%= $a %>
        Should be indented <%= $b %>
      blabla blabla
      blabla blabla
      

      After a puppet run (directly on my puppet server), here is the content of the /tmp/a file:

      blabla blabla
      blabla blabla
      Should be indented
      Should be indented 1234
        Should be indented 5678
      blabla blabla
      blabla blabla
      

      I have 2 lines which should be indented but this not the case.

      Rq: if I remove the first line of the template (ie the declaration of the template's parameter), the indentation is correct.

      UPDATE

      This was caused by several factors; the specification was vague and the implementation was not correct. This led to the problem reported here (loosing expected indentation). In general the trimming operations removed too much whitespace (on lines it should not touch). The specification has been updated with clearer rules. Basically:

      • A right trim tags trims trailing whitepace at most up to and including a line break on the same line as the end (right trimming) tag
      • A left trim tag trims leading whitepsace at most up to, but not including a line break on the same line as the opening (left trimming) tag
      • A comment tag is always left trimming

      The fix for this ticket (problem with indentation) makes the implementation compliant with the specification.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  flaf Francois Lafont
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: