def node_healthy?(hostname, services = [], iterations = 60)
      print "Waiting for #{hostname} to become healthy"
      services = services.reject { |s| get_service_check(s).empty? }.freeze

      iterations.times do
        print '.'

        checks = hostname_health_checks(hostname)

        has_services = (services - checks.map { |c| c['ServiceName'] }).empty?
        passing_checks = checks.all? { |c| c['Status'] == 'passing' }

        if !checks.empty? && has_services && passing_checks
          unless services.empty?
            print " Services: #{services.join(', ').inspect} Healthy and".green
          end

          puts ' Node Healthy!'.green
          return true
        end

        sleep(6)
      end

      false
    end
def node_healthy?(hostname, services = [], iterations = 60)
      print "Waiting for #{hostname} to become healthy"
      services = services.reject { |s| get_service_check(s).empty? }.freeze

      iterations.times do
        print '.'

        checks = hostname_health_checks(hostname)

        has_services = (services - checks.map { |c| c['ServiceName'] }).empty?
        passing_checks = checks.all? { |c| c['Status'] == 'passing' }

        if !checks.empty? && has_services && passing_checks
          unless services.empty?
            print " Services: #{services.join(', ').inspect} Healthy and".green
          end

          puts ' Node Healthy!'.green
          return true
        end

        sleep(6)
      end

      false
    end
Wait for all health checks on the host to become healthy.

 services - services to perform health checks on (if health checks are
            defined)