Module: VagrantPlugins::ProviderLocal::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-local/action.rb,
lib/vagrant-local/action/halt.rb,
lib/vagrant-local/action/setup.rb,
lib/vagrant-local/action/start.rb,
lib/vagrant-local/action/create.rb,
lib/vagrant-local/action/import.rb,
lib/vagrant-local/action/destroy.rb,
lib/vagrant-local/action/network.rb,
lib/vagrant-local/action/package.rb,
lib/vagrant-local/action/restart.rb,
lib/vagrant-local/action/shutdown.rb,
lib/vagrant-local/action/is_created.rb,
lib/vagrant-local/action/not_created.rb,
lib/vagrant-local/action/wait_till_up.rb,
lib/vagrant-local/action/wait_till_boot.rb,
lib/vagrant-local/action/network_cleanup.rb
Overview
Run actions against the machine
Defined Under Namespace
Classes: Create, Destroy, Halt, Import, IsCreated, Network, NetworkingCleanup, NotCreated, Package, Restart, Setup, Shutdown, Start, WaitTillBoot, WaitTillUp
Class Method Summary collapse
- .action_box_outdated ⇒ Object
-
.action_box_remove ⇒ Object
This is the action that will remove a box given a name (and optionally a provider).
-
.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.
-
.action_package ⇒ Object
This action is called when you try to package an existing virtual machine to an box image.
-
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
-
.action_reload ⇒ Object
This is the action implements the reload command It uses the halt and start actions.
- .action_restart ⇒ Object
- .action_shutdown ⇒ Object
-
.action_ssh ⇒ Object
This action is called to SSH into the machine.
- .action_ssh_run ⇒ Object
-
.action_start ⇒ Object
Assuming VM is created, just start it.
-
.action_up ⇒ Object
This action is called to bring the box up from nothing.
Class Method Details
.action_box_outdated ⇒ Object
153 154 155 156 157 |
# File 'lib/vagrant-local/action.rb', line 153 def self.action_box_outdated Builder.new.tap do |b| b.use Builtin::BoxCheckOutdated end end |
.action_box_remove ⇒ Object
This is the action that will remove a box given a name (and optionally a provider). This middleware sequence is built-in to Vagrant. Plugins can hook into this like any other middleware sequence.
162 163 164 165 166 |
# File 'lib/vagrant-local/action.rb', line 162 def self.action_box_remove Builder.new.tap do |b| b.use Builtin::BoxRemove end end |
.action_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/vagrant-local/action.rb', line 115 def self.action_destroy Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |_env, b2| # unless env[:result] # b2.use NotCreated # next # end b2.use Halt b2.use Destroy end end end |
.action_halt ⇒ Object
This is the action that is primarily responsible for halting the virtual machine.
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/vagrant-local/action.rb', line 82 def self.action_halt Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |env, b2| unless env[:result] b2.use NotCreated next end b2.use Halt if env[:result] end end end |
.action_package ⇒ Object
This action is called when you try to package an existing virtual machine to an box image.
108 109 110 111 112 |
# File 'lib/vagrant-local/action.rb', line 108 def self.action_package Vagrant::Action::Builder.new.tap do |b| b.use Package end end |
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
129 130 131 132 133 134 135 136 137 |
# File 'lib/vagrant-local/action.rb', line 129 def self.action_provision Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |_env, b2| b2.use Call, IsState, :running do |_env2, b3| b3.use Provision end end end end |
.action_reload ⇒ Object
This is the action implements the reload command It uses the halt and start actions
140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/vagrant-local/action.rb', line 140 def self.action_reload Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |env, b2| unless env[:result] b2.use NotCreated next end b2.use action_halt b2.use action_start end end end |
.action_restart ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/vagrant-local/action.rb', line 55 def self.action_restart Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |_env, b2| b2.use Call, IsState, :stopped do |env2, b3| unless env2[:result] b3.use WaitTillUp b3.use Restart end end end end end |
.action_shutdown ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vagrant-local/action.rb', line 68 def self.action_shutdown Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |_env, b2| b2.use Call, IsState, :stopped do |env2, b3| unless env2[:result] b3.use WaitTillUp b3.use Shutdown end end end end end |
.action_ssh ⇒ Object
This action is called to SSH into the machine.
95 96 97 98 99 |
# File 'lib/vagrant-local/action.rb', line 95 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use SSHExec end end |
.action_ssh_run ⇒ Object
101 102 103 104 105 |
# File 'lib/vagrant-local/action.rb', line 101 def self.action_ssh_run Vagrant::Action::Builder.new.tap do |b| b.use SSHRun end end |
.action_start ⇒ Object
Assuming VM is created, just start it. This action is not called directly by any subcommand.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vagrant-local/action.rb', line 39 def self.action_start Vagrant::Action::Builder.new.tap do |b| b.use Call, IsState, :running do |env, b1| if env[:result] b1.use Message, I18n.t('vagrant_local.states.is_running') next end b1.use Call, IsState, :uncleaned do |env2, b2| b2.use Cleanup if env2[:result] end b1.use Start b1.use WaitTillUp end end end |
.action_up ⇒ Object
This action is called to bring the box up from nothing.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vagrant-local/action.rb', line 14 def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |env, b2| if env[:result] env[:halt_on_error] = true b2.use action_start elsif !env[:result] b2.use Import b2.use HandleBox b2.use BoxCheckOutdated b2.use Create b2.use Start b2.use WaitTillBoot b2.use Setup b2.use WaitTillUp b2.use Provision b2.use SetHostname b2.use SyncedFolders b2.use SyncedFolderCleanup end end end end |