lib/knife/undev/plugins/cloud_ssh.rb in knife-undev-0.1.2 vs lib/knife/undev/plugins/cloud_ssh.rb in knife-undev-0.1.3
- old
+ new
@@ -99,11 +99,11 @@
end
end
case config[:on_error]
when :skip
ui.warn "Failed to connect to #{node_name} -- #{$!.class.name}: #{$!.message}"
- $!.backtrace.each { |l| Chef::Log.debug(l) }
+ $!.backtrace.each { |l| Chef::Log.error(l) }
when :raise
#Net::SSH::Multi magic to force exception to be re-raised.
throw :go, :raise
end
end
@@ -241,11 +241,15 @@
ichannel.send_data("#{get_password}\n")
end
end
ch.on_request "exit-status" do |ichannel, data|
exit_status = [exit_status, data.read_long].max
- @not_zerro_nodes << { 'node' => ichannel[:host], "message" => "exit status: #{exit_status}" } if exit_status != 0
+ if exit_status != 0
+ @not_zerro_nodes << { 'node' => ichannel[:host], "message" => "exit status: #{exit_status}" }
+ else
+ @zerro_nodes << {'node' => ichannel[:host]}
+ end
end
end
end
session.loop
exit_status
@@ -338,12 +342,12 @@
def print_all_status
succ = @all_nodes.count - @failed_connect_nodes.count - @not_zerro_nodes.count
failed = @failed_connect_nodes.count + @not_zerro_nodes.count
@failed_connect_nodes.each { |msg| ui.error("#{msg['node']} #{msg['message']}") }
@not_zerro_nodes.each { |msg| ui.error("#{msg['node']} #{msg['message']}") }
- if failed > 0
- ui.warn "All: #{@all_nodes.count}, successful: #{succ}, connection problem: #{@failed_connect_nodes.count}, failed: #{@not_zerro_nodes.count}"
+ if failed > 0 || @zerro_nodes.count != succ
+ ui.warn "All: #{@all_nodes.count}, successful exit: #{@zerro_nodes.count}, connection problem: #{@failed_connect_nodes.count}, failed: #{@not_zerro_nodes.count}"
else
ui.info "All: #{@all_nodes.count}, successful: #{succ}"
end
end
@@ -353,10 +357,11 @@
@longest = 0
@all_nodes = []
@failed_connect_nodes = []
@not_zerro_nodes = []
+ @zerro_nodes = []
configure_attribute
configure_user
configure_identity_file
configure_gateway
@@ -384,5 +389,6 @@
end
end
end
end
+