No more logger usage for outputting to the shell
This commit is contained in:
parent
b21fae99c5
commit
a699122260
|
@ -55,11 +55,11 @@ module Vagrant
|
|||
# chain has been run.
|
||||
int_callback = lambda do
|
||||
if action_environment.interrupted?
|
||||
env.logger.info "Exiting immediately!"
|
||||
env.ui.info "Exiting immediately!"
|
||||
abort
|
||||
end
|
||||
|
||||
env.logger.info "Waiting for cleanup before exiting..."
|
||||
env.ui.info "Waiting for cleanup before exiting..."
|
||||
action_environment.error!(:interrupt)
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ module Vagrant
|
|||
# Progress reporting is limited to every 25 segments just so
|
||||
# we're not constantly updating
|
||||
if segment_count % 25 == 0
|
||||
env.logger.report_progress(progress, total)
|
||||
env.ui.report_progress(progress, total)
|
||||
segment_count = 0
|
||||
end
|
||||
|
||||
|
@ -45,8 +45,6 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
env.logger.clear_progress
|
||||
rescue SocketError
|
||||
env.error!(:box_download_http_socket_error, :box_url => source_url)
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Vagrant
|
|||
|
||||
# The sleep ensures that the output is truly flushed before any `sudo`
|
||||
# commands are issued.
|
||||
env.logger.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
|
||||
env.ui.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
|
||||
sleep 0.5
|
||||
|
||||
output.split("\n").each do |line|
|
||||
|
|
|
@ -24,7 +24,7 @@ module Vagrant
|
|||
:ip => ip,
|
||||
:folders => folders)
|
||||
|
||||
env.logger.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
|
||||
env.ui.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
|
||||
sleep 0.5
|
||||
|
||||
output.split("\n").each do |line|
|
||||
|
|
|
@ -30,12 +30,6 @@ module Vagrant
|
|||
env.vm
|
||||
end
|
||||
|
||||
# This method returns the environment's logger as a convenience
|
||||
# method.
|
||||
def logger
|
||||
env.logger
|
||||
end
|
||||
|
||||
# This is the method called to "prepare" the provisioner. This is called
|
||||
# before any actions are run by the action runner (see {Vagrant::Actions::Runner}).
|
||||
# This can be used to setup shared folders, forward ports, etc. Whatever is
|
||||
|
|
|
@ -85,7 +85,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def chown_provisioning_folder
|
||||
logger.info "Setting permissions on chef provisioning folder..."
|
||||
env.ui.info "Setting permissions on chef provisioning folder..."
|
||||
vm.ssh.execute do |ssh|
|
||||
ssh.exec!("sudo mkdir -p #{env.config.chef.provisioning_path}")
|
||||
ssh.exec!("sudo chown #{env.config.ssh.username} #{env.config.chef.provisioning_path}")
|
||||
|
@ -97,12 +97,12 @@ module Vagrant
|
|||
:log_level => env.config.chef.log_level.to_sym
|
||||
}.merge(template_vars))
|
||||
|
||||
logger.info "Uploading chef configuration script..."
|
||||
env.ui.info "Uploading chef configuration script..."
|
||||
vm.ssh.upload!(StringIO.new(config_file), File.join(env.config.chef.provisioning_path, filename))
|
||||
end
|
||||
|
||||
def setup_json
|
||||
logger.info "Generating chef JSON and uploading..."
|
||||
env.ui.info "Generating chef JSON and uploading..."
|
||||
|
||||
# Set up initial configuration
|
||||
data = {
|
||||
|
|
|
@ -26,7 +26,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def create_client_key_folder
|
||||
logger.info "Creating folder to hold client key..."
|
||||
env.ui.info "Creating folder to hold client key..."
|
||||
path = Pathname.new(env.config.chef.client_key_path)
|
||||
|
||||
vm.ssh.execute do |ssh|
|
||||
|
@ -35,7 +35,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def upload_validation_key
|
||||
logger.info "Uploading chef client validation key..."
|
||||
env.ui.info "Uploading chef client validation key..."
|
||||
vm.ssh.upload!(validation_key_path, guest_validation_key_path)
|
||||
end
|
||||
|
||||
|
@ -52,13 +52,13 @@ module Vagrant
|
|||
def run_chef_client
|
||||
command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-client -c client.rb -j dna.json"
|
||||
|
||||
logger.info "Running chef-client..."
|
||||
env.ui.info "Running chef-client..."
|
||||
vm.ssh.execute do |ssh|
|
||||
ssh.exec!(command) do |channel, type, data|
|
||||
if type == :exit_status
|
||||
ssh.check_exit_status(data, command)
|
||||
else
|
||||
logger.info("#{data}: #{type}")
|
||||
env.ui.info("#{data}: #{type}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,11 +40,11 @@ module Vagrant
|
|||
def run_chef_solo
|
||||
command = "cd #{env.config.chef.provisioning_path} && sudo -E chef-solo -c solo.rb -j dna.json"
|
||||
|
||||
logger.info "Running chef-solo..."
|
||||
env.ui.info "Running chef-solo..."
|
||||
vm.ssh.execute do |ssh|
|
||||
ssh.exec!(command) do |channel, type, data|
|
||||
ssh.check_exit_status(data, command) if type == :exit_status
|
||||
logger.info("#{data}: #{type}") if type != :exit_status
|
||||
env.ui.info("#{data}: #{type}") if type != :exit_status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ module Vagrant
|
|||
stat = File.stat(key_path)
|
||||
|
||||
if stat.owned? && file_perms(key_path) != "600"
|
||||
env.logger.info "Permissions on private key incorrect, fixing..."
|
||||
env.ui.info "Permissions on private key incorrect, fixing..."
|
||||
File.chmod(0600, key_path)
|
||||
|
||||
error_and_exit(:ssh_bad_permissions, :key_path => key_path) if file_perms(key_path) != "600"
|
||||
|
|
|
@ -27,12 +27,6 @@ module Vagrant
|
|||
@vm = vm
|
||||
end
|
||||
|
||||
# A convenience method to access the logger on the VM
|
||||
# environment.
|
||||
def logger
|
||||
vm.env.logger
|
||||
end
|
||||
|
||||
# Halt the machine. This method should gracefully shut down the
|
||||
# operating system. This method will cause `vagrant halt` and associated
|
||||
# commands to _block_, meaning that if the machine doesn't halt
|
||||
|
|
|
@ -29,7 +29,7 @@ module Vagrant
|
|||
# Overridden methods
|
||||
#-------------------------------------------------------------------
|
||||
def halt
|
||||
logger.info "Attempting graceful shutdown of linux..."
|
||||
vm.env.ui.info "Attempting graceful shutdown of linux..."
|
||||
vm.ssh.execute do |ssh|
|
||||
ssh.exec!("sudo halt")
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ module Vagrant
|
|||
def prepare_unison(ssh)
|
||||
ssh.exec!("which unison", :error_key => :unison_not_found)
|
||||
|
||||
logger.info "Preparing system for unison sync..."
|
||||
vm.env.ui.info "Preparing system for unison sync..."
|
||||
vm.ssh.upload!(StringIO.new(TemplateRenderer.render('/unison/script')), config.unison.script)
|
||||
ssh.exec!("sudo chmod +x #{config.unison.script}")
|
||||
ssh.exec!("sudo rm #{config.unison.crontab_entry_file}", :error_check => false)
|
||||
|
|
|
@ -15,16 +15,10 @@ class DestroyBoxActionTest < Test::Unit::TestCase
|
|||
@instance = @klass.new(@app, @env)
|
||||
end
|
||||
|
||||
context "calling" do
|
||||
setup do
|
||||
@env.logger.stubs(:info)
|
||||
end
|
||||
|
||||
should "delete the box directory" do
|
||||
seq = sequence("seq")
|
||||
FileUtils.expects(:rm_rf).with(@env["box"].directory).in_sequence(seq)
|
||||
@app.expects(:call).with(@env).once.in_sequence(seq)
|
||||
@instance.call(@env)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,10 +16,6 @@ class VerifyBoxActionTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
context "calling" do
|
||||
setup do
|
||||
@env.logger.stubs(:info)
|
||||
end
|
||||
|
||||
should "continue fine if verification succeeds" do
|
||||
seq = sequence("seq")
|
||||
VirtualBox::Appliance.expects(:new).with(@env["box"].ovf_file).in_sequence(seq)
|
||||
|
|
|
@ -5,7 +5,6 @@ class BSDHostTest < Test::Unit::TestCase
|
|||
@klass = Vagrant::Hosts::BSD
|
||||
@env = mock_environment
|
||||
@env.stubs(:vm).returns(Vagrant::VM.new(:env => @env))
|
||||
@env.logger.stubs(:info)
|
||||
|
||||
@instance = @klass.new(@env)
|
||||
end
|
||||
|
|
|
@ -5,7 +5,6 @@ class LinuxHostTest < Test::Unit::TestCase
|
|||
@klass = Vagrant::Hosts::Linux
|
||||
@env = mock_environment
|
||||
@env.stubs(:vm).returns(Vagrant::VM.new(:env => @env))
|
||||
@env.logger.stubs(:info)
|
||||
|
||||
@instance = @klass.new(@env)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue