(DIO-2700) Vmfloaty should not use the Colorize gem

removing cosmetic use of colorize
This commit is contained in:
Samuel Beaulieu 2022-02-16 13:07:05 -06:00
parent 1b64ce3b03
commit 6b9b4ea626
No known key found for this signature in database
GPG key ID: 12030F74136D0F34
5 changed files with 6 additions and 8 deletions

View file

@ -2,7 +2,6 @@
require 'rubygems'
require 'commander'
require 'colorize'
require 'json'
require 'pp'
require 'uri'

View file

@ -137,7 +137,7 @@ class Utils
metadata = [host_data['state'], host_data['template'], duration, *tag_pairs]
message = "- #{hostname}.#{host_data['domain']} (#{metadata.join(', ')})".gsub(/^/, ' ' * indent)
if host_data['state'] && host_data['state'] == 'destroyed'
output_target.puts message.colorize(:red)
output_target.puts "- DESTROYED #{hostname}.#{host_data['domain']}".gsub(/^/, ' ' * indent)
else
output_target.puts message
end
@ -201,7 +201,7 @@ class Utils
rescue StandardError => e
FloatyLogger.error "#{name.ljust(width)} #{e.red}"
end
puts message.colorize(status_response['status']['ok'] ? :default : :red)
puts message
when 'NonstandardPooler'
pools = status_response
pools.delete 'ok'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
class Vmfloaty
VERSION = '1.5.0'
VERSION = '1.6.0'
end

View file

@ -466,13 +466,13 @@ describe Utils do
subject
end
it 'prints in red when destroyed' do
it 'prints DESTROYED and hostname when destroyed' do
fallback = { 'vmpooler_fallback' => 'vmpooler' }
service.config.merge! fallback
response_body_vmpooler[fqdn_hostname]['state'] = 'destroyed'
default_output_second_line_red = " - #{fqdn} (destroyed, #{template}, 7.67/48 hours, user: bob, role: agent)".red
default_output_second_line = " - DESTROYED #{fqdn}"
expect($stdout).to receive(:puts).with(default_output_first_line)
expect($stdout).to receive(:puts).with(default_output_second_line_red)
expect($stdout).to receive(:puts).with(default_output_second_line)
subject
end

View file

@ -24,7 +24,6 @@ Gem::Specification.new do |s|
s.test_files = Dir['spec/**/*']
s.require_path = 'lib'
s.add_dependency 'colorize', '~> 0.8.1'
s.add_dependency 'commander', '>= 4.4.3', '< 4.7.0'
s.add_dependency 'faraday', '~> 1.5', '>= 1.5.1'
end