Use Fog::Formatador

This commit is contained in:
starbelly 2015-01-16 18:14:58 -06:00
parent 8adec4d448
commit 7eb6b05bea
5 changed files with 10 additions and 10 deletions

View File

@ -102,7 +102,7 @@ task :nuke do
begin begin
compute = Fog::Compute.new(:provider => provider) compute = Fog::Compute.new(:provider => provider)
for server in compute.servers for server in compute.servers
Formatador.display_line("[#{provider}] destroying server #{server.identity}") Fog::Formatador.display_line("[#{provider}] destroying server #{server.identity}")
server.destroy rescue nil server.destroy rescue nil
end end
rescue rescue
@ -113,7 +113,7 @@ task :nuke do
for record in zone.records for record in zone.records
record.destroy rescue nil record.destroy rescue nil
end end
Formatador.display_line("[#{provider}] destroying zone #{zone.identity}") Fog::Formatador.display_line("[#{provider}] destroying zone #{zone.identity}")
zone.destroy rescue nil zone.destroy rescue nil
end end
rescue rescue

View File

@ -63,8 +63,8 @@ else
@irb.signal_handle @irb.signal_handle
end end
Formatador.display_line('Welcome to fog interactive!') Fog::Formatador.display_line('Welcome to fog interactive!')
Formatador.display_line(":#{Fog.credential} provides #{providers}") Fog::Formatador.display_line(":#{Fog.credential} provides #{providers}")
providers = Fog.providers providers = Fog.providers
# FIXME: hacks until we can `include Fog` in bin # FIXME: hacks until we can `include Fog` in bin

View File

@ -13,7 +13,7 @@ class Clodo < Fog::Bin
@@connections ||= Hash.new do |hash, key| @@connections ||= Hash.new do |hash, key|
hash[key] = case key hash[key] = case key
when :compute when :compute
Formatador.display_line("[yellow][WARN] Clodo[:compute] is deprecated, use Compute[:clodo] instead[/]") Fog::Formatador.display_line("[yellow][WARN] Clodo[:compute] is deprecated, use Compute[:clodo] instead[/]")
Fog::Compute.new(:provider => 'Clodo') Fog::Compute.new(:provider => 'Clodo')
else else
raise ArgumentError, "Unrecognized service: #{key.inspect}" raise ArgumentError, "Unrecognized service: #{key.inspect}"

View File

@ -36,10 +36,10 @@ module Fog
def non_running? def non_running?
if @service.show_progress? && (@last_progress ||= 0) < 100 if @service.show_progress? && (@last_progress ||= 0) < 100
if status == 'running' if status == 'running'
Formatador.redisplay_progressbar(progress, 100, :label => operation_name, :started_at => start_time) Fog::Formatador.redisplay_progressbar(progress, 100, :label => operation_name, :started_at => start_time)
@last_progress = progress @last_progress = progress
elsif status == 'success' elsif status == 'success'
Formatador.redisplay_progressbar(100, 100, :label => operation_name, :started_at => start_time) Fog::Formatador.redisplay_progressbar(100, 100, :label => operation_name, :started_at => start_time)
@last_progress = 100 @last_progress = 100
end end
end end

View File

@ -36,13 +36,13 @@ available_providers = Fog.available_providers.map {|provider| provider.downcase}
unavailable_providers = all_providers - available_providers unavailable_providers = all_providers - available_providers
if !ENV['PROVIDER'].nil? && unavailable_providers.include?(ENV['PROVIDER']) if !ENV['PROVIDER'].nil? && unavailable_providers.include?(ENV['PROVIDER'])
Formatador.display_line("[red]Requested provider #{ENV['PROVIDER']} is not available.[/]" + Fog::Formatador.display_line("[red]Requested provider #{ENV['PROVIDER']} is not available.[/]" +
"[red]Check if .fog file has correct configuration (see '#{Fog.credentials_path}')[/]") "[red]Check if .fog file has correct configuration (see '#{Fog.credentials_path}')[/]")
exit(0) exit(0)
end end
for provider in unavailable_providers for provider in unavailable_providers
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '#{Fog.credentials_path}' to run them)[/]") Fog::Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '#{Fog.credentials_path}' to run them)[/]")
Thread.current[:tags] << ('-' << provider) Thread.current[:tags] << ('-' << provider)
end end
@ -50,6 +50,6 @@ end
begin begin
require('libvirt') require('libvirt')
rescue LoadError rescue LoadError
Formatador.display_line("[yellow]Skipping tests for [bold]libvirt[/] [yellow]due to missing `ruby-libvirt` gem.[/]") Fog::Formatador.display_line("[yellow]Skipping tests for [bold]libvirt[/] [yellow]due to missing `ruby-libvirt` gem.[/]")
Thread.current[:tags] << '-libvirt' Thread.current[:tags] << '-libvirt'
end end