lib/vagrant-parallels/action.rb in vagrant-parallels-0.2.0 vs lib/vagrant-parallels/action.rb in vagrant-parallels-0.2.1
- old
+ new
@@ -10,10 +10,11 @@
# This action boots the VM, assuming the VM is in a state that requires
# a bootup (i.e. not saved).
def self.action_boot
Vagrant::Action::Builder.new.tap do |b|
b.use CheckAccessible
+ b.use SetName
# b.use ClearForwardedPorts
b.use Provision
b.use EnvSet, :port_collision_repair => true
# b.use PrepareForwardedPortCollisionParams
# b.use HandleForwardedPortCollisions
@@ -27,11 +28,11 @@
b.use SetHostname
# b.use SaneDefaults
b.use Customize, "pre-boot"
b.use Boot
b.use Customize, "post-boot"
- b.use WaitForCommunicator
+ b.use WaitForCommunicator, [:starting, :running]
b.use CheckGuestTools
end
end
# This is the action that is primarily responsible for completely
@@ -49,13 +50,13 @@
if env2[:result]
b3.use ConfigValidate
b3.use CheckAccessible
b3.use EnvSet, :force_halt => true
b3.use action_halt
- b3.use UnregisterTemplate
b3.use Destroy
b3.use DestroyUnusedNetworkInterfaces
+ b3.use ProvisionerCleanup
b3.use PrepareNFSValidIds
b3.use SyncedFolderCleanup
else
b3.use MessageWillNotDestroy
end
@@ -104,13 +105,13 @@
b2.use CheckAccessible
b2.use action_halt
#b2.use ClearForwardedPorts
b2.use PrepareNFSValidIds
b2.use SyncedFolderCleanup
+ b2.use Package
b2.use Export
b2.use PackageConfigFiles
- b2.use Package
end
end
end
# This action just runs the provisioners on the machine.
@@ -164,10 +165,11 @@
b.use Call, Created do |env, b2|
if env[:result]
b2.use CheckAccessible
b2.use EnvSet, :port_collision_repair => false
b2.use Resume
+ b2.use WaitForCommunicator, [:resuming, :running]
else
b2.use MessageNotCreated
end
end
end
@@ -234,25 +236,33 @@
b2.use Suspend
else
b2.use MessageNotCreated
end
end
-
end
end
# This action brings the machine up from nothing, including importing
# the box, configuring metadata, and booting.
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
b.use CheckParallels
+
+ # Handle box_url downloading early so that if the Vagrantfile
+ # references any files in the box or something it all just
+ # works fine.
+ b.use Call, Created do |env, b2|
+ if !env[:result]
+ b2.use HandleBoxUrl
+ end
+ end
+
b.use ConfigValidate
b.use Call, Created do |env, b2|
# If the VM is NOT created yet, then do the setup steps
if !env[:result]
b2.use CheckAccessible
- b2.use HandleBoxUrl
b2.use RegisterTemplate
b2.use Customize, "pre-import"
b2.use Import
b2.use UnregisterTemplate
b2.use MatchMACAddress
@@ -289,9 +299,10 @@
autoload :PrepareNFSSettings, File.expand_path("../action/prepare_nfs_settings", __FILE__)
autoload :PrepareNFSValidIds, File.expand_path("../action/prepare_nfs_valid_ids", __FILE__)
autoload :RegisterTemplate, File.expand_path("../action/register_template", __FILE__)
autoload :Resume, File.expand_path("../action/resume", __FILE__)
autoload :SetupPackageFiles, File.expand_path("../action/setup_package_files", __FILE__)
+ autoload :SetName, File.expand_path("../action/set_name", __FILE__)
autoload :Suspend, File.expand_path("../action/suspend", __FILE__)
autoload :UnregisterTemplate, File.expand_path("../action/unregister_template", __FILE__)
end
end