Does create_resources support virtual resources?

399 views
Skip to first unread message

Aaron Grewell

unread,
Mar 30, 2012, 2:56:14 PM3/30/12
to puppet...@googlegroups.com
Hi all,
I'm interested pushing my user list out of my users manifest and into
Hiera. Unfortunately I haven't been able to get it to work the way I
thought it would. The error suggests that perhaps create_resources
cannot create virtual resources, but the docs I've read so far don't
address it.

The class (in init.pp):
class users {
$system_users = hiera('system_users')
$system_groups = hiera('system_groups')

create_resources("@users::mkuser",$system_users)
create_resources("@users::mkgroup",$system_groups)
} # class users

The define (in mkuser.pp):

define users::mkuser (
$uid,
$gid = undef,
$group = undef,
$shell = '/bin/bash',
$home = undef,
$ensure = 'present',
$managehome = true,
$dotssh = 'ensure',
$comment = 'created via puppet',
$groups = undef,
$password = undef,
$symlink = undef,
$mode = undef
) {
<SNIP>
}

The error:
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
could not create resource of unknown type @users::mkuser at
/etc/puppetlabs/puppet/configurations/se/environments/development/modules/users/manifests/init.pp:29

Is this the expected behavior, or have I missed something obvious?

Gary Larizza

unread,
Mar 30, 2012, 3:04:28 PM3/30/12
to puppet...@googlegroups.com
Create_resources doesn't support virtual users, but Hiera DOES support hash-merging, so it could find all users in all hierarchies with hiera_hash and then declare them at once. 
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.



--

Gary Larizza
Professional Services Engineer
Puppet Labs

Aaron Grewell

unread,
Mar 30, 2012, 4:10:19 PM3/30/12
to puppet...@googlegroups.com
Thanks Gary. I'll go figure out how that works. :)

> <javascript:;>.


> To unsubscribe from this group, send email to

> puppet-users...@googlegroups.com <javascript:;>.

Alex Harvey

unread,
Jun 14, 2017, 5:56:07 AM6/14/17
to Puppet Users


On Saturday, March 31, 2012 at 6:04:28 AM UTC+11, Gary Larizza wrote:
Create_resources doesn't support virtual users, but Hiera DOES support hash-merging, so it could find all users in all hierarchies with hiera_hash and then declare them at once. 

Presumably at some point this feature was added; create_resources does in fact now support virtual and exported resources:

It's also in the at least latest version of Puppet 3.
 
Reply all
Reply to author
Forward
0 new messages