From 9e9142058cdee68ad567836799883b1aa6962bbd Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Mon, 31 Aug 2020 14:22:27 -0400 Subject: [PATCH] 16779: Create user accounts even if they don't have an ssh key refs #16779 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- services/login-sync/bin/arvados-login-sync | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/services/login-sync/bin/arvados-login-sync b/services/login-sync/bin/arvados-login-sync index e00495c04d..d5ec159867 100755 --- a/services/login-sync/bin/arvados-login-sync +++ b/services/login-sync/bin/arvados-login-sync @@ -36,7 +36,7 @@ begin logins = arv.virtual_machine.logins(:uuid => vm_uuid)[:items] logins = [] if logins.nil? - logins = logins.reject { |l| l[:username].nil? or l[:hostname].nil? or l[:public_key].nil? or l[:virtual_machine_uuid] != vm_uuid } + logins = logins.reject { |l| l[:username].nil? or l[:hostname].nil? or l[:virtual_machine_uuid] != vm_uuid } # No system users uid_min = 1000 @@ -79,13 +79,15 @@ begin logins.each do |l| keys[l[:username]] = Array.new() if not keys.has_key?(l[:username]) key = l[:public_key] - # Handle putty-style ssh public keys - key.sub!(/^(Comment: "r[^\n]*\n)(.*)$/m,'ssh-rsa \2 \1') - key.sub!(/^(Comment: "d[^\n]*\n)(.*)$/m,'ssh-dss \2 \1') - key.gsub!(/\n/,'') - key.strip - - keys[l[:username]].push(key) if not keys[l[:username]].include?(key) + if !key.nil? + # Handle putty-style ssh public keys + key.sub!(/^(Comment: "r[^\n]*\n)(.*)$/m,'ssh-rsa \2 \1') + key.sub!(/^(Comment: "d[^\n]*\n)(.*)$/m,'ssh-dss \2 \1') + key.gsub!(/\n/,'') + key.strip + + keys[l[:username]].push(key) if not keys[l[:username]].include?(key) + end end seen = Hash.new() -- 2.30.2