[Puppet Users] Virtual resources and hashes

2011-06-07 Thread Aaron Grewell
Hmmm, either I'm doing something wrong or virtual resources are incompatible
with hashes.

When I do this:
$users = [{ username => "bill", uid => "12345" },
 { username => "ted",  uid => "12346" }]

define usertest ($alias = $name[username]) {
user {$name[username]:
ensure => present,
uid=> $name[uid]
}
}
@usertest { $users: }
realize Usertest[bill]

I get this:
warning: alias is a metaparam; this value will inherit to all contained
resources
Failed to realize virtual resources Usertest[bill] on node

Which seems unfortunate.  Hash support is a really cool idea but I keep
tripping over parts of Puppet that don't handle it well.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Virtual resources and hashes

2011-06-08 Thread Randall Hansen
On Tue, Jun 7, 2011 at 4:15 PM, Aaron Grewell  wrote:

> $users = [{ username => "bill", uid => "12345" },
>  { username => "ted",  uid => "12346" }]

Aaron, I think this is a completely sane request.  We've talked about
it before, but I can't find an existing ticket.  This one seems close,
but very old; will you take a look?
http://projects.puppetlabs.com/issues/1858

If we can work out a good syntax we'll put this on the roadmap.  I
know some of our PS guys are eager for it, too.

r

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Virtual resources and hashes

2011-06-08 Thread Aaron Grewell
The request in the ticket is related but might not solve the same problem.
What I think I'm looking for is the generic ability to specify an array of
hashes as a resource title and have Puppet handle it intelligently (that is,
produce a locally scoped hash split from the array and easily accessible
inside the resource specification as well as knowing what value it should
use for $name or supporting e.g. $alias => hash[key] for specifying the
appropriate value).  The reason I think that's preferable to the ability to
transform a hash to a resource is because it will work everywhere.  What I
don't know is whether the hash -> resource transform can be made to declare
an instance of a define().  If so, it would handle my needs quite well.  If
OTOH it will only declare native resource types then it won't do all of what
I'm looking for.  It would be a step in the right direction though.

On Wed, Jun 8, 2011 at 10:17 AM, Randall Hansen wrote:

> On Tue, Jun 7, 2011 at 4:15 PM, Aaron Grewell 
> wrote:
>
> > $users = [{ username => "bill", uid => "12345" },
> >  { username => "ted",  uid => "12346" }]
>
> Aaron, I think this is a completely sane request.  We've talked about
> it before, but I can't find an existing ticket.  This one seems close,
> but very old; will you take a look?
> http://projects.puppetlabs.com/issues/1858
>
> If we can work out a good syntax we'll put this on the roadmap.  I
> know some of our PS guys are eager for it, too.
>
> r
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.