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

sprintf fails when using named format parameters

    Details

    • Template:
    • Epic Link:
    • Sub-team:
    • Team:
      Platform Core
    • Sprint:
      Platform Core KANBAN
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      It was not possible to use named format arguments when using {{sprintf}}. This is now possible using a hash with string to values as the argument to format.
      As an example:
      {code:puppet}
      notice sprintf("%<x>s : %<y>d", { 'x' => 'value is', 'y' => 42 })
      {code}
      would notice "value is : 42"
      Show
      It was not possible to use named format arguments when using {{sprintf}}. This is now possible using a hash with string to values as the argument to format. As an example: {code:puppet} notice sprintf("%<x>s : %<y>d", { 'x' => 'value is', 'y' => 42 }) {code} would notice "value is : 42"
    • QA Risk Assessment:
      No Action

      Description

      Puppet's documentation indicates that *sprintf * is using the same capabilities as ruby's one.

      But when I use in puppet the following call:

      sprintf("-o %{logdir}/stdout", { logdir => '/var/log/'})
      

      I end up with the following message:

      Error: Evaluation Error: Error while evaluating a Function Call, key{logdir} not found at /...
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              p094212 herbert koelman
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support