Module: VagrantPlugins::WinAzure::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-azure/action.rb,
lib/vagrant-azure/action/rdp.rb,
lib/vagrant-azure/action/provision.rb,
lib/vagrant-azure/action/read_state.rb,
lib/vagrant-azure/action/restart_vm.rb,
lib/vagrant-azure/action/run_instance.rb,
lib/vagrant-azure/action/sync_folders.rb,
lib/vagrant-azure/action/connect_azure.rb,
lib/vagrant-azure/action/read_ssh_info.rb,
lib/vagrant-azure/action/stop_instance.rb,
lib/vagrant-azure/action/start_instance.rb,
lib/vagrant-azure/action/wait_for_state.rb,
lib/vagrant-azure/action/terminate_instance.rb,
lib/vagrant-azure/action/wait_for_communicate.rb,
lib/vagrant-azure/action/vagrant_azure_service.rb
Defined Under Namespace
Classes: ConnectAzure, Provision, Rdp, ReadSSHInfo, ReadState, RestartVM, RunInstance, StartInstance, StopInstance, SyncFolders, TerminateInstance, VagrantAzureService, WaitForCommunicate, WaitForState
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_prepare_boot ⇒ Object
-
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
- .action_rdp ⇒ Object
- .action_read_rdp_info ⇒ Object
-
.action_read_ssh_info ⇒ Object
This action is called to read the SSH info of the machine.
- .action_read_state ⇒ Object
- .action_read_winrm_info ⇒ Object
- .action_reload ⇒ Object
-
.action_ssh ⇒ Object
This action is called to SSH into the machine.
- .action_ssh_run ⇒ Object
-
.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.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vagrant-azure/action.rb', line 32 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, IsState, :NotCreated do |env2, b3| if env2[:result] b3.use Message, I18n.t('vagrant_azure.not_created') next end end b2.use ConnectAzure b2.use TerminateInstance b2.use ProvisionerCleanup if defined?(ProvisionerCleanup) else env[:machine].id =~ /@/ b2.use Message, I18n.t( 'vagrant_azure.will_not_destroy', :name => $` ) end end end end |
.action_halt ⇒ Object
This action is called to halt the remote machine.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-azure/action.rb', line 16 def self.action_halt Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsState, :NotCreated do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_azure.not_created') next end b2.use ConnectAzure b2.use StopInstance end end end |
.action_prepare_boot ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/vagrant-azure/action.rb', line 157 def self.action_prepare_boot Vagrant::Action::Builder.new.tap do |b| b.use Call, WaitForState, :ReadyRole do |env, b1| if env[:result] env[:machine].id =~ /@/ b1.use Message, I18n.t( 'vagrant_azure.vm_started', :name => $` ) b1.use WaitForCommunicate b1.use Provision b1.use SyncFolders end end end end |
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/vagrant-azure/action.rb', line 59 def self.action_provision Vagrant::Action::Builder.new.tap do |b| b.use ConnectAzure b.use ConfigValidate b.use Call, IsState, :NotCreated do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_azure.not_created') next end b2.use Provision end end end |
.action_rdp ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/vagrant-azure/action.rb', line 122 def self.action_rdp Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsState, :NotCreated do |env1, b1| if env1[:result] b1.use Message, I18n.t('vagrant_azure.not_created') next end b1.use Call, IsState, :ReadyRole do |env2, b2| if !env2[:result] b2.use Message, I18n.t('vagrant_azure.rdp_not_ready') next end b2.use Rdp end end end end |
.action_read_rdp_info ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/vagrant-azure/action.rb', line 83 def self.action_read_rdp_info Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectAzure b.use ReadSSHInfo, 3389 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.
75 76 77 78 79 80 81 |
# File 'lib/vagrant-azure/action.rb', line 75 def self.action_read_ssh_info Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectAzure b.use ReadSSHInfo, 22 end end |
.action_read_state ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/vagrant-azure/action.rb', line 99 def self.action_read_state Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectAzure b.use ReadState end end |
.action_read_winrm_info ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/vagrant-azure/action.rb', line 91 def self.action_read_winrm_info Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectAzure b.use ReadSSHInfo, 5986 end end |
.action_reload ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/vagrant-azure/action.rb', line 200 def self.action_reload Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use ConnectAzure b.use Call, IsState, :NotCreated do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_azure.not_created') next end b2.use action_halt b2.use Call, WaitForState, :StoppedDeallocated do |env2, b3| if env2[:result] env2[:machine].id =~ /@/ b3.use Message, I18n.t('vagrant_azure.vm_stopped', name: $`) b3.use action_up else b3.use Message, 'Not able to stop the machine. Please retry.' end end end end end |
.action_ssh ⇒ Object
This action is called to SSH into the machine
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/vagrant-azure/action.rb', line 108 def self.action_ssh Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsState, :NotCreated do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_azure.not_created') next end b2.use SSHExec end end end |
.action_ssh_run ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/vagrant-azure/action.rb', line 143 def self.action_ssh_run Vagrant::Action::Builder.new.tap do |b| b.use ConfigValidate b.use Call, IsState, :NotCreated do |env, b2| if env[:result] b2.use Message, I18n.t('vagrant_azure.not_created') next end b2.use SSHRun end end end |
.action_up ⇒ Object
This action is called to bring the box up from nothing
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/vagrant-azure/action.rb', line 174 def self.action_up Vagrant::Action::Builder.new.tap do |b| b.use HandleBox b.use ConfigValidate b.use ConnectAzure b.use Call, IsState, :NotCreated do |env1, b1| if !env1[:result] b1.use Call, IsState, :StoppedDeallocated do |env2, b2| if env2[:result] b2.use StartInstance # start this instance again b2.use action_prepare_boot else b2.use Message, I18n.t( 'vagrant_azure.already_status', :status => 'created' ) end end else b1.use RunInstance # Launch a new instance b1.use action_prepare_boot end end end end |