vagrant-softlayer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -15
- data/CHANGELOG.md +18 -9
- data/Gemfile +12 -7
- data/README.md +247 -243
- data/contrib/README.md +11 -0
- data/contrib/vagrant-softlayer-boxes +408 -0
- data/lib/vagrant-softlayer/action/create_instance.rb +58 -54
- data/lib/vagrant-softlayer/action/join_load_balancer.rb +95 -95
- data/lib/vagrant-softlayer/action/resume_instance.rb +21 -0
- data/lib/vagrant-softlayer/action/setup_softlayer.rb +38 -37
- data/lib/vagrant-softlayer/action/suspend_instance.rb +21 -0
- data/lib/vagrant-softlayer/action/sync_folders.rb +1 -1
- data/lib/vagrant-softlayer/action/update_dns.rb +94 -94
- data/lib/vagrant-softlayer/action/wait_for_provision.rb +40 -40
- data/lib/vagrant-softlayer/action.rb +242 -208
- data/lib/vagrant-softlayer/config.rb +246 -229
- data/lib/vagrant-softlayer/version.rb +5 -5
- data/locales/en.yml +206 -170
- data/spec/vagrant-softlayer/config_spec.rb +261 -227
- data/vagrant-softlayer.gemspec +3 -1
- metadata +20 -31
@@ -1,208 +1,242 @@
|
|
1
|
-
require "pathname"
|
2
|
-
require "vagrant-softlayer/util/load_balancer"
|
3
|
-
require "vagrant-softlayer/util/network"
|
4
|
-
require "vagrant-softlayer/util/warden"
|
5
|
-
|
6
|
-
module VagrantPlugins
|
7
|
-
module SoftLayer
|
8
|
-
module Action
|
9
|
-
# Include the built-in modules so we can use them as top-level things.
|
10
|
-
include Vagrant::Action::Builtin
|
11
|
-
|
12
|
-
# This action is called to terminate the remote machine.
|
13
|
-
def self.action_destroy
|
14
|
-
Vagrant::Action::Builder.new.tap do |b|
|
15
|
-
b.use Call, DestroyConfirm do |env, b2|
|
16
|
-
if env[:result]
|
17
|
-
b2.use ConfigValidate
|
18
|
-
b.use Call, Is, :not_created do |env2, b3|
|
19
|
-
if env2[:result]
|
20
|
-
b3.use Message, :error, "vagrant_softlayer.vm.not_created"
|
21
|
-
next
|
22
|
-
end
|
23
|
-
end
|
24
|
-
b2.use SetupSoftLayer
|
25
|
-
b2.use UpdateDNS
|
26
|
-
b2.use DestroyInstance
|
27
|
-
b2.use LoadBalancerCleanup
|
28
|
-
b2.use ProvisionerCleanup
|
29
|
-
else
|
30
|
-
b2.use Message, :warn, "vagrant_softlayer.vm.not_destroying"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# This action is called to halt the remote machine.
|
37
|
-
def self.action_halt
|
38
|
-
Vagrant::Action::Builder.new.tap do |b|
|
39
|
-
b.use ConfigValidate
|
40
|
-
b.use Call, Is, :running do |env, b2|
|
41
|
-
if !env[:result]
|
42
|
-
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
43
|
-
next
|
44
|
-
end
|
45
|
-
|
46
|
-
b2.use SetupSoftLayer
|
47
|
-
b2.use StopInstance
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# This action is called to run provisioners on the machine.
|
53
|
-
def self.action_provision
|
54
|
-
Vagrant::Action::Builder.new.tap do |b|
|
55
|
-
b.use ConfigValidate
|
56
|
-
b.use Call, Is, :running do |env, b2|
|
57
|
-
if !env[:result]
|
58
|
-
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
59
|
-
next
|
60
|
-
end
|
61
|
-
|
62
|
-
b2.use Provision
|
63
|
-
b2.use SyncFolders
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# This action is called to read the SSH info of the machine. The
|
69
|
-
# resulting state is expected to be put into the `:machine_ssh_info`
|
70
|
-
# key.
|
71
|
-
def self.action_read_ssh_info
|
72
|
-
Vagrant::Action::Builder.new.tap do |b|
|
73
|
-
b.use ConfigValidate
|
74
|
-
b.use SetupSoftLayer
|
75
|
-
b.use ReadSSHInfo
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
# This action is called to read the state of the machine. The
|
80
|
-
# resulting state is expected to be put into the `:machine_state_id`
|
81
|
-
# key.
|
82
|
-
def self.action_read_state
|
83
|
-
Vagrant::Action::Builder.new.tap do |b|
|
84
|
-
b.use ConfigValidate
|
85
|
-
b.use SetupSoftLayer
|
86
|
-
b.use ReadState
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# This action is called to rebuild the machine OS from scratch.
|
91
|
-
def self.action_rebuild
|
92
|
-
Vagrant::Action::Builder.new.tap do |b|
|
93
|
-
b.use Call, Confirm, I18n.t("vagrant_softlayer.vm.rebuild_confirmation"), :force_rebuild do |env, b2|
|
94
|
-
if env[:result]
|
95
|
-
b2.use ConfigValidate
|
96
|
-
b.use Call, Is, :not_created do |env2, b3|
|
97
|
-
if env2[:result]
|
98
|
-
b3.use Message, :error, "vagrant_softlayer.vm.not_created"
|
99
|
-
next
|
100
|
-
end
|
101
|
-
end
|
102
|
-
b2.use SetupSoftLayer
|
103
|
-
b2.use RebuildInstance
|
104
|
-
b2.use Provision
|
105
|
-
b2.use SyncFolders
|
106
|
-
b2.use WaitForRebuild
|
107
|
-
b2.use WaitForCommunicator
|
108
|
-
else
|
109
|
-
b2.use Message, :warn, "vagrant_softlayer.vm.not_rebuilding"
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# This action is called to reload the machine.
|
116
|
-
def self.action_reload
|
117
|
-
Vagrant::Action::Builder.new.tap do |b|
|
118
|
-
b.use action_halt
|
119
|
-
b.use action_up
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
# This action is called to
|
124
|
-
def self.
|
125
|
-
Vagrant::Action::Builder.new.tap do |b|
|
126
|
-
b.use ConfigValidate
|
127
|
-
b.use Call, Is, :
|
128
|
-
if !env[:result]
|
129
|
-
b2.use Message, :error, "vagrant_softlayer.vm.
|
130
|
-
next
|
131
|
-
end
|
132
|
-
|
133
|
-
b2.use
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
b.use ConfigValidate
|
157
|
-
b.use
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
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
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
1
|
+
require "pathname"
|
2
|
+
require "vagrant-softlayer/util/load_balancer"
|
3
|
+
require "vagrant-softlayer/util/network"
|
4
|
+
require "vagrant-softlayer/util/warden"
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module SoftLayer
|
8
|
+
module Action
|
9
|
+
# Include the built-in modules so we can use them as top-level things.
|
10
|
+
include Vagrant::Action::Builtin
|
11
|
+
|
12
|
+
# This action is called to terminate the remote machine.
|
13
|
+
def self.action_destroy
|
14
|
+
Vagrant::Action::Builder.new.tap do |b|
|
15
|
+
b.use Call, DestroyConfirm do |env, b2|
|
16
|
+
if env[:result]
|
17
|
+
b2.use ConfigValidate
|
18
|
+
b.use Call, Is, :not_created do |env2, b3|
|
19
|
+
if env2[:result]
|
20
|
+
b3.use Message, :error, "vagrant_softlayer.vm.not_created"
|
21
|
+
next
|
22
|
+
end
|
23
|
+
end
|
24
|
+
b2.use SetupSoftLayer
|
25
|
+
b2.use UpdateDNS
|
26
|
+
b2.use DestroyInstance
|
27
|
+
b2.use LoadBalancerCleanup
|
28
|
+
b2.use ProvisionerCleanup
|
29
|
+
else
|
30
|
+
b2.use Message, :warn, "vagrant_softlayer.vm.not_destroying"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# This action is called to halt the remote machine.
|
37
|
+
def self.action_halt
|
38
|
+
Vagrant::Action::Builder.new.tap do |b|
|
39
|
+
b.use ConfigValidate
|
40
|
+
b.use Call, Is, :running do |env, b2|
|
41
|
+
if !env[:result]
|
42
|
+
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
43
|
+
next
|
44
|
+
end
|
45
|
+
|
46
|
+
b2.use SetupSoftLayer
|
47
|
+
b2.use StopInstance
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# This action is called to run provisioners on the machine.
|
53
|
+
def self.action_provision
|
54
|
+
Vagrant::Action::Builder.new.tap do |b|
|
55
|
+
b.use ConfigValidate
|
56
|
+
b.use Call, Is, :running do |env, b2|
|
57
|
+
if !env[:result]
|
58
|
+
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
59
|
+
next
|
60
|
+
end
|
61
|
+
|
62
|
+
b2.use Provision
|
63
|
+
b2.use SyncFolders
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# This action is called to read the SSH info of the machine. The
|
69
|
+
# resulting state is expected to be put into the `:machine_ssh_info`
|
70
|
+
# key.
|
71
|
+
def self.action_read_ssh_info
|
72
|
+
Vagrant::Action::Builder.new.tap do |b|
|
73
|
+
b.use ConfigValidate
|
74
|
+
b.use SetupSoftLayer
|
75
|
+
b.use ReadSSHInfo
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# This action is called to read the state of the machine. The
|
80
|
+
# resulting state is expected to be put into the `:machine_state_id`
|
81
|
+
# key.
|
82
|
+
def self.action_read_state
|
83
|
+
Vagrant::Action::Builder.new.tap do |b|
|
84
|
+
b.use ConfigValidate
|
85
|
+
b.use SetupSoftLayer
|
86
|
+
b.use ReadState
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# This action is called to rebuild the machine OS from scratch.
|
91
|
+
def self.action_rebuild
|
92
|
+
Vagrant::Action::Builder.new.tap do |b|
|
93
|
+
b.use Call, Confirm, I18n.t("vagrant_softlayer.vm.rebuild_confirmation"), :force_rebuild do |env, b2|
|
94
|
+
if env[:result]
|
95
|
+
b2.use ConfigValidate
|
96
|
+
b.use Call, Is, :not_created do |env2, b3|
|
97
|
+
if env2[:result]
|
98
|
+
b3.use Message, :error, "vagrant_softlayer.vm.not_created"
|
99
|
+
next
|
100
|
+
end
|
101
|
+
end
|
102
|
+
b2.use SetupSoftLayer
|
103
|
+
b2.use RebuildInstance
|
104
|
+
b2.use Provision
|
105
|
+
b2.use SyncFolders
|
106
|
+
b2.use WaitForRebuild
|
107
|
+
b2.use WaitForCommunicator
|
108
|
+
else
|
109
|
+
b2.use Message, :warn, "vagrant_softlayer.vm.not_rebuilding"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# This action is called to reload the machine.
|
116
|
+
def self.action_reload
|
117
|
+
Vagrant::Action::Builder.new.tap do |b|
|
118
|
+
b.use action_halt
|
119
|
+
b.use action_up
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# This action is called to resume the remote machine.
|
124
|
+
def self.action_resume
|
125
|
+
Vagrant::Action::Builder.new.tap do |b|
|
126
|
+
b.use ConfigValidate
|
127
|
+
b.use Call, Is, :paused do |env, b2|
|
128
|
+
if !env[:result]
|
129
|
+
b2.use Message, :error, "vagrant_softlayer.vm.not_paused"
|
130
|
+
next
|
131
|
+
end
|
132
|
+
|
133
|
+
b2.use SetupSoftLayer
|
134
|
+
b2.use ResumeInstance
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# This action is called to SSH into the machine.
|
140
|
+
def self.action_ssh
|
141
|
+
Vagrant::Action::Builder.new.tap do |b|
|
142
|
+
b.use ConfigValidate
|
143
|
+
b.use Call, Is, :running do |env, b2|
|
144
|
+
if !env[:result]
|
145
|
+
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
146
|
+
next
|
147
|
+
end
|
148
|
+
|
149
|
+
b2.use SSHExec
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.action_ssh_run
|
155
|
+
Vagrant::Action::Builder.new.tap do |b|
|
156
|
+
b.use ConfigValidate
|
157
|
+
b.use Call, Is, :running do |env, b2|
|
158
|
+
if !env[:result]
|
159
|
+
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
160
|
+
next
|
161
|
+
end
|
162
|
+
|
163
|
+
b2.use SSHRun
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# This action is called to suspend the remote machine.
|
169
|
+
def self.action_suspend
|
170
|
+
Vagrant::Action::Builder.new.tap do |b|
|
171
|
+
b.use ConfigValidate
|
172
|
+
b.use Call, Is, :running do |env, b2|
|
173
|
+
if !env[:result]
|
174
|
+
b2.use Message, :error, "vagrant_softlayer.vm.not_running"
|
175
|
+
next
|
176
|
+
end
|
177
|
+
|
178
|
+
b2.use SetupSoftLayer
|
179
|
+
b2.use SuspendInstance
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# This action is called to bring the box up from nothing.
|
185
|
+
def self.action_up
|
186
|
+
Vagrant::Action::Builder.new.tap do |b|
|
187
|
+
b.use HandleBoxUrl
|
188
|
+
b.use ConfigValidate
|
189
|
+
b.use SetupSoftLayer
|
190
|
+
b.use Call, Is, :not_created do |env1, b1|
|
191
|
+
if env1[:result]
|
192
|
+
b1.use SetupSoftLayer
|
193
|
+
b1.use Provision
|
194
|
+
b1.use SyncFolders
|
195
|
+
b1.use CreateInstance
|
196
|
+
b1.use WaitForProvision
|
197
|
+
b1.use UpdateDNS
|
198
|
+
b1.use JoinLoadBalancer
|
199
|
+
b1.use WaitForCommunicator
|
200
|
+
else
|
201
|
+
b1.use Call, Is, :halted do |env2, b2|
|
202
|
+
if env2[:result]
|
203
|
+
b2.use SetupSoftLayer
|
204
|
+
b2.use Provision
|
205
|
+
b2.use SyncFolders
|
206
|
+
b2.use StartInstance
|
207
|
+
b2.use UpdateDNS
|
208
|
+
b2.use JoinLoadBalancer
|
209
|
+
b2.use WaitForCommunicator
|
210
|
+
else
|
211
|
+
b2.use Message, :warn, "vagrant_softlayer.vm.already_running"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
# The autoload farm
|
220
|
+
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
221
|
+
|
222
|
+
autoload :CreateInstance, action_root.join("create_instance")
|
223
|
+
autoload :DestroyInstance, action_root.join("destroy_instance")
|
224
|
+
autoload :Is, action_root.join("is")
|
225
|
+
autoload :JoinLoadBalancer, action_root.join("join_load_balancer")
|
226
|
+
autoload :LoadBalancerCleanup, action_root.join("load_balancer_cleanup")
|
227
|
+
autoload :Message, action_root.join("message")
|
228
|
+
autoload :ReadSSHInfo, action_root.join("read_ssh_info")
|
229
|
+
autoload :ReadState, action_root.join("read_state")
|
230
|
+
autoload :RebuildInstance, action_root.join("rebuild_instance")
|
231
|
+
autoload :ResumeInstance, action_root.join("resume_instance")
|
232
|
+
autoload :SetupSoftLayer, action_root.join("setup_softlayer")
|
233
|
+
autoload :StartInstance, action_root.join("start_instance")
|
234
|
+
autoload :StopInstance, action_root.join("stop_instance")
|
235
|
+
autoload :SuspendInstance, action_root.join("suspend_instance")
|
236
|
+
autoload :SyncFolders, action_root.join("sync_folders")
|
237
|
+
autoload :UpdateDNS, action_root.join("update_dns")
|
238
|
+
autoload :WaitForProvision, action_root.join("wait_for_provision")
|
239
|
+
autoload :WaitForRebuild, action_root.join("wait_for_rebuild")
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|