Issue #4657 has been updated by Paul Berry.

Status changed from Accepted to Ready for Testing
% Done changed from 0 to 100
Branch set to http://github.com/stereotype441/puppet/tree/ticket/next/4657

Changed the resource type API to create AST objects rather than directly 
instantiating resource types.  This allows the same code paths to be used to 
handle the results of parsing both .pp and .rb files.  This makes .rb files 
work properly in multiple environments, because the types are now instantiated 
by code that is aware of which environment the compilation is happening in.  It 
also reduces the risk of future changes breaking .rb file support.

Also, switched to using "instance_eval" rather than "require" to evaluate the 
contents of the .rb file.  This ensures that if the file has to be recompiled 
(because it became stale), it will actually get re-evaluated.  As a side 
benefit, ResourceTypeAPI is now a class rather than a mixin to Object, so its 
methods do not pollute the global namespace.

To reduce the risk of customers coming to rely on implementation details of the 
resource type API, changed its methods to return nil, and removed methods from 
it that were misleadingly labeled as "private".
----------------------------------------
Bug #4657: Customer-supplied .rb files are not compatible with multiple 
environments or staleness check
http://projects.puppetlabs.com/issues/4657

Author: Paul Berry
Status: Ready for Testing
Priority: Normal
Assignee: Paul Berry
Category: 
Target version: Statler
Affected version: 2.6.1rc3
Keywords: 
Branch: http://github.com/stereotype441/puppet/tree/ticket/next/4657


When a customer supplies a .rb file in place of a .pp file, the .rb file is 
executed using Kernel#require, and the ResourceTypeAPI dumps the created 
resources into the default environment's known_resource_types.  This has two 
negative effects:

(1) if there are multiple environments, then customer-supplied .rb files will 
only work within the default environment.

(2) if .pp files become stale (triggering a recompile), the customer-supplied 
.rb files won't be reloaded, because Kernel#require only executes each Ruby 
file once.


-- 
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.

Reply via email to