Project

General

Profile

Bug #1915

Proxy with puppet3 causes global load errors

Added by Greg Sutcliffe over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Puppet
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

If you curl the environment api call more than once, you get this:

root@installer:~# curl http://localhost:8445/puppet/environments
["development","production"]
root@installer:~# curl http://localhost:8445/puppet/environments
Failed to list puppet environments: Attempting to initialize global default settings more than once!

This seems to be a pupet3 thing, there is some data on puppet-dev that might help...

Associated revisions

Revision ff16a263 (diff)
Added by Dominic Cleal over 6 years ago

fixes #1915 - initialise Puppet in master context

Explicitly specify the run_mode as being 'master' to ensure the config is
parsed in a puppetmaster context.

Revision a07f4bd0 (diff)
Added by Dominic Cleal over 6 years ago

fixes #1915 - load environments from Puppet 3

Two changes to support loading environment settings from Puppet 3:

  • explicitly specify the run_mode as being 'master' to ensure the config is
    parsed in a puppetmaster context
  • call private method to fully clear the state in Puppet::Settings allowing for
    a full reparsing of the config to pick up changes in environments (Puppet bug
    #17783)

History

#1 Updated by Sam Kottler over 6 years ago

I can pull this in as part of the puppet 3 work I'm doing. Can you provide a link to the puppet-dev email?

#2 Updated by Daniel Gagnon over 6 years ago

Hi,

I am in the process of getting Foreman to work with puppet3 on Debian squeeze.

For this particular problem, here is what I did:

/usr/share/foreman-proxy/lib/proxy/puppet/environment.rb => replace "Puppet.parse_config" with:
if $isLoaded == nil
puts "loading"
Puppet.settings.initialize_global_settings(['--config=/etc/puppet/puppet.conf'])
$isLoaded = true
else
puts "already loaded"
end

also add the snippet inside the load method of /usr/share/foreman/lib/foreman/default_settings/loader.rb

Last thing is to remove Puppet.parse.

Hope it works for you.

#3 Updated by Sam Kottler over 6 years ago

  • Assignee changed from Greg Sutcliffe to Sam Kottler

#4 Updated by eric sorenson over 6 years ago

This is the puppet-dev thread: https://groups.google.com/d/topic/puppet-dev/Yk0WC1JZCg8/discussion

Chris Price's post there is valuable because he suggests that the entry point `Puppet.initialize_settings` is the simplest / most accessible method to call, but it implies a `:user` run-mode. If that's not what you want (because that would skip settings in the `[master]` section of the config file), my suggestion from tracing through this yesterday would be to do :

Puppet.settings.initialize_global_settings(['--config=/etc/puppet/puppet.conf', '--run_mode=master'])

The puppet platform devs are planning to get this cleaned up and documented for 3.1; we are sorry for the churn on it but several band-aid attempts caused bad follow-on effects so it's getting a properly engineered solution.

#5 Updated by Carlos Aguado over 6 years ago

After applying the change on Puppet.parse_config to

Puppet.settings.initialize_global_settings(Puppet[:config]) unless Puppet.settings.global_defaults_initialized?

had to comment out
#Puppet.clear

#6 Updated by Dominic Cleal over 6 years ago

  • Category set to Puppet
  • Status changed from New to Assigned
  • Assignee changed from Sam Kottler to Dominic Cleal

Two pulls to address this, the main one being for the smart proxy, but related was one in foreman itself:

Thanks for the suggestion Eric, that helped solve the problems seen initialising some basic settings such as confdir and vardir when the run_mode wasn't specified. I've worked around #17492 with --run_mode and also fixed the original bug report here with a hack until a public interface is added in Puppet 3.1 to enable full reparsing of the config (#17783).

#7 Updated by Ohad Levy over 6 years ago

  • Target version set to 1.1

#8 Updated by Dominic Cleal over 6 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:"ff16a263433c5f3202b81663ba9a6745dd11a047".

Also available in: Atom PDF