Module: VagrantPlugins::ProviderVeertu::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-veertu/action.rb,
lib/vagrant-veertu/action/boot.rb,
lib/vagrant-veertu/action/export.rb,
lib/vagrant-veertu/action/import.rb,
lib/vagrant-veertu/action/resume.rb,
lib/vagrant-veertu/action/created.rb,
lib/vagrant-veertu/action/destroy.rb,
lib/vagrant-veertu/action/network.rb,
lib/vagrant-veertu/action/package.rb,
lib/vagrant-veertu/action/suspend.rb,
lib/vagrant-veertu/action/is_saved.rb,
lib/vagrant-veertu/action/set_name.rb,
lib/vagrant-veertu/action/customize.rb,
lib/vagrant-veertu/action/is_paused.rb,
lib/vagrant-veertu/action/is_running.rb,
lib/vagrant-veertu/action/forced_halt.rb,
lib/vagrant-veertu/action/check_veertu.rb,
lib/vagrant-veertu/action/check_created.rb,
lib/vagrant-veertu/action/check_running.rb,
lib/vagrant-veertu/action/discard_state.rb,
lib/vagrant-veertu/action/forward_ports.rb,
lib/vagrant-veertu/action/sane_defaults.rb,
lib/vagrant-veertu/action/snapshot_save.rb,
lib/vagrant-veertu/action/snapshot_delete.rb,
lib/vagrant-veertu/action/check_accessible.rb,
lib/vagrant-veertu/action/network_fix_ipv6.rb,
lib/vagrant-veertu/action/snapshot_restore.rb,
lib/vagrant-veertu/action/message_not_created.rb,
lib/vagrant-veertu/action/message_not_running.rb,
lib/vagrant-veertu/action/package_vagrantfile.rb,
lib/vagrant-veertu/action/setup_package_files.rb,
lib/vagrant-veertu/action/prepare_nfs_settings.rb,
lib/vagrant-veertu/action/clear_forwarded_ports.rb,
lib/vagrant-veertu/action/prepare_nfs_valid_ids.rb,
lib/vagrant-veertu/action/message_already_running.rb,
lib/vagrant-veertu/action/clear_network_interfaces.rb,
lib/vagrant-veertu/action/message_will_not_destroy.rb,
lib/vagrant-veertu/action/prepare_forwarded_port_collision_params.rb
Defined Under Namespace
Classes: Boot, CheckAccessible, CheckCreated, CheckRunning, CheckVeertu, ClearForwardedPorts, ClearNetworkInterfaces, Created, Customize, Destroy, DiscardState, Export, ForcedHalt, ForwardPorts, Import, IsPaused, IsRunning, IsSaved, MessageAlreadyRunning, MessageNotCreated, MessageNotRunning, MessageWillNotDestroy, Network, NetworkFixIPv6, Package, PackageVagrantfile, PrepareForwardedPortCollisionParams, PrepareNFSSettings, PrepareNFSValidIds, Resume, SaneDefaults, SetName, SetupPackageFiles, SnapshotDelete, SnapshotRestore, SnapshotSave, Suspend
Class Method Summary collapse
-
.action_boot ⇒ Object
This action boots the VM, assuming the VM is in a state that requires a bootup (i.e. not saved).
-
.action_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
-
.action_halt ⇒ Object
This is the action that is primarily responsible for halting the virtual machine, gracefully or by force.
-
.action_package ⇒ Object
This action packages the virtual machine into a single box file.
-
.action_provision ⇒ Object
This action just runs the provisioners on the machine.
-
.action_reload ⇒ Object
This action is responsible for reloading the machine, which brings it down, sucks in new configuration, and brings the machine back up with the new configuration.
-
.action_resume ⇒ Object
This is the action that is primarily responsible for resuming suspended machines.
-
.action_ssh ⇒ Object
This is the action that will exec into an SSH shell.
-
.action_ssh_run ⇒ Object
This is the action that will run a single SSH command.
-
.action_start ⇒ Object
This action starts a VM, assuming it is already imported and exists.
-
.action_suspend ⇒ Object
This is the action that is primarily responsible for suspending the virtual machine.
-
.action_sync_folders ⇒ Object
This is the action that is called to sync folders to a running machine without a reboot.
-
.action_up ⇒ Object
This action brings the machine up from nothing, including importing the box, configuring metadata, and booting.
Class Method Details
.action_boot ⇒ Object
This action boots the VM, assuming the VM is in a state that requires a bootup (i.e. not saved).
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/vagrant-veertu/action.rb', line 48 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 b.use PrepareNFSValidIds b.use SyncedFolderCleanup b.use SyncedFolders b.use PrepareNFSSettings b.use Network b.use NetworkFixIPv6 b.use ForwardPorts b.use SetHostname b.use SaneDefaults b.use Customize, "pre-boot" b.use Boot b.use Customize, "post-boot" b.use WaitForCommunicator, [:starting, :suspending, :running, :stopped] b.use Customize, "post-comm" end end |
.action_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/vagrant-veertu/action.rb', line 76 def self.action_destroy Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use Call, Created do |env1, b2| if !env1[:result] b2.use MessageNotCreated next end b2.use Call, DestroyConfirm do |env2, b3| if env2[:result] b3.use ConfigValidate b3.use ProvisionerCleanup, :before b3.use CheckAccessible b3.use EnvSet, force_halt: true b3.use action_halt b3.use Destroy # b3.use DestroyUnusedNetworkInterfaces b3.use PrepareNFSValidIds b3.use SyncedFolderCleanup else b3.use MessageWillNotDestroy end end end end end |
.action_halt ⇒ Object
This is the action that is primarily responsible for halting the virtual machine, gracefully or by force.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/vagrant-veertu/action.rb', line 106 def self.action_halt Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use Call, Created do |env, b2| if env[:result] b2.use CheckAccessible b2.use DiscardState b2.use Call, IsPaused do |env2, b3| next if !env2[:result] b3.use Resume end b2.use Call, GracefulHalt, :stopped, :running do |env2, b3| if !env2[:result] b3.use ForcedHalt end end else b2.use MessageNotCreated end end end end |
.action_package ⇒ Object
This action packages the virtual machine into a single box file.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/vagrant-veertu/action.rb', line 132 def self.action_package Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use Call, Created do |env1, b2| if !env1[:result] b2.use MessageNotCreated next end b2.use SetupPackageFiles b2.use CheckAccessible b2.use action_halt b2.use ClearForwardedPorts b2.use PrepareNFSValidIds b2.use SyncedFolderCleanup b2.use Package b2.use Export b2.use PackageVagrantfile end end end |
.action_provision ⇒ Object
This action just runs the provisioners on the machine.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/vagrant-veertu/action.rb', line 155 def self.action_provision Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use ConfigValidate b.use Call, Created do |env1, b2| if !env1[:result] b2.use MessageNotCreated next end b2.use Call, IsRunning do |env2, b3| if !env2[:result] b3.use MessageNotRunning next end b3.use CheckAccessible b3.use Provision end end end end |
.action_reload ⇒ Object
This action is responsible for reloading the machine, which brings it down, sucks in new configuration, and brings the machine back up with the new configuration.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/vagrant-veertu/action.rb', line 181 def self.action_reload Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use Call, Created do |env1, b2| if !env1[:result] b2.use MessageNotCreated next end b2.use ConfigValidate b2.use action_halt b2.use action_start end end end |
.action_resume ⇒ Object
This is the action that is primarily responsible for resuming suspended machines.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/vagrant-veertu/action.rb', line 199 def self.action_resume Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu 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 Provision b2.use WaitForCommunicator, [:stopped, :paused, :suspending, :running, :starting] else b2.use MessageNotCreated end end end end |
.action_ssh ⇒ Object
This is the action that will exec into an SSH shell.
218 219 220 221 222 223 224 225 226 |
# File 'lib/vagrant-veertu/action.rb', line 218 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use CheckCreated b.use CheckAccessible b.use CheckRunning b.use SSHExec end end |
.action_ssh_run ⇒ Object
This is the action that will run a single SSH command.
229 230 231 232 233 234 235 236 237 |
# File 'lib/vagrant-veertu/action.rb', line 229 def self.action_ssh_run Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use CheckCreated b.use CheckAccessible b.use CheckRunning b.use SSHRun end end |
.action_start ⇒ Object
This action starts a VM, assuming it is already imported and exists. A precondition of this action is that the VM exists.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/vagrant-veertu/action.rb', line 241 def self.action_start Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use ConfigValidate b.use BoxCheckOutdated b.use Call, IsRunning do |env, b2| # If the VM is running, then our work here is done, exit if env[:result] b2.use MessageAlreadyRunning next end b2.use Call, IsSaved do |env2, b3| if env2[:result] # The VM is saved, so just resume it b3.use action_resume next end b3.use Call, IsPaused do |env3, b4| if env3[:result] b4.use Resume next end # The VM is not saved, so we must have to boot it up # like normal. Boot! b4.use action_boot end end end end end |
.action_suspend ⇒ Object
This is the action that is primarily responsible for suspending the virtual machine.
277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/vagrant-veertu/action.rb', line 277 def self.action_suspend Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu b.use Call, Created do |env, b2| if env[:result] b2.use CheckAccessible b2.use Suspend else b2.use MessageNotCreated end end end end |
.action_sync_folders ⇒ Object
This is the action that is called to sync folders to a running machine without a reboot.
293 294 295 296 297 298 299 |
# File 'lib/vagrant-veertu/action.rb', line 293 def self.action_sync_folders Vagrant::Action::Builder.new.tap do |b| b.use PrepareNFSValidIds b.use SyncedFolders b.use PrepareNFSSettings end end |
.action_up ⇒ Object
This action brings the machine up from nothing, including importing the box, configuring metadata, and booting.
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/vagrant-veertu/action.rb', line 303 def self.action_up @logger = Log4r::Logger.new("vagrant::provider::veertu_5_0") Vagrant::Action::Builder.new.tap do |b| b.use CheckVeertu # 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 HandleBox end end b.use ConfigValidate @logger.debug("after config validate") 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 Customize, "pre-import" b2.use Import b2.use DiscardState end end @logger.debug("before action start") b.use action_start end end |