fixing adding user to an empty group based on http://watzmann.net/blog/2010/05/augeas...
authormh <mh@immerda.ch>
Tue, 24 May 2011 20:11:31 +0000 (22:11 +0200)
committermh <mh@immerda.ch>
Tue, 24 May 2011 20:11:31 +0000 (22:11 +0200)
manifests/groups/manage_user.pp

index 9df3a20..9cd7b13 100644 (file)
@@ -15,7 +15,8 @@ define user::groups::manage_user(
     }
     if ($ensure == 'present'){
         Augeas["manage_${real_user}_in_group_${group}"]{
-            changes => [ "set ${group}/user[last()+1] ${real_user}" ],
+            changes => [ "ins user after ${group}/*[self::gid or self::user][last()]",
+                         "set ${group}/user[last()] ${real_user}" ],
             onlyif => "match ${group}/*[../user='${real_user}'] size == 0"
         }
     } else {