On Wed, 24 Apr 2013 23:05:13 -0700 (PDT)
Chuck Dand <[email protected]> wrote:
> I've been trying to implement a custom type/provider in which I'd
> like to use composite namevars. From what I can find support for
> composite namevars when using self.prefetch in the provider is a
> little bit rough at the current time.
> [...]
> I've successfully managed to create the necessary self.title_patterns
> and with that I am able to create the resources with both 'puppet
> resource' and via a normal manifest. However once the item is created
> Puppet can't seem to determine that the resource already exists and
> tries to create it again. I'm presuming this is related to the fact
> there are multiple key_attributes.
>
> The design of my type/provider has very much styled upon that
> described in Dan Bode & Nan Liu's book 'Puppet Types and Providers'
No, the issues are not resolved. The most common prefetch method is
def self.prefetch(resources)
instances.each do |prov|
if resource = resources[prov.name]
resource.provider = prov
end
end
end
and relies on the fact that puppet will pass a hash of resources with
the resource's name as the key. In case where name is not unique
anymore (because only the combination of the parameters "name" and
"rule" are unique) you will not be able to access all resources. This
is tracked as #5605 and is still open (e.g. non of the code has been
merged in because it raised other issues)
Second problem: If you run "puppet resource
zbx_template_discoveryrule", puppet has to come up with a resource
title for each resource. So if puppet detects a resource with
template="Cisco Controller" and rule="APs" there needs to be a way to
create a unique title for that. I am not sure if there already is a
ticket for that but Dan worked on it by introducing a `namevar_join`
method and is in one of your quotes google discussions. It has never
been merged though.
I guess the master ticket is: http://projects.puppetlabs.com/issues/7629
Having composite namevars just work is definitly something I'd like to
see in the future and I've rebased my old port type on current master
as a first step. The integration tests still fail of course but I hope
I'll find some time in the future to actually work on the issue. This
doesn't mean that you cannot come up with a solution as well ;-)
-Stefan
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.