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

alter parser to throw an error on use of an undefined, unquoted, variable.

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:

      Description

      Currently, the parser treats the following cases as equivalent:

      <pre>

      file

      {"/tmp/testfile": content => $content }

      file

      {"/tmp/testfile": content => "$content" }

      </pre>

      I think it would be beneficial to throw a compile error in the first case if $content is not defined, eg fail('Attempt to use unquoted, undefined variable $content'). This would sensibly catch many cases where I have:

      • typo'd on variable names,
      • misjudged scoping,
      • forgotten to define a variable that I am using in a defined type,
      • broken a facter fact.

      The second form provides a means for people to continue with the current logic of 'all variables are an empty string if undefined' for such things as 'if "$myvar"' statements.

      Anyway, please feel free to tell me that this ain't gonna happen, just wanted to throw it out there...

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                redmine.exporter redmine.exporter
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: