Handle multiple keys in ldap correctly
authorPeter Palfrader <peter@palfrader.org>
Thu, 14 May 2015 16:04:39 +0000 (18:04 +0200)
committerPeter Palfrader <peter@palfrader.org>
Thu, 14 May 2015 16:04:39 +0000 (18:04 +0200)
modules/ssh/templates/authorized_keys.erb

index a11a611..2a56710 100644 (file)
@@ -15,7 +15,9 @@ localkeys
     scope.lookupvar('::cluster_nodes').split.sort.each do |node|
       if allnodeinfo.has_key?(node)
         ganetikeys << "# for ganeti cluster #{scope.lookupvar('::cluster').to_s}: #{allnodeinfo[node]['hostname'][0]}"
-        ganetikeys << "from=\"#{allnodeinfo[node]['ipHostNumber'].join(',')}\" #{allnodeinfo[node]['sshRSAHostKey'][0]}"
+        allnodeinfo[node]['sshRSAHostKey'].sort.each do |key|
+          ganetikeys << "from=\"#{allnodeinfo[node]['ipHostNumber'].join(',')}\" #{key}"
+        end
       else
         ganetikeys << "# host #{node} not found in allnodeinfo"
       end