Upgrade command to 0.6.0 format added `vagrant upgrade_to_060`
This commit is contained in:
parent
b7d0790a6b
commit
b7788e3c06
|
@ -13,12 +13,12 @@ module Vagrant
|
||||||
if klass <= Command::GroupBase
|
if klass <= Command::GroupBase
|
||||||
# A subclass of GroupBase is a subcommand, since it contains
|
# A subclass of GroupBase is a subcommand, since it contains
|
||||||
# many smaller commands within it.
|
# many smaller commands within it.
|
||||||
desc usage, description
|
desc usage, description, opts
|
||||||
subcommand name, klass
|
subcommand name, klass
|
||||||
elsif klass <= Command::Base
|
elsif klass <= Command::Base
|
||||||
# A subclass of Base is a single command, since it
|
# A subclass of Base is a single command, since it
|
||||||
# is invoked as a whole.
|
# is invoked as a whole (as Thor::Group)
|
||||||
desc usage, description
|
desc usage, description, opts
|
||||||
define_method(name) { |*args| invoke klass, args }
|
define_method(name) { |*args| invoke klass, args }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
module Vagrant
|
||||||
|
module Command
|
||||||
|
class UpgradeTo060Command < Base
|
||||||
|
desc "Upgrade pre-0.6.0 environment to 0.6.0"
|
||||||
|
register "upgrade_to_060", :hide => true
|
||||||
|
|
||||||
|
def execute
|
||||||
|
@env.ui.warn "vagrant.commands.upgrade_to_060.info", :_prefix => false
|
||||||
|
@env.ui.warn "", :_translate => false, :_prefix => false
|
||||||
|
if !@env.ui.yes? "vagrant.commands.upgrade_to_060.ask", :_prefix => false, :_color => :yellow
|
||||||
|
@env.ui.info "vagrant.commands.upgrade_to_060.quit", :_prefix => false
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@env.local_data.empty?
|
||||||
|
# Gather the previously set virtual machines into a single
|
||||||
|
# active hash
|
||||||
|
active = @env.local_data.inject({}) do |acc, data|
|
||||||
|
key, uuid = data
|
||||||
|
acc[key.to_sym] = uuid
|
||||||
|
acc
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set the active hash to the active list and save it
|
||||||
|
@env.local_data.clear
|
||||||
|
@env.local_data[:active] = active
|
||||||
|
@env.local_data.commit
|
||||||
|
end
|
||||||
|
|
||||||
|
@env.ui.confirm "vagrant.commands.upgrade_to_060.complete", :_prefix => false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -126,6 +126,16 @@ en:
|
||||||
VM, run `vagrant status NAME`.
|
VM, run `vagrant status NAME`.
|
||||||
up:
|
up:
|
||||||
vm_created: "VM already created. Booting if its not already running..."
|
vm_created: "VM already created. Booting if its not already running..."
|
||||||
|
upgrade_to_060:
|
||||||
|
info: |-
|
||||||
|
This command will upgrade the current environment from a pre-0.6.0
|
||||||
|
environment to a 0.6.x compatible environment. Running this command
|
||||||
|
on a 0.6.0 environment may cause corrupt virtual machines, however,
|
||||||
|
so verify now that this is your first time running this command and
|
||||||
|
that this environment was created pre-0.6.0.
|
||||||
|
ask: "Are you sure you want to execute this command?"
|
||||||
|
quit: "Not executing this command by user request. Quitting..."
|
||||||
|
complete: "Environment upgraded to 0.6.0 successfully."
|
||||||
version:
|
version:
|
||||||
output: "Vagrant version %{version}"
|
output: "Vagrant version %{version}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue