lib/cluster_chef/knife/knife_common.rb
# Show a pretty progress bar while we wait for a set of threads to finish.
Show a pretty progress bar while we wait for a set of threads to finish.
Show a pretty progress bar while we wait for a set of threads to finish .
def progressbar_for_threads threads
      puts "\nWaiting for servers:"
      total      = threads.length
      remaining  = threads.select(&:alive?)
      start_time = Time.now
      until remaining.empty?
        remaining = remaining.select(&:alive?)
        if config[:verbosity]
          puts "waiting: #{total - remaining.length} / #{total}, #{(Time.now - start_time).to_i}s"
          sleep 3
        else
          ap config
          Formatador.redisplay_progressbar(total - remaining.length, total, {:started_at => start_time })
          sleep 1
        end
      end
      threads.each(&:join)
      puts ''
    end
def progressbar_for_threads threads puts "\nWaiting for servers:" total = threads . length remaining = threads . select ( & :alive? ) start_time = Time . now until remaining . empty? remaining = remaining . select ( & :alive? ) if config [ :verbosity ] puts "waiting: #{total - remaining.length} / #{total}, #{(Time.now - start_time).to_i}s" sleep 3 else ap config Formatador . redisplay_progressbar ( total - remaining . length , total , { :started_at => start_time } ) sleep 1 end end threads . each ( & :join ) puts '' end
Show a pretty progress bar while we wait for a set of threads to finish.
Show a pretty progress bar while we wait for a set of threads to finish .
# Collapse the threads
threads