From abcd14cf6215dbeb3bc064c99941e71e8eb9fba9 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Sun, 24 Jun 2012 10:00:38 +0100 Subject: [PATCH] calling split on undefined is naughty Signed-off-by: Stephen Gran --- modules/ssh/templates/authorized_keys.erb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/ssh/templates/authorized_keys.erb b/modules/ssh/templates/authorized_keys.erb index f00642486..2b00e56f8 100644 --- a/modules/ssh/templates/authorized_keys.erb +++ b/modules/ssh/templates/authorized_keys.erb @@ -22,15 +22,17 @@ localkeys <%= ganetikeys = [] allnodeinfo = scope.lookupvar('site::allnodeinfo') - scope.lookupvar('::cluster_nodes').split.sort.each do |node| - if allnodeinfo.has_key?(node) - ganetikeys << "# for ganeti: #{allnodeinfo[node]['hostname'].to_s}" - ganetikeys << "from=\"#{allnodeinfo[node]['ipHostNumber'].join(',')}\" #{allnodeinfo[node]['sshRSAHostKey'].to_s}" - else - ganetikeys << "# host #{node} not found in allnodeinfo" + if scope.lookupvar('::cluster_nodes') + scope.lookupvar('::cluster_nodes').split.sort.each do |node| + if allnodeinfo.has_key?(node) + ganetikeys << "# for ganeti: #{allnodeinfo[node]['hostname'].to_s}" + ganetikeys << "from=\"#{allnodeinfo[node]['ipHostNumber'].join(',')}\" #{allnodeinfo[node]['sshRSAHostKey'].to_s}" + else + ganetikeys << "# host #{node} not found in allnodeinfo" + end end + ganetikeys.join("\n"); end - ganetikeys.join("\n"); %> # # DSA -- 2.20.1