Module: VagrantPlugins::Brightbox::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-brightbox/action.rb,
lib/vagrant-brightbox/action/is_created.rb,
lib/vagrant-brightbox/action/is_stopped.rb,
lib/vagrant-brightbox/action/read_state.rb,
lib/vagrant-brightbox/action/forced_halt.rb,
lib/vagrant-brightbox/action/unsupported.rb,
lib/vagrant-brightbox/action/map_cloud_ip.rb,
lib/vagrant-brightbox/action/start_server.rb,
lib/vagrant-brightbox/action/create_server.rb,
lib/vagrant-brightbox/action/delete_server.rb,
lib/vagrant-brightbox/action/read_ssh_info.rb,
lib/vagrant-brightbox/action/wait_for_state.rb,
lib/vagrant-brightbox/action/timed_provision.rb,
lib/vagrant-brightbox/action/connect_brightbox.rb,
lib/vagrant-brightbox/action/message_not_created.rb,
lib/vagrant-brightbox/action/message_already_created.rb,
lib/vagrant-brightbox/action/message_will_not_destroy.rb
Defined Under Namespace
Classes: ConnectBrightbox, CreateServer, DeleteServer, ForcedHalt, IsCreated, IsStopped, MapCloudIp, MessageAlreadyCreated, MessageNotCreated, MessageWillNotDestroy, ReadSSHInfo, ReadState, StartServer, TimedProvision, Unsupported, WaitForState
Class Method Summary collapse
-
.action_destroy ⇒ Object
This action is called to destroy the remote machine.
-
.action_halt ⇒ Object
This action is called to halt the server - gracefully or by force.
- .action_package ⇒ Object (also: action_resume, action_suspend)
- .action_prepare_boot ⇒ Object
-
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
-
.action_read_ssh_info ⇒ Object
This action is called to read the SSH info of the machine.
-
.action_read_state ⇒ Object
This action is called to read the state of the machine.
-
.action_reload ⇒ Object
This action reloads the machine - essentially shutting it down and bringing it back up again in the new configuration.
-
.action_ssh ⇒ Object
This action is called to SSH into the machine.
- .action_ssh_run ⇒ Object
- .action_up ⇒ Object
Class Method Details
.action_destroy ⇒ Object
This action is called to destroy the remote machine.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vagrant-brightbox/action.rb', line 42 def self.action_destroy Vagrant::Action::Builder.new.tap do |b| b.use Call, DestroyConfirm do |env, b2| if env[:result] b2.use ConfigValidate b2.use Call, IsCreated do |env2, b3| if env2[:result] b3.use ConnectBrightbox b3.use DeleteServer b3.use ProvisionerCleanup if defined?(ProvisionerCleanup) else b3.use MessageNotCreated end end else b2.use MessageWillNotDestroy end end end end |
.action_halt ⇒ Object
This action is called to halt the server - gracefully or by force.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vagrant-brightbox/action.rb', line 23 def self.action_halt Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsCreated do |env, b2| if env[:result] b2.use Call, GracefulHalt, :inactive, :active do |env2, b3| if !env2[:result] b3.use ConnectBrightbox b3.use ForcedHalt end end else b2.use MessageNotCreated end end end end |
.action_package ⇒ Object Also known as: action_resume, action_suspend
11 12 13 14 15 |
# File 'lib/vagrant-brightbox/action.rb', line 11 def self.action_package Vagrant::Action::Builder.new.tap do |b| b.use Unsupported end end |
.action_prepare_boot ⇒ Object
126 127 128 129 130 131 |
# File 'lib/vagrant-brightbox/action.rb', line 126 def self.action_prepare_boot Vagrant::Action::Builder.new.tap do |b| b.use Provision b.use SyncedFolders end end |
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vagrant-brightbox/action.rb', line 64 def self.action_provision Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsCreated do |env, b2| if env[:result] b2.use Provision else b2.use MessageNotCreated end end end end |
.action_read_ssh_info ⇒ Object
This action is called to read the SSH info of the machine. The resulting state is expected to be put into the ‘:machine_ssh_info` key.
80 81 82 83 84 85 86 |
# File 'lib/vagrant-brightbox/action.rb', line 80 def self.action_read_ssh_info Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectBrightbox b.use ReadSSHInfo end end |
.action_read_state ⇒ Object
This action is called to read the state of the machine. The resulting state is expected to be put into the ‘:machine_state_id` key.
91 92 93 94 95 96 97 |
# File 'lib/vagrant-brightbox/action.rb', line 91 def self.action_read_state Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectBrightbox b.use ReadState end end |
.action_reload ⇒ Object
This action reloads the machine - essentially shutting it down and bringing it back up again in the new configuration.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/vagrant-brightbox/action.rb', line 161 def self.action_reload Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectBrightbox b.use Call, IsCreated do |env, b2| if env[:result] b2.use action_halt b2.use Call, WaitForState, :stopped, 120 do |env2, b3| if env2[:result] b3.use action_up else # TODO we couldn't reach :stopped, what now? end end else b2.use MessageNotCreated end end end end |
.action_ssh ⇒ Object
This action is called to SSH into the machine.
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/vagrant-brightbox/action.rb', line 100 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsCreated do |env, b2| if env[:result] b2.use SSHExec else b2.use MessageNotCreated end end end end |
.action_ssh_run ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/vagrant-brightbox/action.rb', line 113 def self.action_ssh_run Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsCreated do |env, b2| if env[:result] b2.use SSHRun else b2.use MessageNotCreated end end end end |
.action_up ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/vagrant-brightbox/action.rb', line 133 def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use HandleBox b.use ConfigValidate b.use BoxCheckOutdated b.use ConnectBrightbox b.use Call, IsCreated do |env1, b1| if env1[:result] b1.use Call, IsStopped do |env2, b2| if env2[:result] b2.use action_prepare_boot b2.use StartServer b2.use MapCloudIp else b2.use MessageAlreadyCreated end end else b1.use action_prepare_boot b1.use CreateServer b1.use MapCloudIp end end end end |