vagrant-vmware-desktop 0.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vagrant-vmware-desktop.rb +190 -0
  3. data/lib/vagrant-vmware-desktop/action.rb +442 -0
  4. data/lib/vagrant-vmware-desktop/action/base_mac_to_ip.rb +55 -0
  5. data/lib/vagrant-vmware-desktop/action/boot.rb +26 -0
  6. data/lib/vagrant-vmware-desktop/action/check_existing_network.rb +35 -0
  7. data/lib/vagrant-vmware-desktop/action/check_vmware.rb +28 -0
  8. data/lib/vagrant-vmware-desktop/action/checkpoint.rb +86 -0
  9. data/lib/vagrant-vmware-desktop/action/clear_shared_folders.rb +25 -0
  10. data/lib/vagrant-vmware-desktop/action/common.rb +16 -0
  11. data/lib/vagrant-vmware-desktop/action/compatibility.rb +36 -0
  12. data/lib/vagrant-vmware-desktop/action/created.rb +20 -0
  13. data/lib/vagrant-vmware-desktop/action/destroy.rb +32 -0
  14. data/lib/vagrant-vmware-desktop/action/discard_suspended_state.rb +32 -0
  15. data/lib/vagrant-vmware-desktop/action/export.rb +29 -0
  16. data/lib/vagrant-vmware-desktop/action/fix_old_machine_id.rb +29 -0
  17. data/lib/vagrant-vmware-desktop/action/forward_ports.rb +110 -0
  18. data/lib/vagrant-vmware-desktop/action/halt.rb +27 -0
  19. data/lib/vagrant-vmware-desktop/action/import.rb +138 -0
  20. data/lib/vagrant-vmware-desktop/action/machine_lock.rb +26 -0
  21. data/lib/vagrant-vmware-desktop/action/message_already_running.rb +18 -0
  22. data/lib/vagrant-vmware-desktop/action/message_not_created.rb +18 -0
  23. data/lib/vagrant-vmware-desktop/action/message_not_running.rb +18 -0
  24. data/lib/vagrant-vmware-desktop/action/network.rb +339 -0
  25. data/lib/vagrant-vmware-desktop/action/package_vagrantfile.rb +46 -0
  26. data/lib/vagrant-vmware-desktop/action/prepare_forwarded_port_collision_params.rb +28 -0
  27. data/lib/vagrant-vmware-desktop/action/prepare_nfs_settings.rb +43 -0
  28. data/lib/vagrant-vmware-desktop/action/prepare_synced_folder_cleanup.rb +19 -0
  29. data/lib/vagrant-vmware-desktop/action/prune_forwarded_ports.rb +30 -0
  30. data/lib/vagrant-vmware-desktop/action/prune_nfs_exports.rb +22 -0
  31. data/lib/vagrant-vmware-desktop/action/running.rb +20 -0
  32. data/lib/vagrant-vmware-desktop/action/set_display_name.rb +37 -0
  33. data/lib/vagrant-vmware-desktop/action/share_folders.rb +97 -0
  34. data/lib/vagrant-vmware-desktop/action/snapshot_delete.rb +26 -0
  35. data/lib/vagrant-vmware-desktop/action/snapshot_restore.rb +26 -0
  36. data/lib/vagrant-vmware-desktop/action/snapshot_save.rb +26 -0
  37. data/lib/vagrant-vmware-desktop/action/suspend.rb +26 -0
  38. data/lib/vagrant-vmware-desktop/action/suspended.rb +24 -0
  39. data/lib/vagrant-vmware-desktop/action/vmx_modify.rb +39 -0
  40. data/lib/vagrant-vmware-desktop/action/wait_for_address.rb +31 -0
  41. data/lib/vagrant-vmware-desktop/action/wait_for_communicator_compat.rb +32 -0
  42. data/lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb +35 -0
  43. data/lib/vagrant-vmware-desktop/cap/disk.rb +287 -0
  44. data/lib/vagrant-vmware-desktop/cap/provider.rb +37 -0
  45. data/lib/vagrant-vmware-desktop/cap/snapshot.rb +41 -0
  46. data/lib/vagrant-vmware-desktop/checkpoint_client.rb +203 -0
  47. data/lib/vagrant-vmware-desktop/config.rb +377 -0
  48. data/lib/vagrant-vmware-desktop/constants.rb +16 -0
  49. data/lib/vagrant-vmware-desktop/driver.rb +15 -0
  50. data/lib/vagrant-vmware-desktop/driver/base.rb +1356 -0
  51. data/lib/vagrant-vmware-desktop/errors.rb +342 -0
  52. data/lib/vagrant-vmware-desktop/guest_cap/linux/mount_vmware_shared_folder.rb +158 -0
  53. data/lib/vagrant-vmware-desktop/guest_cap/linux/verify_vmware_hgfs.rb +27 -0
  54. data/lib/vagrant-vmware-desktop/helper/lock.rb +26 -0
  55. data/lib/vagrant-vmware-desktop/helper/routing_table.rb +182 -0
  56. data/lib/vagrant-vmware-desktop/helper/vagrant_utility.rb +185 -0
  57. data/lib/vagrant-vmware-desktop/plugin.rb +148 -0
  58. data/lib/vagrant-vmware-desktop/provider.rb +96 -0
  59. data/lib/vagrant-vmware-desktop/setup_plugin.rb +24 -0
  60. data/lib/vagrant-vmware-desktop/synced_folder.rb +93 -0
  61. data/locales/en.yml +634 -0
  62. metadata +71 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53598ea53b7092a15c117fec30ca59e241510adeb17364db0839b7f63d25d2b1
4
- data.tar.gz: 6821d0d58b5fb45c3ac1ce1f5d86c269cba46891a3ae749dcca443754fbc1bdb
3
+ metadata.gz: bdcfbbb304726e177ac071a8842c567ca35ebac76acb944b8b787b4a3c8b95d6
4
+ data.tar.gz: b871eaf2ccfdf8fb33384feb5c050e8b4e45daf61557158af7c23f7b57b9bf80
5
5
  SHA512:
6
- metadata.gz: 4953365e900bddd7d3153c0c3b65c9d726d7c2bf217f6f80afa3073942a4a9bf5759bfcd670fbf4c0876f48b7f2d850f5b09db9705ded914b696477d691c2158
7
- data.tar.gz: d88889a1e5795ff85510cb0756e5d6c7d0fd3a034dea017045bf2b4a7d9dce80d185dce16b965c391dfb60eb6da41499b8469fbe58c22916bd35e1c9cca88a87
6
+ metadata.gz: 6efa97edc063503dfa6d858160a23d57e0ff73f66cf4f09b9bc16027b9f2fc1000c41536ab9dd16c24e69b417cc9d17c1fec26d6dec6e3ecb37e94af701c64c7
7
+ data.tar.gz: ae05d94217266dedfb30bdbc392c05ec67a97f1604c17c51810b2cc8df1ae71af1b2e39246b9dcb41373826147b4ef2b286d8d28c4ad00d111ab7ecff588e6b8
@@ -0,0 +1,190 @@
1
+ require "rbconfig"
2
+ require "pathname"
3
+ require "fileutils"
4
+
5
+ require "vagrant-vmware-desktop/constants"
6
+ require "vagrant-vmware-desktop/plugin"
7
+
8
+ module HashiCorp
9
+ module VagrantVMwareDesktop
10
+
11
+ # List of plugins that are incompatible with this plugin. These
12
+ # are the deprecated versions of the VMware plugin that this
13
+ # plugin replaces.
14
+ CONFLICTING_GEMS = [
15
+ "vagrant-vmware-fusion",
16
+ "vagrant-vmware-workstation"
17
+ ].map(&:freeze).freeze
18
+
19
+ lib_path = Pathname.new(File.expand_path("../vagrant-vmware-desktop", __FILE__))
20
+ autoload :Action, lib_path.join("action")
21
+ autoload :Driver, lib_path.join("driver")
22
+ autoload :Errors, lib_path.join("errors")
23
+ autoload :SudoHelper, lib_path.join("sudo_helper")
24
+
25
+ # This initializes the i18n load path so that the plugin-specific
26
+ # translations work.
27
+ def self.init_i18n
28
+ I18n.load_path << File.expand_path("locales/en.yml", source_root)
29
+ I18n.reload!
30
+ end
31
+
32
+ # This initializes the logging so that our logs are outputted at
33
+ # the same level as Vagrant core logs.
34
+ def self.init_logging
35
+ # Initialize logging
36
+ level = nil
37
+ begin
38
+ level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase)
39
+ rescue NameError
40
+ # This means that the logging constant wasn't found,
41
+ # which is fine. We just keep `level` as `nil`. But
42
+ # we tell the user.
43
+ level = nil
44
+ end
45
+
46
+ # Some constants, such as "true" resolve to booleans, so the
47
+ # above error checking doesn't catch it. This will check to make
48
+ # sure that the log level is an integer, as Log4r requires.
49
+ level = nil if !level.is_a?(Integer)
50
+
51
+ # Set the logging level on all "vagrant" namespaced
52
+ # logs as long as we have a valid level.
53
+ if level
54
+ logger = Log4r::Logger.new("hashicorp")
55
+ logger.outputters = Log4r::Outputter.stderr
56
+ logger.level = level
57
+ logger = nil
58
+ end
59
+ end
60
+
61
+ # This returns the path to the source of this plugin.
62
+ #
63
+ # @return [Pathname]
64
+ def self.source_root
65
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
66
+ end
67
+
68
+ # These WSL methods are wrappers so things work
69
+ # gracefully on different versions of Vagrant that
70
+ # may have all, some, or none of the methods available
71
+ # that we need.
72
+
73
+
74
+ # Detect if inside WSL
75
+ #
76
+ # @return [Boolean]
77
+ def self.wsl?
78
+ Vagrant::Util::Platform.respond_to?(:wsl?) &&
79
+ Vagrant::Util::Platform.wsl?
80
+ end
81
+
82
+ # Convert WSL path to a Windows path
83
+ #
84
+ # @param [String, Pathname] path
85
+ # @return [String]
86
+ def self.wsl_to_windows_path(path)
87
+ if wsl?
88
+ oval = ENV["VAGRANT_WSL_ENABLE_WINDOWS_ACCESS"]
89
+ ENV["VAGRANT_WSL_ENABLE_WINDOWS_ACCESS"] = "1"
90
+ path = Vagrant::Util::Platform.wsl_to_windows_path(path.to_s)
91
+ ENV["VAGRANT_WSL_ENABLE_WINDOWS_ACCESS"] = oval
92
+ return "//?/#{path}".tr("/", 92.chr)
93
+ end
94
+ if Vagrant::Util::Platform.windows?
95
+ path.to_s.tr("/", 92.chr)
96
+ else
97
+ path.to_s
98
+ end
99
+ end
100
+
101
+ # Convert Windows path to WSL path
102
+ #
103
+ # @param [String, Pathname] path
104
+ # @return [String]
105
+ def self.windows_to_wsl_path(path)
106
+ if wsl?
107
+ if Vagrant::Util::Platform.respond_to?(:windows_to_wsl_path)
108
+ return Vagrant::Util::Platform.windows_to_wsl_path(path.to_s)
109
+ elsif path.match(/^[A-Za-z]:/)
110
+ return "/mnt/#{path[0, 1].downcase}#{path[2..-1].tr(92.chr, '/')}"
111
+ end
112
+ end
113
+ path.to_s
114
+ end
115
+
116
+ # Check if path is located on DrvFs file system
117
+ #
118
+ # @param [String, Pathname]
119
+ # @return [Boolean]
120
+ def self.wsl_drvfs_path?(path)
121
+ path = path.to_s
122
+ if Vagrant::Util::Platform.respond_to?(:wsl_drvfs_path?)
123
+ return Vagrant::Util::Platform.wsl_drvfs_path?(path)
124
+ end
125
+ if wsl?
126
+ return Vagrant::Util::Platform.wsl_windows_access_bypass?(path)
127
+ end
128
+ false
129
+ end
130
+
131
+ # Check if path is case sensitive
132
+ #
133
+ # @param [String, Pathname] path to check (must exist)
134
+ # @return [Boolean]
135
+ def self.case_sensitive_fs?(path)
136
+ !case_sensitive_fs(path)
137
+ end
138
+
139
+ # Check if path is case insensitive
140
+ #
141
+ # @param [String, Pathname] path to check (must exist)
142
+ # @return [Boolean]
143
+ def self.case_insensitive_fs?(path)
144
+ begin
145
+ FileUtils.compare_file(path.to_s, path.to_s.downcase)
146
+ rescue Errno::ENOENT
147
+ false
148
+ end
149
+ end
150
+
151
+ # Checks for a valid installation state. Raises exception if
152
+ # invalid state detected.
153
+ #
154
+ # @return [NilClass]
155
+ # @raises [StandardError]
156
+ def self.validate_install!
157
+ CONFLICTING_GEMS.each do |libname|
158
+ if !Gem::Specification.find_all_by_name(libname).empty?
159
+ $stderr.puts <<-EOF
160
+ ERROR: Vagrant has detected an incompatible plugin installed. Please uninstall
161
+ the `#{libname}` plugin and run the command again. To uninstall the plugin,
162
+ run the command shown below:
163
+
164
+ vagrant plugin uninstall #{libname}
165
+
166
+ EOF
167
+ raise "Plugin conflict"
168
+ end
169
+ end
170
+ end
171
+
172
+ # Check for any deprecated suid binaries from previous
173
+ # vmware plugin installations and remove them
174
+ def self.orphan_artifact_cleanup!
175
+ if !Vagrant::Util::Platform.windows?
176
+ glob_path = Vagrant.user_data_path.join("gems", "**", "**", "vagrant-vmware-{workstation,fusion}*").to_s
177
+ Dir.glob(glob_path).each do |del_path|
178
+ FileUtils.rm_rf(del_path) if File.directory?(del_path)
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
184
+
185
+ # Validation the installation
186
+ HashiCorp::VagrantVMwareDesktop.validate_install!
187
+
188
+ # Remove any artifacts that may exist from
189
+ # previous plugin installations
190
+ HashiCorp::VagrantVMwareDesktop.orphan_artifact_cleanup!
@@ -0,0 +1,442 @@
1
+ require "pathname"
2
+
3
+ require "vagrant/action/builder"
4
+
5
+ require "vagrant/action/general/package"
6
+ require "vagrant/action/general/package_setup_folders"
7
+ require "vagrant/action/general/package_setup_files"
8
+
9
+ module HashiCorp
10
+ module VagrantVMwareDesktop
11
+ module Action
12
+ # Include the built-in modules so we can use them as top-level things.
13
+ include Vagrant::Action::Builtin
14
+ include Vagrant::Action::General
15
+
16
+ autoload :BaseMacToIp, "vagrant-vmware-desktop/action/base_mac_to_ip"
17
+ autoload :Boot, "vagrant-vmware-desktop/action/boot"
18
+ autoload :CheckExistingNetwork, "vagrant-vmware-desktop/action/check_existing_network"
19
+ autoload :CheckVMware, "vagrant-vmware-desktop/action/check_vmware"
20
+ autoload :ClearSharedFolders, "vagrant-vmware-desktop/action/clear_shared_folders"
21
+ autoload :Checkpoint, "vagrant-vmware-desktop/action/checkpoint"
22
+ autoload :Compatibility, "vagrant-vmware-desktop/action/compatibility"
23
+ autoload :Common, "vagrant-vmware-desktop/action/common"
24
+ autoload :Created, "vagrant-vmware-desktop/action/created"
25
+ autoload :Destroy, "vagrant-vmware-desktop/action/destroy"
26
+ autoload :DiscardSuspendedState, "vagrant-vmware-desktop/action/discard_suspended_state"
27
+ autoload :Export, "vagrant-vmware-desktop/action/export"
28
+ autoload :FixOldMachineID, "vagrant-vmware-desktop/action/fix_old_machine_id"
29
+ autoload :ForwardPorts, "vagrant-vmware-desktop/action/forward_ports"
30
+ autoload :Halt, "vagrant-vmware-desktop/action/halt"
31
+ autoload :Import, "vagrant-vmware-desktop/action/import"
32
+ autoload :MachineLock, "vagrant-vmware-desktop/action/machine_lock"
33
+ autoload :MessageAlreadyRunning, "vagrant-vmware-desktop/action/message_already_running"
34
+ autoload :MessageNotCreated, "vagrant-vmware-desktop/action/message_not_created"
35
+ autoload :MessageNotRunning, "vagrant-vmware-desktop/action/message_not_running"
36
+ autoload :Network, "vagrant-vmware-desktop/action/network"
37
+ autoload :PackageVagrantfile, "vagrant-vmware-desktop/action/package_vagrantfile"
38
+ autoload :PrepareNFSSettings, "vagrant-vmware-desktop/action/prepare_nfs_settings"
39
+ autoload :PrepareForwardedPortCollisionParams, "vagrant-vmware-desktop/action/prepare_forwarded_port_collision_params"
40
+ autoload :PrepareSyncedFolderCleanup, "vagrant-vmware-desktop/action/prepare_synced_folder_cleanup"
41
+ autoload :PruneForwardedPorts, "vagrant-vmware-desktop/action/prune_forwarded_ports"
42
+ autoload :PruneNFSExports, "vagrant-vmware-desktop/action/prune_nfs_exports"
43
+ autoload :Running, "vagrant-vmware-desktop/action/running"
44
+ autoload :SetDisplayName, "vagrant-vmware-desktop/action/set_display_name"
45
+ autoload :ShareFolders, "vagrant-vmware-desktop/action/share_folders"
46
+ autoload :SnapshotDelete, "vagrant-vmware-desktop/action/snapshot_delete"
47
+ autoload :SnapshotRestore, "vagrant-vmware-desktop/action/snapshot_restore"
48
+ autoload :SnapshotSave, "vagrant-vmware-desktop/action/snapshot_save"
49
+ autoload :Suspend, "vagrant-vmware-desktop/action/suspend"
50
+ autoload :Suspended, "vagrant-vmware-desktop/action/suspended"
51
+ autoload :VMXModify, "vagrant-vmware-desktop/action/vmx_modify"
52
+ autoload :WaitForAddress, "vagrant-vmware-desktop/action/wait_for_address"
53
+ autoload :WaitForCommunicator, "vagrant-vmware-desktop/action/wait_for_communicator_compat"
54
+ autoload :WaitForVMXHalt, "vagrant-vmware-desktop/action/wait_for_vmx_halt"
55
+
56
+ # This action is called to destroy a VM.
57
+ def self.action_destroy
58
+ Vagrant::Action::Builder.new.tap do |b|
59
+ b.use Compatibility
60
+
61
+ if Vagrant::VERSION < "1.6.0"
62
+ b.use MachineLock
63
+ end
64
+
65
+ b.use FixOldMachineID
66
+ b.use Call, Created do |env1, b2|
67
+ if !env1[:result]
68
+ b2.use MessageNotCreated
69
+ next
70
+ end
71
+
72
+ b2.use Call, DestroyConfirm do |env2, b3|
73
+ if env2[:result]
74
+ b3.use ConfigValidate
75
+ b3.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup)
76
+ b3.use EnvSet, :force_halt => env2.key?(:force_halt) ? env2[:force_halt] : true
77
+ b3.use action_halt
78
+ b3.use Destroy
79
+ b3.use PruneForwardedPorts
80
+
81
+ if Vagrant::VERSION < "1.4.0"
82
+ b3.use PruneNFSExports
83
+ else
84
+ b3.use PrepareSyncedFolderCleanup
85
+ b3.use SyncedFolderCleanup
86
+ end
87
+ end
88
+ end
89
+ end
90
+ b.use Checkpoint
91
+ end
92
+ end
93
+
94
+ # This action is called to stop a running VM.
95
+ def self.action_halt
96
+ Vagrant::Action::Builder.new.tap do |b|
97
+ b.use Compatibility
98
+ b.use ConfigValidate
99
+ b.use FixOldMachineID
100
+ b.use CheckVMware
101
+
102
+ if Vagrant::VERSION < "1.6.0"
103
+ b.use MachineLock
104
+ end
105
+
106
+ b.use Call, Created do |env1, b2|
107
+ if !env1[:result]
108
+ b2.use MessageNotCreated
109
+ next
110
+ end
111
+
112
+ b2.use DiscardSuspendedState
113
+ b2.use Call, Running do |env2, b3|
114
+ if env2[:result]
115
+ b3.use Call, GracefulHalt, :not_running, :running do |env3, b4|
116
+ if !env3[:result]
117
+ b4.use DiscardSuspendedState
118
+ b4.use Halt
119
+ end
120
+
121
+ b4.use WaitForVMXHalt
122
+ end
123
+ end
124
+ end
125
+ end
126
+ b.use Checkpoint
127
+ end
128
+ end
129
+
130
+ # This action is called to package a VM.
131
+ def self.action_package
132
+ Vagrant::Action::Builder.new.tap do |b|
133
+ b.use Compatibility
134
+ b.use ConfigValidate
135
+ b.use FixOldMachineID
136
+
137
+ b.use Call, Created do |env1, b2|
138
+ if !env1[:result]
139
+ b2.use MessageNotCreated
140
+ next
141
+ end
142
+
143
+ b2.use PackageSetupFolders
144
+ b2.use PackageSetupFiles
145
+ b2.use action_halt
146
+ b2.use PruneForwardedPorts
147
+ b2.use PrepareSyncedFolderCleanup
148
+ b2.use SyncedFolderCleanup
149
+ b2.use Package
150
+ b2.use Export
151
+ b2.use PackageVagrantfile
152
+ end
153
+ b.use Checkpoint
154
+ end
155
+ end
156
+
157
+ # This action is called to provision a VM.
158
+ def self.action_provision
159
+ Vagrant::Action::Builder.new.tap do |b|
160
+ b.use Compatibility
161
+ b.use ConfigValidate
162
+ b.use FixOldMachineID
163
+
164
+ b.use Call, Created do |env1, b2|
165
+ if !env1[:result]
166
+ b2.use MessageNotCreated
167
+ next
168
+ end
169
+
170
+ b2.use Call, Running do |env2, b3|
171
+ if !env2[:result]
172
+ raise Vagrant::Errors::VMNotRunningError
173
+ end
174
+
175
+ b3.use Provision
176
+ end
177
+ end
178
+ b.use Checkpoint
179
+ end
180
+ end
181
+
182
+ # This action is called when the VM is to be stopped then started.
183
+ def self.action_reload
184
+ Vagrant::Action::Builder.new.tap do |b|
185
+ b.use Compatibility
186
+ b.use FixOldMachineID
187
+ b.use Call, Created do |env1, b2|
188
+ if !env1[:result]
189
+ b2.use MessageNotCreated
190
+ next
191
+ end
192
+
193
+ b2.use action_halt
194
+ b2.use action_start
195
+ end
196
+ b.use Checkpoint
197
+ end
198
+ end
199
+
200
+ # This action is called when the VM is to be resumed.
201
+ def self.action_resume
202
+ Vagrant::Action::Builder.new.tap do |b|
203
+ b.use Compatibility
204
+ b.use ConfigValidate
205
+ b.use FixOldMachineID
206
+ b.use CheckVMware
207
+ b.use Call, Created do |env1, b2|
208
+ if !env1[:result]
209
+ b2.use MessageNotCreated
210
+ next
211
+ end
212
+
213
+ b2.use action_start
214
+ end
215
+ b.use Checkpoint
216
+ end
217
+ end
218
+
219
+ # This action is called to delete a snapshot.
220
+ def self.action_snapshot_delete
221
+ Vagrant::Action::Builder.new.tap do |b|
222
+ b.use Compatibility
223
+ b.use ConfigValidate
224
+ b.use FixOldMachineID
225
+ b.use CheckVMware
226
+
227
+ b.use Call, Created do |env1, b2|
228
+ if !env1[:result]
229
+ b2.use MessageNotCreated
230
+ next
231
+ end
232
+
233
+ b2.use SnapshotDelete
234
+ end
235
+ b.use Checkpoint
236
+ end
237
+ end
238
+
239
+ # This action is called to restore a snapshot.
240
+ def self.action_snapshot_restore
241
+ Vagrant::Action::Builder.new.tap do |b|
242
+ b.use Compatibility
243
+ b.use ConfigValidate
244
+ b.use FixOldMachineID
245
+ b.use CheckVMware
246
+
247
+ b.use Call, Created do |env1, b2|
248
+ if !env1[:result]
249
+ b2.use MessageNotCreated
250
+ next
251
+ end
252
+
253
+ b2.use SnapshotRestore
254
+ b2.use action_start
255
+ end
256
+ b.use Checkpoint
257
+ end
258
+ end
259
+
260
+ # This action is called to save a snapshot.
261
+ def self.action_snapshot_save
262
+ Vagrant::Action::Builder.new.tap do |b|
263
+ b.use Compatibility
264
+ b.use ConfigValidate
265
+ b.use FixOldMachineID
266
+ b.use CheckVMware
267
+
268
+ b.use Call, Created do |env1, b2|
269
+ if !env1[:result]
270
+ b2.use MessageNotCreated
271
+ next
272
+ end
273
+
274
+ b2.use SnapshotSave
275
+ end
276
+ b.use Checkpoint
277
+ end
278
+ end
279
+
280
+ # This action is called to SSH into the machine.
281
+ def self.action_ssh
282
+ Vagrant::Action::Builder.new.tap do |b|
283
+ b.use Compatibility
284
+ b.use ConfigValidate
285
+ b.use FixOldMachineID
286
+ b.use CheckVMware
287
+ b.use SSHExec
288
+ b.use Checkpoint
289
+ end
290
+ end
291
+
292
+ # This action is called that will run a single SSH command.
293
+ def self.action_ssh_run
294
+ Vagrant::Action::Builder.new.tap do |b|
295
+ b.use Compatibility
296
+ b.use ConfigValidate
297
+ b.use FixOldMachineID
298
+ b.use CheckVMware
299
+ b.use Call, Created do |env1, b2|
300
+ if !env1[:result]
301
+ b2.use MessageNotCreated
302
+ next
303
+ end
304
+
305
+ b2.use Call, Running do |env2, b3|
306
+ if !env2[:result]
307
+ raise Vagrant::Errors::VMNotRunningError
308
+ end
309
+
310
+ b3.use SSHRun
311
+ end
312
+ end
313
+ b.use Checkpoint
314
+ end
315
+ end
316
+
317
+ # This action starts the VM, from whatever state it may be.
318
+ def self.action_start
319
+ Vagrant::Action::Builder.new.tap do |b|
320
+ b.use Compatibility
321
+ b.use FixOldMachineID
322
+
323
+ if Vagrant::VERSION >= "1.5.0"
324
+ b.use BoxCheckOutdated
325
+ end
326
+
327
+ b.use Call, Running do |env, b2|
328
+ if env[:result]
329
+ b2.use MessageAlreadyRunning
330
+ next
331
+ end
332
+
333
+ b2.use CheckExistingNetwork
334
+ b2.use PruneForwardedPorts
335
+ b2.use Call, Suspended do |env2, b3|
336
+ # If it is suspended then the following have no effect
337
+ if !env2[:result]
338
+ if Vagrant::VERSION < "1.6.0"
339
+ b3.use MachineLock
340
+ end
341
+
342
+ b3.use Provision
343
+
344
+ if Vagrant::VERSION < "1.4.0"
345
+ b3.use PruneNFSExports
346
+ b3.use NFS
347
+ b3.use ClearSharedFolders
348
+ b3.use ShareFolders
349
+ else
350
+ b3.use PrepareSyncedFolderCleanup
351
+ b3.use SyncedFolderCleanup
352
+ b3.use SyncedFolders
353
+ end
354
+
355
+ b3.use PrepareNFSSettings
356
+ b3.use Network
357
+ b3.use BaseMacToIp
358
+ b3.use SetHostname
359
+ end
360
+
361
+ Vagrant::Util::Experimental.guard_with(:disks) do
362
+ b3.use CleanupDisks
363
+ b3.use Disk
364
+ end
365
+ b3.use VMXModify
366
+ b3.use PrepareForwardedPortCollisionParams
367
+ b3.use HandleForwardedPortCollisions
368
+ b3.use Boot
369
+ b3.use WaitForAddress
370
+ b3.use ForwardPorts
371
+
372
+ if Vagrant::VERSION < "1.3.0"
373
+ b3.use WaitForCommunicatorCompat
374
+ else
375
+ b3.use WaitForCommunicator
376
+ end
377
+ end
378
+ end
379
+ b.use Checkpoint
380
+ end
381
+ end
382
+
383
+ # This action is called to stop a running VM.
384
+ def self.action_suspend
385
+ Vagrant::Action::Builder.new.tap do |b|
386
+ b.use Compatibility
387
+ b.use ConfigValidate
388
+ b.use FixOldMachineID
389
+ b.use CheckVMware
390
+ b.use Call, Created do |env1, b2|
391
+ if !env1[:result]
392
+ b2.use MessageNotCreated
393
+ next
394
+ end
395
+
396
+ b2.use Suspend
397
+ end
398
+ b.use Checkpoint
399
+ end
400
+ end
401
+
402
+ # This action is called to bring the box up from nothing.
403
+ def self.action_up
404
+ Vagrant::Action::Builder.new.tap do |b|
405
+ b.use Compatibility
406
+ b.use ConfigValidate
407
+ b.use FixOldMachineID
408
+ b.use CheckVMware
409
+
410
+ if Vagrant::VERSION < "1.6.0"
411
+ b.use MachineLock
412
+ end
413
+
414
+
415
+ b.use Call, Created do |env1, b2|
416
+ if !env1[:result]
417
+ # If it is not created, then we need to grab the box,
418
+ # import it, and so on.
419
+ if Vagrant::VERSION < "1.5.0"
420
+ b2.use HandleBoxUrl
421
+ else
422
+ b2.use HandleBox
423
+ end
424
+
425
+ # Vagrant 1.8 added config.vm.clone. We do some things
426
+ # to get ready for it here.
427
+ if Vagrant::VERSION >= "1.8.0"
428
+ b2.use PrepareClone
429
+ end
430
+
431
+ b2.use Import
432
+ b2.use SetDisplayName
433
+ end
434
+
435
+ b2.use action_start
436
+ end
437
+ b.use Checkpoint
438
+ end
439
+ end
440
+ end
441
+ end
442
+ end