Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider not using ensure_resource in system_user.pp #50

Merged
merged 1 commit into from Aug 18, 2014

Conversation

eefahy
Copy link

@eefahy eefahy commented Aug 4, 2014

As puppet compiles resources in a non ordered way, I'm getting a duplicate declaration failure when adding system users. I believe this is because the ensure_resource line is being compiled into the catalog before my user resource is. Since user creation most likely happens outside of this module, is it perhaps more generally useful to revert back to something like:

if ! defined(User[$name]) {
  user { $name:
  ensure => present;
}

@carlossg
Copy link
Member

carlossg commented Aug 1, 2014

Actually that code causes exactly the same problem, you'd need to make sure the user is created before defining the rvm module.

@TJM
Copy link

TJM commented Aug 1, 2014

Yes, that is exactly what "ensure_resources()" does https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/parser/functions/ensure_resource.rb#L38

The problem is likely somewhere else you have the same user defined without being wrapped in "ensure_resources()" or "if !defined"

~tommy

@eefahy
Copy link
Author

eefahy commented Aug 1, 2014

Yep, you're absolutely right. For us, require => User[$name] within the rvm-system-user-${name} exec block gets us where we want to be.

I see that I either need to change my user resource to include a before => Rvm[$system_user::name] or...

What if there was a $create_system_user param (similar to $install_dependencies) for init.pp that gets passed to system_user.pp? That way I let the rvm module really only handle rvm oriented actions rather than attempting it to create user accounts for me.

@carlossg
Copy link
Member

carlossg commented Aug 2, 2014

rvm::system_user is not called by default
If you want to add a $create param to rvm::system_user defaulting to true, that sounds good.

@carlossg carlossg merged commit 6cd1716 into voxpupuli:maestrodev Aug 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants