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

Invalid EPP: Syntax error at '|' when use hash in epp templates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Incomplete
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None
    • Template:
    • Method Found:
      Manual Test
    • QA Risk Assessment:
      Needs Assessment

      Description

      Im start to porting next code from erb template to epp:

      <%- if @mime_types -%>
       
      # Custom additional mime types
      <%- @mime_types.sort_by {|key,value| key}.each do |key,value| -%>
      <%= key %> <%= value %>;
      <%- end -%>
      <%- end -%>
      

      Next code return error "Invalid EPP: Syntax error at '|'":

      # mime.types.epp
      <%- | Hash[String, String] $nginx::config::mime_types | -%>
      <% include stdlib -%>
      <% $nginx::config::mime_types.keys.sort.each |$key| { -%>
          <%= $key %> <%= $nginx::config::mime_types[$key] %>
      <% } -%>
      

      manifests:

      # manifests/config.pp
      class nginx::config {
        $mimetypes=lookup('nginx::mimetypes')
        file { "${nginx::params::conf_dir}/mime.types":
          ensure  => file,
          content => epp("${module_name}/mime.types.epp"),
        }
      

      hiera:

      nginx::mimetypes:
        video/ogg: 'ogv'
      
      

      puppet version:

      #puppet --version
      5.0.1
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            beliy Alexander
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support