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

Environment string matching in the parser seems broken

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: PUP 4.3.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:

      Description

      Using the following puppet code in puppet 4.3.2 the expectation that with the default environment of 'production' the conditional should match is not met, and the first notice doesn't happen. The second notice where environment is coerced to a string via interpolation does:

      notice("double colon environment ${::environment}")
      notice("environment ${environment}")
      $foo = inline_template("<%= @environment.inspect %>")
       
      notice("environment dot inspect '${foo}'")
       
      if $::environment == 'production' {
        notice('production - wooooo')
      }
      if "${::environment}" == 'production' {
        notice("man - you really shouldn't have to coerce me to make me do these things")
      }
      

      This seems to have been introduced by https://github.com/puppetlabs/puppet/commit/14b138a14740bb9b7931a050e822543a98ef02f6 according to my git bisect:

      spenceware:puppet fids$ bundle exec puppet apply -e 'notice(inline_template("<%= @environment.inspect %>"))'
      WARN: Unresolved specs during Gem::Specification.reset:
            facter (< 4, > 2.0)
            hiera (< 4, >= 2.0)
            json_pure (>= 0)
      WARN: Clearing out unresolved specs.
      Please report a bug if this causes problems.
      Notice: Scope(Class[main]): :production
      Notice: Compiled catalog for spenceware.amers2.ciscloud in environment production in 0.05 seconds
      Notice: Applied catalog in 0.44 seconds
      spenceware:puppet fids$ git bisect bad
      14b138a14740bb9b7931a050e822543a98ef02f6 is the first bad commit
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              fiddyspence Chris Spence
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support