Issue #2285 has been reported by James Turnbull.

----------------------------------------
Refactor #2285: Improved Resource Identification
http://projects.reductivelabs.com/issues/2285

Author: James Turnbull
Status: Needs design decision
Priority: Normal
Assigned to: Luke Kanies
Category: 
Target version: unplanned
Affected version: 0.24.8


Puppet currently uses what is known as the namevar to uniquely identify 
resources, so you don't try to manage twice the same resource in the same 
manifest. For example, in the case of files, the whole path of the file acts as 
the namevar, so if you include two file resources with the same path in a 
manifest puppet will abort showing an error.

This is not enough, as in certain cases the namevar parameter doesn't uniquely 
identify a resource. For example, in Gentoo you may have two different packages 
with the same name under different categories (dev-java/ant and app-vim/ant or 
app-admin/sudo and app-vim/sudo, to name a few), so you wouldn't be able to 
install both those packages with puppet, as it would think they are the same 
one.
Proposed solution

Some changes have to be made in order to use puppet to handle such resources. 
Here they are:
Compound keys

A compound key is a key that consist of two or more attributes. In the case of 
puppet, types should be able to define which set of parameters form their key 
to uniquely identify a resource, so you may have resources identified with a 
set of parameters instead of a single parameter. For example, in the case of 
packages, you may have that {category, name} uniquely identifies a package.
Per provider specific parameters

Although at first it may seem this is not directly related to the problem of 
improved resource identification, it's an important part of the solution.

Puppet tries to abstract away from the implementation details, and in the 
abstraction process there are some bits of information that are lost: you 
cannot intend to create a type with parameters for all the possible 
implementation details for that type out there. So sometimes you find that you 
can't access some key functionality in your system because the puppet type 
doesn't take into account all those implementation details. For example, there 
are lots of parameters in package managers you can't access using puppet, as it 
would be unmanageable to have a type with every imaginable parameter from every 
imaginable package manager.

Anyway, as there is the need to access some of that functionality, some puppet 
types currently have some parameters that are applicable only to some provider. 
As we can't expect to have every parameter for every type provider in the type, 
we should follow another path: per provider specific parameters.

In this case, a provider should be able to define its own set of parameters, so 
we would be able to access functionality for that specific provider without the 
need to add parameters to the generic type, that would still handle the basic 
aspects of the resource.
Addition of per provider specific parameters to compound keys

The concept of unique resources may change from platform to platform (from 
provider to provider in puppet's terminology). For example, Gentoo has what is 
known as slotted packages: you may have Apache 1 and 2 installed in the same 
system, with different sets of configuration files, just in case you need to 
run both version of the package. While in other platforms the package Apache 
would be uniquely identified by its name, in Gentoo you would need an 
additional attribute to identify it (slot in this case), so a package resource 
in Gentoo is uniquely identified by the tuple {category, name, slot}.

It's clear that slot is specific to the Gentoo platform and the portage 
provider, so providers should be able to add some of its parameters to the key 
of the corresponding type, so they can tweak the concept of oneness.



-- 
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://reductivelabs.com/redmine/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