lib/vagrant-sakura/action.rb in vagrant-sakura-0.0.2 vs lib/vagrant-sakura/action.rb in vagrant-sakura-0.0.3
- old
+ new
@@ -41,24 +41,27 @@
b.use ConnectSakura
b.use ListId
end
end
-# def self.action_provision
-# Vagrant::Action::Builder.new.tap do |b|
-# b.use ConfigValidate
-# b.use Call, IsCreated do |env, b2|
-# if !env[:result]
-# b2.use MessageNotCreated
-# next
-# end
-#
-# b2.use Provision
-# b2.use SyncFolders
-# end
-# end
-# end
+ def self.action_provision
+ Vagrant::Action::Builder.new.tap do |b|
+ b.use ConfigValidate
+ b.use ConnectSakura
+ b.use Call, ReadState do |env, b2|
+ case env[:machine_state_id]
+ when :up
+ b2.use Provision
+ b2.use SyncFolders
+ when :down, :cleaning
+ b2.use MessageDown
+ when :not_created
+ b2.use MessageNotCreated
+ end
+ end
+ end
+ end
def self.action_read_ssh_info
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectSakura
@@ -80,11 +83,11 @@
b.use ConnectSakura
b.use Call, ReadState do |env, b2|
case env[:machine_state_id]
when :up
b2.use Reset
- b2.use Provision
+ b2.use action_provision
when :down, :cleaning
b2.use MessageDown
when :not_created
b2.use MessageNotCreated
end
@@ -138,11 +141,11 @@
when :down, :cleaning
b2.use PowerOn
b2.use Provision
when :not_created
b2.use RunInstance
- b2.use Provision
+ b2.use action_provision
end
end
end
end
@@ -159,9 +162,9 @@
autoload :PowerOn, action_root.join("power_on")
autoload :ReadSSHInfo, action_root.join("read_ssh_info")
autoload :ReadState, action_root.join("read_state")
autoload :Reset, action_root.join("reset")
autoload :RunInstance, action_root.join("run_instance")
- #autoload :SyncFolders, action_root.join("sync_folders")
+ autoload :SyncFolders, action_root.join("sync_folders")
end
end
end