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/os_type.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/powershell_run.rb,
lib/vagrant-azure/action/start_instance.rb,
lib/vagrant-azure/action/wait_for_state.rb,
lib/vagrant-azure/action/read_winrm_info.rb,
lib/vagrant-azure/action/terminate_instance.rb,
lib/vagrant-azure/action/vagrant_azure_service.rb
Defined Under Namespace
Classes: ConnectAzure, OSType, PowerShellRun, Rdp, ReadSSHInfo, ReadState, ReadWinrmInfo, RestartVM, RunInstance, StartInstance, StopInstance, SyncFolders, TerminateInstance, VagrantAzureService, WaitForState
Class Method Summary
collapse
Class Method Details
.action_destroy ⇒ Object
This action is called to terminate the remote machine.
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/vagrant-azure/action.rb', line 34
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, 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.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/vagrant-azure/action.rb', line 18
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_powershell_run ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/vagrant-azure/action.rb', line 130
def self.action_powershell_run
Vagrant::Action::Builder.new.tap do |b|
b.use action_read_winrm_info
b.use Call, IsState, :NotCreated do |env, b2|
if env[:result]
b2.use Message, I18n.t('vagrant_azure.not_created')
next
end
b2.use PowerShellRun
end
end
end
|
.action_prepare_boot ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# File 'lib/vagrant-azure/action.rb', line 181
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 action_read_winrm_info
b1.use WaitForCommunicator
b1.use action_provision
end
end
end
end
|
.action_provision ⇒ Object
This action is called when ‘vagrant provision` is called.
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/vagrant-azure/action.rb', line 61
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConnectAzure
b.use ConfigValidate
b.use OSType
b.use ReadWinrmInfo
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
b2.use SyncFolders
end
end
end
|
.action_rdp ⇒ Object
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/vagrant-azure/action.rb', line 144
def self.action_rdp
Vagrant::Action::Builder.new.tap do |b|
b.use ConnectAzure
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
89
90
91
92
93
94
95
|
# File 'lib/vagrant-azure/action.rb', line 89
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.
81
82
83
84
85
86
87
|
# File 'lib/vagrant-azure/action.rb', line 81
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
106
107
108
109
110
111
112
|
# File 'lib/vagrant-azure/action.rb', line 106
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
97
98
99
100
101
102
103
104
|
# File 'lib/vagrant-azure/action.rb', line 97
def self.action_read_winrm_info
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectAzure
b.use OSType
b.use ReadWinrmInfo
end
end
|
.action_reload ⇒ Object
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
# File 'lib/vagrant-azure/action.rb', line 224
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/vagrant-azure/action.rb', line 115
def self.action_ssh
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 SSHExec
end
end
end
|
.action_ssh_run ⇒ Object
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/vagrant-azure/action.rb', line 166
def self.action_ssh_run
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 SSHRun
end
end
end
|
.action_up ⇒ Object
This action is called to bring the box up from nothing
198
199
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 198
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
b.use HandleBox
b.use ConfigValidate
b.use ConnectAzure
b.use OSType
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 b2.use action_prepare_boot
else
b2.use Message, I18n.t(
'vagrant_azure.already_status', :status => 'created'
)
end
end
else
b1.use RunInstance b1.use action_prepare_boot
end
end
end
end
|