20643: Skips user account processing earlier to avoid any partial configs. 20643-login-sync-homedir-check
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 20 Jun 2023 14:44:08 +0000 (11:44 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 20 Jun 2023 14:44:08 +0000 (11:44 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

services/login-sync/bin/arvados-login-sync

index 0a9648db92236dbb59a3e606000fd177c5579ca5..9bcb5bfa9d9a7a46a2815592803931c6ce9b32f8 100755 (executable)
@@ -146,6 +146,12 @@ begin
       end
     end
 
+    homedir = pwnam[l[:username]].dir
+    if !File.exist?(homedir)
+      STDERR.puts "Cannot set up user #{username} because their home directory #{homedir} does not exist. Skipping."
+      next
+    end
+
     existing_groups = current_user_groups[username] || []
     groups = l[:groups] || []
     # Adding users to the FUSE group has long been hardcoded behavior.
@@ -175,11 +181,6 @@ begin
       end
     end
 
-    homedir = pwnam[l[:username]].dir
-    if !File.exist?(homedir)
-      STDERR.puts "Cannot set up user #{username} because their home directory #{homedir} does not exist. Skipping."
-      next
-    end
     userdotssh = File.join(homedir, ".ssh")
     Dir.mkdir(userdotssh) if !File.exist?(userdotssh)