-def find_ssh_key key_name
- # If the user already has a key loaded in their agent, use one of those
- agent_keys = `ssh-add -l`
- if agent_keys.empty?
- # Use a key named arvados_{key_name}_id_rsa, generating
- # a passphraseless key if necessary.
- ssh_key_file = "#{ENV['HOME']}/.ssh/arvados_#{key_name}_id_rsa"
- unless File.exists? ssh_key_file
- system 'ssh_keygen', '-f', ssh_key_file, '-P', ''
- end
- else
- # choose an agent key at random
- ssh_key_file = agent_keys.split("\n").first.split[2]
+# find_or_create_ssh_key arvados_name
+# Return the SSH public key appropriate for this Arvados instance,
+# generating one if necessary.
+#
+def find_or_create_ssh_key arvados_name
+ ssh_key_file = "#{ENV['HOME']}/.ssh/arvados_#{arvados_name}_id_rsa"
+ unless File.exists? ssh_key_file
+ system 'ssh-keygen',
+ '-f', ssh_key_file,
+ '-C', "arvados@#{arvados_name}",
+ '-P', ''