Module: VagrantPlugins::ProviderBhyve::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-bhyve/action.rb,
lib/vagrant-bhyve/action/boot.rb,
lib/vagrant-bhyve/action/load.rb,
lib/vagrant-bhyve/action/setup.rb,
lib/vagrant-bhyve/action/import.rb,
lib/vagrant-bhyve/action/cleanup.rb,
lib/vagrant-bhyve/action/destroy.rb,
lib/vagrant-bhyve/action/shutdown.rb,
lib/vagrant-bhyve/action/create_tap.rb,
lib/vagrant-bhyve/action/create_bridge.rb,
lib/vagrant-bhyve/action/forward_ports.rb,
lib/vagrant-bhyve/action/wait_until_up.rb,
lib/vagrant-bhyve/action/prepare_nfs_settings.rb,
lib/vagrant-bhyve/action/prepare_nfs_valid_ids.rb
Defined Under Namespace
Classes: Boot, Cleanup, CreateBridge, CreateTap, Destroy, ForwardPorts, Import, Load, PrepareNFSSettings, PrepareNFSValidIds, Setup, Shutdown, WaitUntilUP
Class Method Summary
collapse
Class Method Details
.action_destroy ⇒ Object
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/vagrant-bhyve/action.rb', line 147
def self.action_destroy
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, Vagrant::MachineState::NOT_CREATED_ID do |env, b1|
if env[:result]
b1.use Message, I18n.t('vagrant_bhyve.commands.common.vm_not_created')
next
end
b1.use Call, DestroyConfirm do |env1, b2|
if !env1[:result]
b2.use Message, I18n.t(
'vagrant.commands.destroy.will_not_destroy',
name: env1[:machine].name)
next
end
b2.use Call, IsState, :running do |env2, b3|
if env2[:result]
b3.use action_halt
end
end
b2.use Call, IsState, :uncleaned do |env2, b3|
if env2[:result]
b3.use Cleanup
end
end
b2.use Destroy
b2.use ProvisionerCleanup
b2.use PrepareNFSValidIds
b2.use SyncedFolderCleanup
end
end
end
end
|
.action_halt ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/vagrant-bhyve/action.rb', line 44
def self.action_halt
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, :running do |env, b1|
if env[:result]
b1.use Call, GracefulHalt, :uncleaned, :running do |env1, b2|
if !env1[:result]
b3.use Shutdown
end
end
end
end
b.use Call, IsState, :uncleaned do |env, b1|
if env[:result]
b1.use Cleanup
end
end
end
end
|
.action_provision ⇒ Object
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
# File 'lib/vagrant-bhyve/action.rb', line 182
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, Vagrant::MachineState::NOT_CREATED_ID do |env,b1|
if env[:result]
b1.use Message, I18n.t('vagrant_bhyve.commands.common.vm_not_created')
next
end
b1.use Call, IsState, :running do |env1, b2|
if !env1[:result]
b2.use Message, I18n.t('vagrant_bhyve.commands.common.vm_not_running')
next
end
b2.use Provision
end
end
end
end
|
.action_reload ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/vagrant-bhyve/action.rb', line 64
def self.action_reload
Vagrant::Action::Builder.new.tap do |b|
b.use Message, I18n.t('vagrant_bhyve.action.vm.reload.reloading')
b.use Call, IsState, Vagrant::MachineState::NOT_CREATED_ID do |env, b1|
if env[:result]
b1.use Message, I18n.t('vagrant_bhyve.commands.common.vm_not_created')
next
end
b1.use Call, IsState, :stopped do |env1, b2|
if !env1[:result]
b2.use action_halt
end
end
b1.use ConfigValidate
b1.use action_start
end
end
end
|
.action_resume ⇒ Object
207
208
209
210
211
|
# File 'lib/vagrant-bhyve/action.rb', line 207
def self.action_resume
Vagrant::Action::Builder.new.tap do |b|
b.use Warn, I18n.t('vagrant_bhyve.actions.vm.resume.not_supported')
end
end
|
.action_ssh ⇒ Object
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/vagrant-bhyve/action.rb', line 83
def self.action_ssh
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, :running do |env, b1|
if !env[:result]
b1.use Message, I18n.t('vagrant_bhyve.commands.common.vm_not_running')
next
end
b1.use SSHExec
end
end
end
|
.action_ssh_run ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/vagrant-bhyve/action.rb', line 96
def self.action_ssh_run
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, :running do |env, b1|
if !env[:result]
b1.use Message, I18n.t('vagrant_bhyve.commands.common.vm_not_running')
next
end
b1.use SSHRun
end
end
end
|
.action_start ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/vagrant-bhyve/action.rb', line 109
def self.action_start
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, :running do |env, b1|
if env[:result]
b1.use Message, I18n.t('vagrant_bhyve.commands.common.vm_already_running')
next
end
b1.use Call, IsState, :uncleaned do |env1, b2|
if env1[:result]
b2.use Cleanup
end
end
b1.use Setup
b1.use action_boot
end
end
end
|
.action_suspend ⇒ Object
201
202
203
204
205
|
# File 'lib/vagrant-bhyve/action.rb', line 201
def self.action_suspend
Vagrant::Action::Builder.new.tap do |b|
b.use Warn, I18n.t('vagrant_bhyve.actions.vm.suspend.not_supported')
end
end
|
.action_up ⇒ Object
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/vagrant-bhyve/action.rb', line 128
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
b.use Call, IsState, Vagrant::MachineState::NOT_CREATED_ID do |env, b1|
if env[:result]
b1.use HandleBox
end
end
b.use ConfigValidate
b.use Call, IsState, Vagrant::MachineState::NOT_CREATED_ID do |env,b1|
if env[:result]
b1.use Import
b1.use Provision
end
end
b.use action_start
end
end
|