From b7fae4bde557809f0ea9bc6552e1932afd857d63 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 15 Nov 2018 23:44:28 -0500 Subject: simplify home directory handling --- modules/conf/manifests/user.pp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'modules/conf') diff --git a/modules/conf/manifests/user.pp b/modules/conf/manifests/user.pp index 564f121..4ca2f02 100644 --- a/modules/conf/manifests/user.pp +++ b/modules/conf/manifests/user.pp @@ -1,11 +1,5 @@ -define conf::user($user=$name, $home=undef) { - $_home = $home ? { - undef => $user ? { - 'root' => '/root', - default => "/home/$user", - }, - default => $home, - } +define conf::user($user=$name) { + $home = base::home($user) include conf @@ -21,11 +15,11 @@ define conf::user($user=$name, $home=undef) { exec { "git clone doy/conf for $user": command => "/usr/bin/git clone git://github.com/doy/conf", user => $user, - cwd => $_home, - creates => "$_home/conf", + cwd => $home, + creates => "$home/conf", require => [ User[$user], - File[$_home], + File[$home], Class['git'], ]; } @@ -33,12 +27,12 @@ define conf::user($user=$name, $home=undef) { exec { "conf make install for $user": command => "/usr/bin/make install", user => $user, - cwd => "$_home/conf", + cwd => "$home/conf", environment => [ - "HOME=$_home", - "PWD=$_home/conf", + "HOME=$home", + "PWD=$home/conf", ], - creates => "$_home/.vimrc", + creates => "$home/.vimrc", require => [ Class['cron'], Class['c_toolchain'], -- cgit v1.2.3-54-g00ecf