Module: VagrantPlugins::SoftLayer::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-softlayer/action.rb,
lib/vagrant-softlayer/action/is.rb,
lib/vagrant-softlayer/action/message.rb,
lib/vagrant-softlayer/action/read_state.rb,
lib/vagrant-softlayer/action/update_dns.rb,
lib/vagrant-softlayer/action/sync_folders.rb,
lib/vagrant-softlayer/action/read_ssh_info.rb,
lib/vagrant-softlayer/action/stop_instance.rb,
lib/vagrant-softlayer/action/start_instance.rb,
lib/vagrant-softlayer/action/create_instance.rb,
lib/vagrant-softlayer/action/resume_instance.rb,
lib/vagrant-softlayer/action/setup_softlayer.rb,
lib/vagrant-softlayer/action/destroy_instance.rb,
lib/vagrant-softlayer/action/rebuild_instance.rb,
lib/vagrant-softlayer/action/suspend_instance.rb,
lib/vagrant-softlayer/action/wait_for_rebuild.rb,
lib/vagrant-softlayer/action/join_load_balancer.rb,
lib/vagrant-softlayer/action/wait_for_provision.rb,
lib/vagrant-softlayer/action/load_balancer_cleanup.rb
Defined Under Namespace
Classes: CreateInstance, DestroyInstance, Is, JoinLoadBalancer, LoadBalancerCleanup, Message, ReadSSHInfo, ReadState, RebuildInstance, ResumeInstance, SetupSoftLayer, StartInstance, StopInstance, SuspendInstance, SyncFolders, UpdateDNS, WaitForProvision, WaitForRebuild
Class Method Summary collapse
-
.action_destroy ⇒ Object
This action is called to terminate the remote machine.
-
.action_halt ⇒ Object
This action is called to halt the remote machine.
-
.action_provision ⇒ Object
This action is called to run provisioners on the machine.
-
.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_rebuild ⇒ Object
This action is called to rebuild the machine OS from scratch.
-
.action_reload ⇒ Object
This action is called to reload the machine.
-
.action_resume ⇒ Object
This action is called to resume the remote machine.
-
.action_ssh ⇒ Object
This action is called to SSH into the machine.
- .action_ssh_run ⇒ Object
-
.action_suspend ⇒ Object
This action is called to suspend the remote machine.
-
.action_up ⇒ Object
This action is called to bring the box up from nothing.
Class Method Details
.action_destroy ⇒ Object
This action is called to terminate the remote machine.
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-softlayer/action.rb', line 13 def self.action_destroy Vagrant::Action::Builder.new.tap do |b| b.use Call, DestroyConfirm do |env, b2| if env[:result] b2.use ConfigValidate b.use Call, Is, :not_created do |env2, b3| if env2[:result] b3.use Message, :error, "vagrant_softlayer.vm.not_created" next end end b2.use SetupSoftLayer b2.use UpdateDNS b2.use DestroyInstance b2.use LoadBalancerCleanup b2.use ProvisionerCleanup else b2.use Message, :warn, "vagrant_softlayer.vm.not_destroying" end end end end |
.action_halt ⇒ Object
This action is called to halt the remote machine.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vagrant-softlayer/action.rb', line 37 def self.action_halt Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, Is, :running do |env, b2| if !env[:result] b2.use Message, :error, "vagrant_softlayer.vm.not_running" next end b2.use SetupSoftLayer b2.use StopInstance end end end |
.action_provision ⇒ Object
This action is called to run provisioners on the machine.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/vagrant-softlayer/action.rb', line 53 def self.action_provision Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, Is, :running do |env, b2| if !env[:result] b2.use Message, :error, "vagrant_softlayer.vm.not_running" next end b2.use Provision b2.use SyncFolders 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.
71 72 73 74 75 76 77 |
# File 'lib/vagrant-softlayer/action.rb', line 71 def self.action_read_ssh_info Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use SetupSoftLayer 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.
82 83 84 85 86 87 88 |
# File 'lib/vagrant-softlayer/action.rb', line 82 def self.action_read_state Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use SetupSoftLayer b.use ReadState end end |
.action_rebuild ⇒ Object
This action is called to rebuild the machine OS from scratch.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/vagrant-softlayer/action.rb', line 91 def self.action_rebuild Vagrant::Action::Builder.new.tap do |b| b.use Call, Confirm, I18n.t("vagrant_softlayer.vm.rebuild_confirmation"), :force_rebuild do |env, b2| if env[:result] b2.use ConfigValidate b.use Call, Is, :not_created do |env2, b3| if env2[:result] b3.use Message, :error, "vagrant_softlayer.vm.not_created" next end end b2.use SetupSoftLayer b2.use RebuildInstance b2.use Provision b2.use SyncFolders b2.use WaitForRebuild b2.use WaitForCommunicator else b2.use Message, :warn, "vagrant_softlayer.vm.not_rebuilding" end end end end |
.action_reload ⇒ Object
This action is called to reload the machine.
116 117 118 119 120 121 |
# File 'lib/vagrant-softlayer/action.rb', line 116 def self.action_reload Vagrant::Action::Builder.new.tap do |b| b.use action_halt b.use action_up end end |
.action_resume ⇒ Object
This action is called to resume the remote machine.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/vagrant-softlayer/action.rb', line 124 def self.action_resume Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, Is, :paused do |env, b2| if !env[:result] b2.use Message, :error, "vagrant_softlayer.vm.not_paused" next end b2.use SetupSoftLayer b2.use ResumeInstance end end end |
.action_ssh ⇒ Object
This action is called to SSH into the machine.
140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/vagrant-softlayer/action.rb', line 140 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, Is, :running do |env, b2| if !env[:result] b2.use Message, :error, "vagrant_softlayer.vm.not_running" next end b2.use SSHExec end end end |
.action_ssh_run ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/vagrant-softlayer/action.rb', line 154 def self.action_ssh_run Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, Is, :running do |env, b2| if !env[:result] b2.use Message, :error, "vagrant_softlayer.vm.not_running" next end b2.use SSHRun end end end |
.action_suspend ⇒ Object
This action is called to suspend the remote machine.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/vagrant-softlayer/action.rb', line 169 def self.action_suspend Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, Is, :running do |env, b2| if !env[:result] b2.use Message, :error, "vagrant_softlayer.vm.not_running" next end b2.use SetupSoftLayer b2.use SuspendInstance end end end |
.action_up ⇒ Object
This action is called to bring the box up from nothing.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/vagrant-softlayer/action.rb', line 185 def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use HandleBoxUrl b.use ConfigValidate b.use SetupSoftLayer b.use Call, Is, :not_created do |env1, b1| if env1[:result] b1.use SetupSoftLayer b1.use Provision b1.use SyncFolders b1.use CreateInstance b1.use WaitForProvision b1.use UpdateDNS b1.use JoinLoadBalancer b1.use WaitForCommunicator else b1.use Call, Is, :halted do |env2, b2| if env2[:result] b2.use SetupSoftLayer b2.use Provision b2.use SyncFolders b2.use StartInstance b2.use UpdateDNS b2.use JoinLoadBalancer b2.use WaitForCommunicator else b2.use Message, :warn, "vagrant_softlayer.vm.already_running" end end end end end end |