Module: VagrantPlugins::Abiquo::Actions
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant_abiquo/actions.rb,
lib/vagrant_abiquo/actions/reset.rb,
lib/vagrant_abiquo/actions/create.rb,
lib/vagrant_abiquo/actions/deploy.rb,
lib/vagrant_abiquo/actions/connect.rb,
lib/vagrant_abiquo/actions/destroy.rb,
lib/vagrant_abiquo/actions/power_on.rb,
lib/vagrant_abiquo/actions/power_off.rb,
lib/vagrant_abiquo/actions/check_state.rb,
lib/vagrant_abiquo/actions/create_vapp.rb,
lib/vagrant_abiquo/actions/delete_vapp.rb,
lib/vagrant_abiquo/actions/read_ssh_info.rb
Defined Under Namespace
Classes: CheckState, Connect, Create, CreatevApp, DeletevApp, Deploy, Destroy, PowerOff, PowerOn, ReadSSHInfo, Reset
Class Method Summary
collapse
Class Method Details
.action_check_state ⇒ Object
145
146
147
148
149
150
151
|
# File 'lib/vagrant_abiquo/actions.rb', line 145
def self.action_check_state
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use CheckState
end
end
|
.action_destroy ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/vagrant_abiquo/actions.rb', line 6
def self.action_destroy
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :not_created
env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
when :ON, :OFF
b.use Call, DestroyConfirm do |env2, b2|
if env2[:result]
b2.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup)
b2.use Destroy
b2.use DeletevApp
end
end
else
raise Abiquo::Errors::InvalidStateError, vm: env[:machine].name.to_s, state: env[:machine_state]
end
end
end
end
|
.action_halt ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/vagrant_abiquo/actions.rb', line 76
def self.action_halt
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :ON
b.use PowerOff
when :OFF
env[:ui].info I18n.t('vagrant_abiquo.info.already_off')
when :not_created
env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
end
end
end
end
|
.action_provision ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/vagrant_abiquo/actions.rb', line 127
def self.action_provision
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :OFF
env[:ui].info I18n.t('vagrant_abiquo.info.off')
when :not_created
env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
when :ON
b.use Provision
b.use SyncedFolders
end
end
end
end
|
.action_read_ssh_info ⇒ Object
153
154
155
156
157
158
159
|
# File 'lib/vagrant_abiquo/actions.rb', line 153
def self.action_read_ssh_info
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use ReadSSHInfo
end
end
|
.action_reload ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/vagrant_abiquo/actions.rb', line 61
def self.action_reload
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :not_created
env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
else
b.use Reset
end
end
end
end
|
.action_ssh ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/vagrant_abiquo/actions.rb', line 93
def self.action_ssh
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :ON
b.use SSHExec
when :OFF
env[:ui].info I18n.t('vagrant_abiquo.info.off')
when :not_created
env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
end
end
end
end
|
.action_ssh_run ⇒ Object
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/vagrant_abiquo/actions.rb', line 110
def self.action_ssh_run
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :ON
b.use SSHRun
when :OFF
env[:ui].info I18n.t('vagrant_abiquo.info.off')
when :not_created
env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
end
end
end
end
|
.action_up ⇒ Object
29
30
31
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
57
58
59
|
# File 'lib/vagrant_abiquo/actions.rb', line 29
def self.action_up
return Vagrant::Action::Builder.new.tap do |builder|
builder.use ConfigValidate
builder.use Connect
builder.use Call, CheckState do |env, b|
case env[:machine_state]
when :ON
env[:ui].info I18n.t('vagrant_abiquo.info.already_active')
when :OFF
b.use PowerOn
b.use WaitForCommunicator
b.use Provision
b.use SyncedFolders
when :not_created
b.use CreatevApp
b.use Create
b.use Deploy
b.use WaitForCommunicator
b.use Provision
b.use SyncedFolders
when :NOT_ALLOCATED
b.use Deploy
b.use WaitForCommunicator
b.use Provision
b.use SyncedFolders
else
raise Abiquo::Errors::InvalidStateError, vm: env[:machine].name.to_s, state: env[:machine_state]
end
end
end
end
|