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