Bug #1915
closedProxy with puppet3 causes global load errors
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...
Updated by Sam Kottler about 12 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?
Updated by Daniel Gagnon about 12 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.
Updated by Sam Kottler about 12 years ago
- Assignee changed from Greg Sutcliffe to Sam Kottler
Updated by eric sorenson about 12 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.
Updated by Carlos Aguado about 12 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
Updated by Dominic Cleal about 12 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).
Updated by Dominic Cleal about 12 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Applied in changeset commit:"ff16a263433c5f3202b81663ba9a6745dd11a047".