Support arbitrary exit statuses for CLI commands that aren't exploding
This commit is contained in:
parent
c1445a0130
commit
3338b6c134
|
@ -39,8 +39,8 @@ begin
|
|||
logger.debug("Loading environment")
|
||||
env.load!
|
||||
|
||||
# Execute the CLI interface
|
||||
env.cli(ARGV)
|
||||
# Execute the CLI interface, and exit with the proper error code
|
||||
exit(env.cli(ARGV))
|
||||
rescue Vagrant::Errors::VagrantError => e
|
||||
logger.error("Vagrant experienced an error! Details:")
|
||||
logger.error(e.inspect)
|
||||
|
|
|
@ -34,8 +34,10 @@ module Vagrant
|
|||
return help if !command_class || !@sub_command
|
||||
@logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
|
||||
|
||||
# Initialize and execute the command class.
|
||||
command_class.new(@sub_args, @env).execute
|
||||
# Initialize and execute the command class, returning the exit status.
|
||||
result = command_class.new(@sub_args, @env).execute
|
||||
result = 0 if !result.is_a?(Fixnum)
|
||||
return result
|
||||
end
|
||||
|
||||
# This prints out the help for the CLI.
|
||||
|
|
|
@ -28,6 +28,9 @@ module Vagrant
|
|||
end
|
||||
|
||||
@env.boxes.add(argv[0], argv[1])
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,10 @@ module Vagrant
|
|||
return @env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :prefix => false)
|
||||
end
|
||||
boxes.each { |b| @env.ui.info(b.name, :prefix => false) }
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,10 @@ module Vagrant
|
|||
b = @env.boxes.find(argv[0])
|
||||
raise Errors::BoxNotFound, :name => argv[0] if !b
|
||||
b.destroy
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,10 @@ module Vagrant
|
|||
b = @env.boxes.find(argv[0])
|
||||
raise Errors::BoxNotFound, :name => argv[0] if !b
|
||||
b.repackage
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,10 @@ module Vagrant
|
|||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,10 @@ module Vagrant
|
|||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,10 @@ module Vagrant
|
|||
|
||||
@env.ui.info(I18n.t("vagrant.commands.init.success"),
|
||||
:prefix => false)
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,10 @@ module Vagrant
|
|||
else
|
||||
package_target(argv[0], options)
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
|
@ -30,7 +30,10 @@ module Vagrant
|
|||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,10 @@ module Vagrant
|
|||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,10 @@ module Vagrant
|
|||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,7 +53,10 @@ module Vagrant
|
|||
ssh_connect(vm, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
|
@ -42,7 +42,10 @@ module Vagrant
|
|||
template = "commands/ssh_config/config"
|
||||
safe_puts(Util::TemplateRenderer.render(template, variables))
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,10 @@ module Vagrant
|
|||
:states => results.join("\n"),
|
||||
:message => I18n.t("vagrant.commands.status.#{state}")),
|
||||
:prefix => false)
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,10 @@ module Vagrant
|
|||
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,10 @@ module Vagrant
|
|||
vm.up(options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Success, exit status 0
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue