Bug #1872
closedPuppet and foreman 3.0 Do not play well together
Description
Initial error with current nightly build and latest rc of puppet 3.0
puppet/settings.rb:263:in `convert': Error converting value for param 'hostcert': Error converting value for param 'certdir': Error converting value for param 'ssldir': Could not find value for $confdir (Puppet::Settings::InterpolationError)
Added the following line into foreman/default_settings_loader.rb in method load
Puppet.settings.initialize_global_settings(['--config=/etc/puppet/puppet.conf'])
Removed
Puppet.parse_config from config/initializers/puppet.rb
which results in the current error :-
foreman/app/models/archlinux.rb:1:in `const_missing': uninitialized constant Operatingsystem (NameError)
Files
Updated by Sam Kottler about 12 years ago
- Status changed from New to Assigned
- Assignee set to Sam Kottler
There is another issue - the HostObserver constant is uninitialized when using Puppet3. Here is the output - https://gist.github.com/a2002894b0d3cabc93ca. The command succeeds when puppet 2.7.19 is used.
Updated by Colin Hudler about 12 years ago
Aside from the minor config initialization problem as reported initially, I believe the later problem is caused by this change in puppet <https://github.com/puppetlabs/puppet/commit/6ab192f1c1ff643d095c9c8819ecef3f54d737f7>.
Foreman/rails seems to work normally for me after removing the line ActiveSupport::Dependencies.unhook!
Puppet wants to shut down the Rails autoloader apparently for performance reasons, which leads directly to this problem in foreman. Roughly, it is executed down through Rails -> initializers/puppet.rb -> puppet/rails -> Puppet.features.rails? -> load(feature/rails) -> BOOM.
Updated by Colin Hudler about 12 years ago
Colin Hudler wrote:
Aside from the minor config initialization problem as reported initially, I believe the later problem is caused by this change in puppet https://github.com/puppetlabs/puppet/commit/6ab192f1c1ff643d095c9c8819ecef3f54d737f7.
Foreman/rails seems to work normally for me after removing the line ActiveSupport::Dependencies.unhook!
Puppet wants to shut down the Rails autoloader apparently for performance reasons, which leads directly to this problem in foreman. Roughly, it is executed down through Rails -> initializers/puppet.rb -> puppet/rails -> Puppet.features.rails? -> load(feature/rails) -> BOOM.
Updated by Colin Hudler about 12 years ago
- File 3_0-hack.patch 3_0-hack.patch added
Attached is a dirty thing that I used to work around it for now. A saner fix is probably possible, however. It still does require call to Puppet.settings.initialize_global_settings at some early point, as OP suggested. Hope this helps.
Same thing also in http://pastie.org/4898077 (sans needless require)
Updated by Gordon Irving about 12 years ago
just confirmed the hack coupled with the Puppet.settings.initialize_global_settings hack has got foreman started up and running again with puppet 3.0
Updated by Sam Kottler about 12 years ago
- Status changed from Assigned to Feedback
- Priority changed from Normal to High
I've opened a pull request with the necessary changes at https://github.com/theforeman/foreman/pull/166. Thanks for the feedback, everyone!
Updated by Sam Kottler about 12 years ago
- Category set to Puppet integration
- Target version set to 1.1
Tagging for 1.1.
Updated by Frederik Nosi about 12 years ago
Same issue here.
I'm using WEBrick for puppetmaster as it's a testing install. Even after applying the 3 patches from the pull request i get the same error:
[root@test foreman]# /etc/init.d/foreman start
Starting foreman: ]Libvirt binding are missing - hypervisor management is disabled
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
/usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:252:in `convert': Error converting value for param 'hostcert': Error converting value for param 'certdir': Error converting value for param 'ssldir': Could not find value for $confdir (Puppet::Settings::InterpolationError)
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `gsub'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `convert'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:971:in `value'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:249:in `convert'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `gsub'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `convert'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:971:in `value'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:249:in `convert'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `gsub'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `convert'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:971:in `value'
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:66:in `[]'
from /usr/share/foreman/lib/foreman/default_settings/loader.rb:45:in `load'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
from /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.15/lib/active_record/transactions.rb:207:in `transaction'
from /usr/share/foreman/lib/foreman/default_settings/loader.rb:31:in `load'
from /usr/share/foreman/config/initializers/foreman.rb:4
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:236:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:236:in `load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:227:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:236:in `load'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/engine.rb:201
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/engine.rb:200:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/engine.rb:200
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:25:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:50:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:49:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:134:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:77:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.15/lib/rails/application.rb:77:in `method_missing'
from /usr/share/foreman/config/environment.rb:5
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:242:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:242:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:597:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.15/lib/active_support/dependencies.rb:242:in `require'
from /usr/share/foreman/config.ru:3
from /usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/builder.rb:46:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.2.5/lib/rack/builder.rb:46:in `initialize'
from /usr/share/foreman/config.ru:1:in `new'
from /usr/share/foreman/config.ru:1
[FAILED]
Any ideas?
Thanks,
Frederik
Updated by Sam Kottler about 12 years ago
Frederik,
Can you try running `ln -s /etc/puppet /home/foreman/.puppet` and see if foreman will then boot properly? This problem is caused by a change that causes non-root users to load ~/.puppet to look for puppet.conf.
Updated by Frederik Nosi about 12 years ago
foreman's home in my installation (RH 5.8, foeman's yum repo) is at /usr/share/foreman, so i linked the directory this way:
[root@test foreman]# grep foreman /etc/passwd
foreman:x:101:104:Foreman:/usr/share/foreman:/sbin/nologin
foreman-proxy:x:52:156:Foreman Proxy deamon user:/usr/share/foreman-proxy:/sbin/nologin
[root@test foreman]# ln -s /etc/puppet /usr/share/foreman/.puppet
But i get the same error:
[root@test foreman]# /etc/init.d/foreman start
Starting foreman: Libvirt binding are missing - hypervisor management is disabled
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
/usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:252:in `convert': Error converting value for param 'hostcert': Error converting value for param 'certdir': Error converting value for param 'ssldir': Could not find value for $vardir (Puppet::Settings::InterpolationError)
from /usr/lib/ruby/site_ruby/1.8/puppet/settings.rb:243:in `gsub'
[...]
Just to be sure, i tried checking which puppet configuration directory gets checked during foreman's start this way:
[root@test foreman]# strace -fe file -o /tmp/asd /etc/init.d/foreman start
[ommitting the start error which is the same as before]
[root@test foreman]# grep '\.puppet' /tmp/asd
32758 stat("/usr/share/foreman/.puppet/puppet.conf", {st_mode=S_IFREG|0644, st_size=1156, ...}) = 0
32758 open("/usr/share/foreman/.puppet/puppet.conf", O_RDONLY) = 4
Maybe i'm missing for real some setting in /etc/puppet/puppet.conf ?
Thanks in advance,
Frederik
Updated by Frederik Nosi about 12 years ago
Another info, i tried both with the patch and without with the same result.
Thanks for your reply,
Frederik
Updated by Greg Sutcliffe about 12 years ago
Make sure you don't have any variables ($foo) in your puppet.conf - the parser is broken. Replace them with explicit data. E.g replace $vardir with /var/lib/puppet and so on
Updated by Frederik Nosi about 12 years ago
Hi Greg,
that was it! Thanks!
IMHO it'll save time to others adding this info in the wiki / documentation, i'll look into this (not sure i can modify the pages).
Frederik
Updated by Sam Kottler about 12 years ago
This certainly isn't a permanent solution to the issues so hopefully the upstream configuration loader will get fixed soon and then normal variable interpolation will work once again.
Updated by konrad rzentarzewski about 12 years ago
does it have corresponding ticket in puppet's redmine?
Updated by Daniel Gagnon about 12 years ago
Report processing sometimes fails:
Started POST "/reports/create?format=yml" for 10.100.130.10 at Thu Nov 08 01:48:22 -0500 2012
Processing by ReportsController#create as YML
Parameters: {"report"=>"[FILTERED]"}
User Load (0.1ms) SELECT `users`.* FROM `users` WHERE `users`.`login` = 'admin' LIMIT 1
Setting current user thread-local variable to admin
processing report for c3wb10tag.globalserveur.com
Host Load (0.7ms) SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`certname` = 'c3wb10tag.globalserveur.com' LIMIT 1
Failed to process report for c3wb10tag.globalserveur.com due to:undefined method `[]' for nil:NilClass
Rendered text template (0.0ms)
Completed 500 Internal Server Error in 6ms (Views: 0.9ms | ActiveRecord: 0.9ms)
Updated by Daniel Gagnon about 12 years ago
Trace: http://pastebin.com/SCbcFDFP
Updated by Greg Sutcliffe about 12 years ago
@dgangon I think I've found the problem with the report processing, and my workaround has been merged into 166 - can you give it a try?
Updated by Ohad Levy about 12 years ago
- Target version changed from 1.1 to Bug scrub
Updated by Sam Kottler about 12 years ago
- Status changed from Feedback to Closed
- % Done changed from 0 to 100
Applied in changeset e81bf0573125fa569e35f991df451cb9e4e8a948.