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

Add a validate method to Puppet::Node::Environment so the Compiler can easily halt for environments with bad configuration.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.7.1
    • Fix Version/s: PUP 4.0.0
    • Component/s: Compiler
    • Labels:
      None
    • Template:
    • Story Points:
      2
    • Sprint:
      Platform 2014-10-15

      Description

      There are various cases where an environment's final configuration may end up being invalid. One case, where an environment may have conflicting manifest settings, is already covered by a Puppet::Node::Environment#conflicting_manifest_settings? method, added in PUP-3069. Another case brought up by PUP-3162 has to do with base environment settings like environmentpath or basemodulepath having been set with a $environment in them. This interpolation was disallowed in PUP-3162, and we log a warning if it's encountered, but do not stop the master from initializing. As Kurt pointed out in PUP-3162, this can lead to an agent run looking like the following:

      # puppet apply -e 'notify { $environment: }' --environment nonesuch --debug
      /usr/local/lib/site_ruby/1.9.1/puppet/application.rb:365:in `run': Could not find a directory environment named 'nonesuch' anywhere in the path: /etc/puppet/environments/$environment. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
      	from /usr/local/lib/site_ruby/1.9.1/puppet/util/command_line.rb:146:in `run'
      	from /usr/local/lib/site_ruby/1.9.1/puppet/util/command_line.rb:92:in `execute'
      	from /usr/bin/puppet:8:in `<main>'
      

      While it's true that the environment can't be found, the message is confusing if the user is expecting that path to interpolate.

      It would be better to make a general Puppet::Node::Environment#valid? method that handles the conflicting_manifests_settings? check, the interpolation cases, and which can be expanded as needed for other environment tests in the future.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              joshua.partlow Joshua Partlow
              QA Contact:
              Kurt Wall
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support