Module: VagrantPlugins::ProviderZone::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-zone/action.rb,
lib/vagrant-zone/action/halt.rb,
lib/vagrant-zone/action/setup.rb,
lib/vagrant-zone/action/start.rb,
lib/vagrant-zone/action/create.rb,
lib/vagrant-zone/action/import.rb,
lib/vagrant-zone/action/destroy.rb,
lib/vagrant-zone/action/network.rb,
lib/vagrant-zone/action/package.rb,
lib/vagrant-zone/action/is_created.rb,
lib/vagrant-zone/action/not_created.rb,
lib/vagrant-zone/action/wait_till_up.rb,
lib/vagrant-zone/action/prepare_nfs_valid_ids.rb
Defined Under Namespace
Classes: Create, Destroy, Halt, Import, IsCreated, Network, NotCreated, Package, PrepareNFSValidIds, Setup, Start, WaitTillUp
Class Method Summary collapse
-
.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_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_destroy ⇒ Object
This is the action that is primarily responsible for completely freeing the resources of the underlying virtual machine.
97 98 99 100 101 102 103 |
# File 'lib/vagrant-zone/action.rb', line 97 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.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/vagrant-zone/action.rb', line 59 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 if env[:result] # VM is running, halt it b2.use Halt end end end end |
.action_package ⇒ Object
This action is called when you try to package an existing virtual machine to an box image.
89 90 91 92 93 |
# File 'lib/vagrant-zone/action.rb', line 89 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.
106 107 108 109 110 111 112 113 114 |
# File 'lib/vagrant-zone/action.rb', line 106 def self.action_provision Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |env, b2| b2.use Call, IsState, :running do |env, 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
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/vagrant-zone/action.rb', line 118 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_ssh ⇒ Object
This action is called to SSH into the machine.
76 77 78 79 80 |
# File 'lib/vagrant-zone/action.rb', line 76 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use SSHExec end end |
.action_ssh_run ⇒ Object
81 82 83 84 85 |
# File 'lib/vagrant-zone/action.rb', line 81 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.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/vagrant-zone/action.rb', line 38 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_zone.states.is_running') next end b1.use Call, IsState, :uncleaned do |env1, b2| if env1[:result] b2.use Cleanup end end b1.use Start b1.use Setup end end end |
.action_up ⇒ Object
This action is called to bring the box up from nothing.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant-zone/action.rb', line 12 def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use Call, IsCreated do |env, b2| re = env[:result] m = env[:machine].state.id if !env[:result] b2.use Import b2.use Create b2.use Network b2.use Start b2.use Setup b2.use WaitTillUp b2.use SyncedFolderCleanup b2.use SyncedFolders b2.use Provision else env[:halt_on_error] = true b2.use action_start end end end end |