From: Stephen Gran Date: Sun, 24 Jun 2012 09:26:23 +0000 (+0100) Subject: make this as safe as I can X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=fcbadcd7ee97cd5c9625a411bed276b0b5de069d;p=mirror%2Fdsa-puppet.git make this as safe as I can Signed-off-by: Stephen Gran --- diff --git a/modules/motd/templates/motd.erb b/modules/motd/templates/motd.erb index 8f353dfb0..2430bb1dd 100644 --- a/modules/motd/templates/motd.erb +++ b/modules/motd/templates/motd.erb @@ -100,7 +100,7 @@ unless vms.empty? end -if not scope.lookupvar('::cluster').to_s.empty? +if scope.lookupvar('::cluster').to_s != 'undefined' purp += "\nThis server is a node in ganeti cluster: " purp += scope.lookupvar('::cluster').to_s + ".\n" nodes = scope.lookupvar('::cluster_nodes').to_s.split.sort diff --git a/modules/ssh/templates/authorized_keys.erb b/modules/ssh/templates/authorized_keys.erb index b7225a566..1d688647b 100644 --- a/modules/ssh/templates/authorized_keys.erb +++ b/modules/ssh/templates/authorized_keys.erb @@ -22,12 +22,14 @@ localkeys <%= ganetikeys = [] allnodeinfo = scope.lookupvar('site::allnodeinfo') - scope.lookupvar('::cluster_nodes').to_s.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').to_s != 'undefined' + scope.lookupvar('::cluster_nodes').to_s.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 end ganetikeys.join("\n");