As a follow up note to the list, I simply couldn't get this to work
properly so I just dropped something in the 'initialize' define that
paws through the catalog and finds any matches that conflict.

I then throw an error as stolen from the resource type.

It would, however, be quite nice to be able to have composite vars be
a bit more flexible in a user-friendly way.

Something like:

composite_match => [:foo, :bar, :baz]

which would happen *after* the defaultto's are set.

Thanks,

Trevor

On Mon, Sep 10, 2012 at 10:07 AM, Trevor Vaughan <[email protected]> wrote:
> All,
>
> Is it possible to use default values in a composite namevar?
>
> I'm having a heck of a time making it work properly.
>
> I tried:
>
> def self.title_patterns
>     [
>       [
>         /^(.*)$/,
>        [
>           [:path, lambda{|x| x }],
>           [:function, lambda{|x| x }]
>         ]
>       ]
>     ]
>     end
>
> newparam(:name) do
> end
>
> newparam(:path) do
>   isnamevar
>   defaultto('/some/random/path')
> end
>
> newparam(:function) do
>   isnamevar
> end
>
> I'm having two issues with this. First, Puppet *really* wants :name to
> be a namevar. I don't care what it is but if 'path' and 'function' are
> the same in two resources, then the resource declaration should fail.
> I don't mind making 'path' the 'name' equivalent, but Puppet treats
> that as a duplicate resource no matter what I do.
>
> The second issue is that the code simply won't recognize the default
> value for :path and I don't want to have to type out the path every
> time for the obvious reasons.
>
> Puppet 2.7.17
>
> Any help would be appreciated.
>
> Thanks,
>
> Trevor
> --
> Trevor Vaughan
> Vice President, Onyx Point, Inc
> (410) 541-6699
> [email protected]
>
> -- This account not approved for unencrypted proprietary information --



-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
[email protected]

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en.

Reply via email to