Improve logging and add some TODOs that have been around for a while
This commit is contained in:
parent
518cd3cbe3
commit
6680858184
5 changed files with 10 additions and 2 deletions
|
@ -119,7 +119,7 @@ module Vagrant
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
b.use Vagrant::Action::Builtin::Call, Created do |env, b2|
|
b.use Vagrant::Action::Builtin::Call, Created do |env, b2|
|
||||||
if env[:result]
|
if env[:result]
|
||||||
# TODO: Remove this on / after 0.4
|
# TODO: Check vagrant version and use only if lower than 1.X
|
||||||
b2.use Disconnect
|
b2.use Disconnect
|
||||||
b2.use ClearForwardedPorts
|
b2.use ClearForwardedPorts
|
||||||
b2.use RemoveTemporaryFiles
|
b2.use RemoveTemporaryFiles
|
||||||
|
@ -145,6 +145,7 @@ module Vagrant
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Use Vagrant's built in action
|
||||||
b2.use Vagrant::Action::Builtin::Call, DestroyConfirm do |env2, b3|
|
b2.use Vagrant::Action::Builtin::Call, DestroyConfirm do |env2, b3|
|
||||||
if env2[:result]
|
if env2[:result]
|
||||||
b3.use Vagrant::Action::Builtin::ConfigValidate
|
b3.use Vagrant::Action::Builtin::ConfigValidate
|
||||||
|
|
|
@ -18,7 +18,10 @@ module Vagrant
|
||||||
system "pkill -TERM -P #{pid}"
|
system "pkill -TERM -P #{pid}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@logger.info "Removing redir pids files"
|
||||||
remove_redir_pids
|
remove_redir_pids
|
||||||
|
else
|
||||||
|
@logger.info "No redir pids found"
|
||||||
end
|
end
|
||||||
|
|
||||||
@app.call env
|
@app.call env
|
||||||
|
@ -33,6 +36,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_redir_pid?(pid)
|
def is_redir_pid?(pid)
|
||||||
|
@logger.debug "Checking if #{pid} is a redir process with `ps -o cmd= #{pid}`"
|
||||||
`ps -o cmd= #{pid}`.strip.chomp =~ /redir/
|
`ps -o cmd= #{pid}`.strip.chomp =~ /redir/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ module Vagrant
|
||||||
box_dir = @env[:machine].box.directory
|
box_dir = @env[:machine].box.directory
|
||||||
FileUtils.cp box_dir.join('lxc-template').to_s, @env['package.directory'].to_s
|
FileUtils.cp box_dir.join('lxc-template').to_s, @env['package.directory'].to_s
|
||||||
FileUtils.cp box_dir.join('metadata.json').to_s, @env['package.directory'].to_s
|
FileUtils.cp box_dir.join('metadata.json').to_s, @env['package.directory'].to_s
|
||||||
|
# TODO: Update built-on metadata.json
|
||||||
if (conf = box_dir.join('lxc.conf')).exist?
|
if (conf = box_dir.join('lxc.conf')).exist?
|
||||||
FileUtils.cp conf.to_s, @env['package.directory'].to_s
|
FileUtils.cp conf.to_s, @env['package.directory'].to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -151,12 +151,13 @@ module Vagrant
|
||||||
template_name = "vagrant-tmp-#{@container_name}"
|
template_name = "vagrant-tmp-#{@container_name}"
|
||||||
tmp_template_path = templates_path.join("lxc-#{template_name}").to_s
|
tmp_template_path = templates_path.join("lxc-#{template_name}").to_s
|
||||||
|
|
||||||
@logger.debug 'Copying LXC template into place'
|
@logger.info 'Copying LXC template into place'
|
||||||
@sudo_wrapper.run('cp', path, tmp_template_path)
|
@sudo_wrapper.run('cp', path, tmp_template_path)
|
||||||
@sudo_wrapper.run('chmod', '+x', tmp_template_path)
|
@sudo_wrapper.run('chmod', '+x', tmp_template_path)
|
||||||
|
|
||||||
yield template_name
|
yield template_name
|
||||||
ensure
|
ensure
|
||||||
|
@logger.info 'Removing LXC template'
|
||||||
@sudo_wrapper.run('rm', tmp_template_path)
|
@sudo_wrapper.run('rm', tmp_template_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
unless last_state == target_state
|
unless last_state == target_state
|
||||||
|
# TODO: Raise an user friendly message
|
||||||
raise TargetStateNotReached.new target_state, last_state
|
raise TargetStateNotReached.new target_state, last_state
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue