Issue #13429 has been updated by Chris Price.
An update with respect to Faces: I'd mentioned the idea of switching this code over to use Faces instead of accessing the Puppet::Resource class / indirector directly. However, as it turns out, the same obstacles that needed to be addressed in order to support the use of Faces here (namely: the initialization of settings) also allow the existing code to work as-is. It could easily be ported to Faces (basically just replace all mentions of Puppet::Resource.indirection with Puppet::Face[:resource, '0.0.1']), but I didn't see the immediate advantage. It would cause even more backward-compatibility issues, and didn't seem to buy us much. Once we've got a well-documented official stance on what constitutes the "Public API" for using Puppet as library code from within internal tools, I'd definitely be in favor of taking the backward-compatibility hit to port things over to use it. However, after recent discussions, I'm not sure that we've actually reached that point yet. ---------------------------------------- Bug #13429: Puppet::Resource fails when used from scripts https://projects.puppetlabs.com/issues/13429#change-61434 Author: Matt Robinson Status: In Topic Branch Pending Review Priority: Normal Assignee: Chris Price Category: Target version: Telly Affected Puppet version: Keywords: Branch: https://github.com/puppetlabs/puppet/pull/710 Something changed in the master branch in commit:e465c160d6d6c592a86aba2db74c5c9e5cb0ecab that broke the way mcollective's puppetral agent uses Puppet::Resource. It used to be the following would work to create a puppet resource: require 'puppet' Puppet.settings.parse resource = Puppet::Resource.new('file', '/tmp/blahd', :parameters => { :ensure ='present', :content => "blahd" }) result, report = Puppet::Resource.indirection.save(resource) Now running that gets the following error: /Users/matthewrobinson/work/puppet/lib/puppet/util/settings.rb:838:in `value': Error converting value for param 'statedir': Could not find value for $vardir (Puppet::SettingsError) from /Users/matthewrobinson/work/puppet/lib/puppet/util/settings.rb:50:in `[]' from /Users/matthewrobinson/work/puppet/lib/puppet.rb:65:in `[]' from /Users/matthewrobinson/work/puppet/lib/puppet/util/storage.rb:47:in `load' from /Users/matthewrobinson/work/puppet/lib/puppet/resource/catalog.rb:130:in `apply' from /Users/matthewrobinson/work/puppet/lib/puppet/indirector/resource/ral.rb:30:in `save' from /Users/matthewrobinson/work/puppet/lib/puppet/indirector/indirection.rb:271:in `save' from /Users/matthewrobinson/resource.rb:4 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
