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

error running puppet with non existing and non default environment

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • PUP 4.3.2
    • None
    • None
    • None

    Description

      Running:

      puppet facts --environment=test
      

      throws the following error if the environment directory don't exists:

      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'test' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
      

      But if you remove /etc/puppetlabs/code/environments/production it still works for production because in puppet.rb a basic default environment is only created if the environment is named production:

            # in case the configured environment (used for the default sometimes)
            # doesn't exist
            default_environment = Puppet[:environment].to_sym
            if default_environment == :production
              loaders << Puppet::Environments::StaticPrivate.new(
                Puppet::Node::Environment.create(default_environment,
                                                 basemodulepath,
                                                 Puppet::Node::Environment::NO_MANIFEST))
            end
      

      I'm no expert on the puppet code, so I could miss something, but in my opinion a basic default environment should be created in every case.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vicinus Reinhard Vicinus
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support