Move the VM accessible check into more relevant actions

This commit is contained in:
Mitchell Hashimoto 2011-12-03 15:37:13 -08:00
parent c37f16b754
commit cb8d00b55f
1 changed files with 9 additions and 1 deletions

View File

@ -7,12 +7,14 @@ module Vagrant
def self.builtin! def self.builtin!
# provision - Provisions a running VM # provision - Provisions a running VM
register(:provision, Builder.new do register(:provision, Builder.new do
use VM::CheckAccessible
use VM::Provision use VM::Provision
end) end)
# start - Starts a VM, assuming it already exists on the # start - Starts a VM, assuming it already exists on the
# environment. # environment.
register(:start, Builder.new do register(:start, Builder.new do
use VM::CheckAccessible
use VM::CleanMachineFolder use VM::CleanMachineFolder
use VM::ClearForwardedPorts use VM::ClearForwardedPorts
use VM::ForwardPorts use VM::ForwardPorts
@ -30,28 +32,33 @@ module Vagrant
# halt - Halts the VM, attempting gracefully but then forcing # halt - Halts the VM, attempting gracefully but then forcing
# a restart if fails. # a restart if fails.
register(:halt, Builder.new do register(:halt, Builder.new do
use VM::CheckAccessible
use VM::DiscardState use VM::DiscardState
use VM::Halt use VM::Halt
end) end)
# suspend - Suspends the VM # suspend - Suspends the VM
register(:suspend, Builder.new do register(:suspend, Builder.new do
use VM::CheckAccessible
use VM::Suspend use VM::Suspend
end) end)
# resume - Resume a VM # resume - Resume a VM
register(:resume, Builder.new do register(:resume, Builder.new do
use VM::CheckAccessible
use VM::Resume use VM::Resume
end) end)
# reload - Halts then restarts the VM # reload - Halts then restarts the VM
register(:reload, Builder.new do register(:reload, Builder.new do
use VM::CheckAccessible
use Action[:halt] use Action[:halt]
use Action[:start] use Action[:start]
end) end)
# up - Imports, prepares, then starts a fresh VM. # up - Imports, prepares, then starts a fresh VM.
register(:up, Builder.new do register(:up, Builder.new do
use VM::CheckAccessible
use VM::CheckBox use VM::CheckBox
use VM::Import use VM::Import
use VM::MatchMACAddress use VM::MatchMACAddress
@ -61,6 +68,7 @@ module Vagrant
# destroy - Halts, cleans up, and destroys an existing VM # destroy - Halts, cleans up, and destroys an existing VM
register(:destroy, Builder.new do register(:destroy, Builder.new do
use VM::CheckAccessible
use Action[:halt], :force => true use Action[:halt], :force => true
use VM::ProvisionerCleanup use VM::ProvisionerCleanup
use VM::ClearNFSExports use VM::ClearNFSExports
@ -71,6 +79,7 @@ module Vagrant
# package - Export and package the VM # package - Export and package the VM
register(:package, Builder.new do register(:package, Builder.new do
use VM::CheckAccessible
use Action[:halt] use Action[:halt]
use VM::ClearForwardedPorts use VM::ClearForwardedPorts
use VM::ClearSharedFolders use VM::ClearSharedFolders
@ -101,7 +110,6 @@ module Vagrant
# now, these are limited to what are needed internally. # now, these are limited to what are needed internally.
register(:before_action_run, Builder.new do register(:before_action_run, Builder.new do
use General::Validate use General::Validate
use VM::CheckAccessible
end) end)
end end
end end