On Jun 7, 6:15 pm, Aaron Grewell <aaron.grew...@gmail.com> wrote: > Hmmm, either I'm doing something wrong or virtual resources are incompatible > with hashes.
I think it's a mix of about two parts "doing something wrong" to one part "incompatible", coming out to more or less "Puppet doesn't do what I wish it would." > 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. In a resource declaration, Puppet expects the value or variable preceding the colon ($users in your example) to be a resource title or an array of resource titles. I find it somewhat surprising that Puppet accepted your hash for the resource titles, but I suppose it flattens the hash into an ordinary array. It would be nice if that elicited at least a warning. Do not be confused by the similar DSL syntax: resource declarations are completely unrelated to hashes at the DSL level. I guess you hoped Puppet would unpack the hash into a resource title and properties, but it just doesn't, and I wouldn't expect it to do. John -- 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.