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

regsubst doesn't work on empty arrays in puppet 4.x

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.2.2
    • Fix Version/s: PUP 4.3.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Language 2015-10-14, Language 2015-10-28
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Type system did not recognize an empty array as an acceptable value where a array with a specified subtype was declared. This caused certain calls to be reported as being given the wrong type(s) of arguments - e.g. a regsubst function call operating on an empty array.
      Show
      Type system did not recognize an empty array as an acceptable value where a array with a specified subtype was declared. This caused certain calls to be reported as being given the wrong type(s) of arguments - e.g. a regsubst function call operating on an empty array.

      Description

      regsubst gives an error about being called with the wrong type if you give it an empty array of strings to do substitutions on. This used to work in Puppet 3.x.

      $ puppet apply -e 'notice(regsubst([],"",""))'
      Error: Evaluation Error: Error while evaluating a Function Call, function 'regsubst' called with mis-matched arguments
      expected one of:
        regsubst(Variant[Array[String], String] target, String pattern, String replacement, Optional[Pattern[/^[GEIM]*$/]] flags?, Enum['N', 'E', 'S', 'U'] encoding?) - arg count {3,5}
        regsubst(Variant[Array[String], String] target, Variant[Regexp, Type[Regexp]] pattern, String replacement, Pattern[/^G?$/] flags?) - arg count {3,4}
      actual:
        regsubst(Array[Undef], String, String) - arg count {3}  at line 1:8 on node valentina.local
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dalen Erik Dalén
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support