Module: VagrantPlugins::ProviderZone::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-zones/action.rb,
lib/vagrant-zones/action/halt.rb,
lib/vagrant-zones/action/setup.rb,
lib/vagrant-zones/action/start.rb,
lib/vagrant-zones/action/create.rb,
lib/vagrant-zones/action/import.rb,
lib/vagrant-zones/action/destroy.rb,
lib/vagrant-zones/action/network.rb,
lib/vagrant-zones/action/package.rb,
lib/vagrant-zones/action/restart.rb,
lib/vagrant-zones/action/shutdown.rb,
lib/vagrant-zones/action/is_created.rb,
lib/vagrant-zones/action/not_created.rb,
lib/vagrant-zones/action/wait_till_up.rb,
lib/vagrant-zones/action/wait_till_boot.rb,
lib/vagrant-zones/action/network_cleanup.rb,
lib/vagrant-zones/action/prepare_nfs_valid_ids.rb
Overview
Run actions against the machine
Defined Under Namespace
Classes: Create, Destroy, Halt, Import, IsCreated, Network, NetworkingCleanup, NotCreated, Package, PrepareNFSValidIds, 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_configure_zfs_snapshots ⇒ Object
- .action_create_zfs_snapshots ⇒ Object
- .action_delete_zfs_snapshots ⇒ Object
-
.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
169 170 171 172 173 |
# File 'lib/vagrant-zones/action.rb', line 169 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.
178 179 180 181 182 |
# File 'lib/vagrant-zones/action.rb', line 178 def self.action_box_remove Builder.new.tap do |b| b.use Builtin::BoxRemove end end |
.action_configure_zfs_snapshots ⇒ Object
163 164 165 166 167 |
# File 'lib/vagrant-zones/action.rb', line 163 def self.action_configure_zfs_snapshots Vagrant::Action::Builder.new.tap do |b| b.use ConfigureSnapshots end end |
.action_create_zfs_snapshots ⇒ Object
150 151 152 153 154 155 |
# File 'lib/vagrant-zones/action.rb', line 150 def self.action_create_zfs_snapshots Vagrant::Action::Builder.new.tap do |b| # b.use ConfigValidate # is this per machine? b.use CreateSnapshots end end |
.action_delete_zfs_snapshots ⇒ Object
157 158 159 160 161 |
# File 'lib/vagrant-zones/action.rb', line 157 def self.action_delete_zfs_snapshots Vagrant::Action::Builder.new.tap do |b| b.use DeleteSnapshots end end |
.action_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
117 118 119 120 121 122 123 |
# File 'lib/vagrant-zones/action.rb', line 117 def self.action_destroy Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |_env, b2| b2.use Destroy end end end |
.action_halt ⇒ Object
This is the action that is primarily responsible for halting the virtual machine.
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/vagrant-zones/action.rb', line 84 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.
110 111 112 113 114 |
# File 'lib/vagrant-zones/action.rb', line 110 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.
126 127 128 129 130 131 132 133 134 |
# File 'lib/vagrant-zones/action.rb', line 126 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
137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/vagrant-zones/action.rb', line 137 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
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/vagrant-zones/action.rb', line 57 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
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vagrant-zones/action.rb', line 70 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.
97 98 99 100 101 |
# File 'lib/vagrant-zones/action.rb', line 97 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use SSHExec end end |
.action_ssh_run ⇒ Object
103 104 105 106 107 |
# File 'lib/vagrant-zones/action.rb', line 103 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.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/vagrant-zones/action.rb', line 41 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_zones.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 37 38 |
# File 'lib/vagrant-zones/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 Network b2.use Start b2.use WaitTillBoot b2.use Setup b2.use WaitTillUp b2.use Provision b2.use NetworkingCleanup b2.use SetHostname b2.use SyncedFolders b2.use SyncedFolderCleanup end end end end |