Issue #4716 has been updated by James Turnbull.

Status changed from Closed to Ready for Testing


----------------------------------------
Bug #4716: ResourceTypeAPI exposes implementation details that are likely to 
change
http://projects.puppetlabs.com/issues/4716

Author: Paul Berry
Status: Ready for Testing
Priority: Normal
Assignee: Paul Berry
Category: API
Target version: 2.6.2
Affected version: 2.6.0
Keywords: 
Branch: http://github.com/stereotype441/puppet/tree/ticket/2.6.x/4716


The ResourceTypeAPI (which provides methods for customers to create manifests 
in .rb files) creates opportunities for customers to access Puppet internals:

(a) the "define", "hostclass", and "node" methods return the internal Puppet 
object for the resource type that was created.

(b) the "mk_resource_type" and "munge_type_arguments" methods, which were 
intended to be private, are not actually private because the ResourceTypeAPI is 
mixed in to Object, making them callable from anywhere.

If a customer were to inadvertently become dependent upon these internals, it 
would make it difficult to make changes to the ResourceTypeAPI in the future 
(such as the changes required to fix issue #4657).

In addition, since the methods of ResourceTypeAPI are mixed into Object, it is 
possible for customers to call them from within their own classes and modules, 
and from within other files that they import using "require".  If customers 
were to start relying on this behavior, this would also limit our ability to 
make changes to the ResourceTypeAPI in the future.

All of these concerns are addressed by the fix to #4657.  However, for 2.6, it 
would be nice to patch the ResourceTypeAPI to avoid future incompatibility.  I 
believe we could make a low-risk patch for 2.6 that did the following things:

(1) return nil from "define", "hostclass", and "node".

(2) rename "mk_resource_type" and "munge_type_arguments" to 
"`__mk_resource_type__`" and "`__munge_type_arguments__`" to discourage 
customers from calling them.

(3) Make ResourceTypeAPI a class rather than a module, and evaluate the 
contents of pure ruby manifests using a instances of this class.

As a side benefit, (3) would partially fix issue #4657 for 2.6, by making pure 
ruby manifests compatible with staleness checks.


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