Skip to content

Commit

Permalink
Ensure user and group resources are defined
Browse files Browse the repository at this point in the history
It is still best to define these resources outside of RVM, but this
should make rvm::system_user work even if the user isn't previously
defined.
  • Loading branch information
blt04 committed Jan 21, 2012
1 parent 5752c16 commit 6f9fd71
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion manifests/definitions/system_user.pp
Expand Up @@ -5,8 +5,20 @@
default => 'rvm',
}

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

if ! defined(Group[$group]) {
group { $group:
ensure => present;
}
}

exec { "/usr/sbin/usermod -a -G $group $username":
unless => "/bin/cat /etc/group | grep $group | grep $username",
require => [User[$username], Exec['system-rvm']];
require => [User[$username], Group[$group]];
}
}

0 comments on commit 6f9fd71

Please sign in to comment.