vagrant-softlayer 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +7 -3
- data/lib/vagrant-softlayer.rb +22 -22
- data/lib/vagrant-softlayer/action.rb +4 -4
- data/lib/vagrant-softlayer/action/destroy_instance.rb +23 -23
- data/lib/vagrant-softlayer/action/read_ssh_info.rb +28 -28
- data/lib/vagrant-softlayer/action/read_state.rb +42 -42
- data/lib/vagrant-softlayer/action/rebuild_instance.rb +35 -35
- data/lib/vagrant-softlayer/action/start_instance.rb +21 -21
- data/lib/vagrant-softlayer/action/stop_instance.rb +30 -30
- data/lib/vagrant-softlayer/action/wait_for_provision.rb +3 -3
- data/lib/vagrant-softlayer/action/wait_for_rebuild.rb +3 -3
- data/lib/vagrant-softlayer/config.rb +33 -19
- data/lib/vagrant-softlayer/errors.rb +8 -0
- data/lib/vagrant-softlayer/plugin.rb +1 -1
- data/lib/vagrant-softlayer/version.rb +1 -1
- data/locales/en.yml +24 -0
- data/spec/vagrant-softlayer/config_spec.rb +44 -40
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0c1fe3a1cabd26c85e98ea939676567e1be1fe4
|
4
|
+
data.tar.gz: a5d2fdffa3043056351f95ef7bfd8d91f6406ade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d6ac6b78727aa2e6c7644ef41199bef30ae792e1daf2c03c6b2d85c3abd8f4781406d125b4e4a8fc6f1843d8e1ba56c66e8db57b3ee80f26ad99cc1bb9ae57e
|
7
|
+
data.tar.gz: be92961dc1d8fce6b402998b8c1112a74a6f634a322a29d3519f4e9be4ab739d9d71aa00fb4c6b16cede7811e29c6407578e300e403d70182a84d87f23ee1fa6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.3.3 (August 21, 2014)
|
2
|
+
|
3
|
+
ENHANCEMENTS:
|
4
|
+
|
5
|
+
- Add parallel execution capability.
|
6
|
+
- Add configuration variables for provision and rebuild timeout.
|
7
|
+
- Use builtin synced folders if available.
|
8
|
+
|
9
|
+
BUG FIXES:
|
10
|
+
|
11
|
+
- Raise a proper exception on timeout.
|
12
|
+
|
1
13
|
## 0.3.2 (August 1, 2014)
|
2
14
|
|
3
15
|
ENHANCEMENTS:
|
data/README.md
CHANGED
@@ -105,6 +105,13 @@ Parameter | Description
|
|
105
105
|
|
106
106
|
\** When defining the instance you can either specify an `image_guid` or `operating_system` with optional `disk_capacity`.
|
107
107
|
|
108
|
+
### Timeouts
|
109
|
+
|
110
|
+
Parameter | Description | Default | Required
|
111
|
+
------------------- | ------------------------------------------| ----------------| --------
|
112
|
+
`provision_timeout` | Provisioning wait timeout in seconds | 1200 | no
|
113
|
+
`rebuild_timeout` | Rebuild wait timeout in seconds | 1200 | no
|
114
|
+
|
108
115
|
These can be set like typical provider-specific configuration:
|
109
116
|
|
110
117
|
```
|
@@ -247,6 +254,3 @@ $ bundle exec vagrant up --provider=softlayer
|
|
247
254
|
|
248
255
|
Emiliano Ticci (@emyl)
|
249
256
|
Julio Lajara (@ju2wheels)
|
250
|
-
|
251
|
-
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/audiolize/vagrant-softlayer/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
252
|
-
|
data/lib/vagrant-softlayer.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
require "pathname"
|
2
|
-
require "softlayer_api"
|
3
|
-
require "vagrant-softlayer/plugin"
|
4
|
-
|
5
|
-
module VagrantPlugins
|
6
|
-
module SoftLayer
|
7
|
-
API_PRIVATE_ENDPOINT = ::SoftLayer::API_PRIVATE_ENDPOINT
|
8
|
-
API_PUBLIC_ENDPOINT = ::SoftLayer::API_PUBLIC_ENDPOINT
|
9
|
-
|
10
|
-
lib_path = Pathname.new(File.expand_path("../vagrant-softlayer", __FILE__))
|
11
|
-
autoload :Action, lib_path.join("action")
|
12
|
-
autoload :Config, lib_path.join("config")
|
13
|
-
autoload :Errors, lib_path.join("errors")
|
14
|
-
|
15
|
-
# This returns the path to the source of this plugin.
|
16
|
-
#
|
17
|
-
# @return [Pathname]
|
18
|
-
def self.source_root
|
19
|
-
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
require "pathname"
|
2
|
+
require "softlayer_api"
|
3
|
+
require "vagrant-softlayer/plugin"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module SoftLayer
|
7
|
+
API_PRIVATE_ENDPOINT = ::SoftLayer::API_PRIVATE_ENDPOINT
|
8
|
+
API_PUBLIC_ENDPOINT = ::SoftLayer::API_PUBLIC_ENDPOINT
|
9
|
+
|
10
|
+
lib_path = Pathname.new(File.expand_path("../vagrant-softlayer", __FILE__))
|
11
|
+
autoload :Action, lib_path.join("action")
|
12
|
+
autoload :Config, lib_path.join("config")
|
13
|
+
autoload :Errors, lib_path.join("errors")
|
14
|
+
|
15
|
+
# This returns the path to the source of this plugin.
|
16
|
+
#
|
17
|
+
# @return [Pathname]
|
18
|
+
def self.source_root
|
19
|
+
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -60,7 +60,7 @@ module VagrantPlugins
|
|
60
60
|
end
|
61
61
|
|
62
62
|
b2.use Provision
|
63
|
-
b2.use SyncFolders
|
63
|
+
defined?(SyncedFolders) ? b2.use(SyncedFolders) : b2.use(SyncFolders)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -100,7 +100,7 @@ module VagrantPlugins
|
|
100
100
|
b3.use SetupSoftLayer
|
101
101
|
b3.use RebuildInstance
|
102
102
|
b3.use Provision
|
103
|
-
b3.use SyncFolders
|
103
|
+
defined?(SyncedFolders) ? b3.use(SyncedFolders) : b3.use(SyncFolders)
|
104
104
|
b3.use WaitForRebuild
|
105
105
|
b3.use WaitForCommunicator
|
106
106
|
end
|
@@ -195,7 +195,7 @@ module VagrantPlugins
|
|
195
195
|
if env1[:result]
|
196
196
|
b1.use SetupSoftLayer
|
197
197
|
b1.use Provision
|
198
|
-
b1.use SyncFolders
|
198
|
+
defined?(SyncedFolders) ? b1.use(SyncedFolders) : b1.use(SyncFolders)
|
199
199
|
b1.use CreateInstance
|
200
200
|
b1.use WaitForProvision
|
201
201
|
b1.use UpdateDNS
|
@@ -206,7 +206,7 @@ module VagrantPlugins
|
|
206
206
|
if env2[:result]
|
207
207
|
b2.use SetupSoftLayer
|
208
208
|
b2.use Provision
|
209
|
-
b2.use SyncFolders
|
209
|
+
defined?(SyncedFolders) ? b2.use(SyncedFolders) : b2.use(SyncFolders)
|
210
210
|
b2.use StartInstance
|
211
211
|
b2.use UpdateDNS
|
212
212
|
b2.use JoinLoadBalancer
|
@@ -1,23 +1,23 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module SoftLayer
|
3
|
-
module Action
|
4
|
-
# This deletes the running instance.
|
5
|
-
class DestroyInstance
|
6
|
-
include Util::Warden
|
7
|
-
|
8
|
-
def initialize(app, env)
|
9
|
-
@app = app
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
env[:ui].info I18n.t("vagrant_softlayer.vm.destroying")
|
14
|
-
|
15
|
-
sl_warden { env[:sl_machine].deleteObject }
|
16
|
-
env[:machine].id = nil
|
17
|
-
|
18
|
-
@app.call(env)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
1
|
+
module VagrantPlugins
|
2
|
+
module SoftLayer
|
3
|
+
module Action
|
4
|
+
# This deletes the running instance.
|
5
|
+
class DestroyInstance
|
6
|
+
include Util::Warden
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
env[:ui].info I18n.t("vagrant_softlayer.vm.destroying")
|
14
|
+
|
15
|
+
sl_warden { env[:sl_machine].deleteObject }
|
16
|
+
env[:machine].id = nil
|
17
|
+
|
18
|
+
@app.call(env)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,28 +1,28 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module SoftLayer
|
3
|
-
module Action
|
4
|
-
# This action reads the SSH info for the machine and puts it into the
|
5
|
-
# `:machine_ssh_info` key in the environment.
|
6
|
-
class ReadSSHInfo
|
7
|
-
include Util::Network
|
8
|
-
include Util::Warden
|
9
|
-
|
10
|
-
def initialize(app, env)
|
11
|
-
@app = app
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(env)
|
15
|
-
env[:machine_ssh_info] = read_ssh_info(env)
|
16
|
-
|
17
|
-
@app.call(env)
|
18
|
-
end
|
19
|
-
|
20
|
-
def read_ssh_info(env)
|
21
|
-
return nil unless env[:sl_machine]
|
22
|
-
|
23
|
-
return { :host => ip_address(env), :port => 22 }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
1
|
+
module VagrantPlugins
|
2
|
+
module SoftLayer
|
3
|
+
module Action
|
4
|
+
# This action reads the SSH info for the machine and puts it into the
|
5
|
+
# `:machine_ssh_info` key in the environment.
|
6
|
+
class ReadSSHInfo
|
7
|
+
include Util::Network
|
8
|
+
include Util::Warden
|
9
|
+
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
env[:machine_ssh_info] = read_ssh_info(env)
|
16
|
+
|
17
|
+
@app.call(env)
|
18
|
+
end
|
19
|
+
|
20
|
+
def read_ssh_info(env)
|
21
|
+
return nil unless env[:sl_machine]
|
22
|
+
|
23
|
+
return { :host => ip_address(env), :port => 22 }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
|
-
module VagrantPlugins
|
4
|
-
module SoftLayer
|
5
|
-
module Action
|
6
|
-
# This action reads the state of the machine and puts it in the
|
7
|
-
# `:machine_state_id` key in the environment.
|
8
|
-
class ReadState
|
9
|
-
include Util::Warden
|
10
|
-
|
11
|
-
def initialize(app, env)
|
12
|
-
@app = app
|
13
|
-
@logger = Log4r::Logger.new("vagrant_softlayer::action::read_state")
|
14
|
-
end
|
15
|
-
|
16
|
-
def call(env)
|
17
|
-
env[:machine_state_id] = read_state(env)
|
18
|
-
|
19
|
-
# Carry on
|
20
|
-
@app.call(env)
|
21
|
-
end
|
22
|
-
|
23
|
-
def read_state(env)
|
24
|
-
return :not_created unless env[:sl_machine]
|
25
|
-
|
26
|
-
wipe_id = lambda do
|
27
|
-
@logger.info("Machine not found, assuming it got destroyed.")
|
28
|
-
env[:machine].id = nil
|
29
|
-
next :not_created
|
30
|
-
end
|
31
|
-
|
32
|
-
state = sl_warden(wipe_id) { env[:sl_machine].getPowerState }
|
33
|
-
if state && ["Halted", "Paused", "Running"].include?(state["name"])
|
34
|
-
return state["name"].downcase.to_sym
|
35
|
-
else
|
36
|
-
return :unknown
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module SoftLayer
|
5
|
+
module Action
|
6
|
+
# This action reads the state of the machine and puts it in the
|
7
|
+
# `:machine_state_id` key in the environment.
|
8
|
+
class ReadState
|
9
|
+
include Util::Warden
|
10
|
+
|
11
|
+
def initialize(app, env)
|
12
|
+
@app = app
|
13
|
+
@logger = Log4r::Logger.new("vagrant_softlayer::action::read_state")
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
env[:machine_state_id] = read_state(env)
|
18
|
+
|
19
|
+
# Carry on
|
20
|
+
@app.call(env)
|
21
|
+
end
|
22
|
+
|
23
|
+
def read_state(env)
|
24
|
+
return :not_created unless env[:sl_machine]
|
25
|
+
|
26
|
+
wipe_id = lambda do
|
27
|
+
@logger.info("Machine not found, assuming it got destroyed.")
|
28
|
+
env[:machine].id = nil
|
29
|
+
next :not_created
|
30
|
+
end
|
31
|
+
|
32
|
+
state = sl_warden(wipe_id) { env[:sl_machine].getPowerState }
|
33
|
+
if state && ["Halted", "Paused", "Running"].include?(state["name"])
|
34
|
+
return state["name"].downcase.to_sym
|
35
|
+
else
|
36
|
+
return :unknown
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module SoftLayer
|
3
|
-
module Action
|
4
|
-
# This rebuilds the running instance.
|
5
|
-
class RebuildInstance
|
6
|
-
include Util::Network
|
7
|
-
include Util::Warden
|
8
|
-
|
9
|
-
def initialize(app, env)
|
10
|
-
@app = app
|
11
|
-
@logger = Log4r::Logger.new("vagrant_softlayer::action::rebuild_instance")
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(env)
|
15
|
-
env[:ui].info I18n.t("vagrant_softlayer.vm.rebuilding")
|
16
|
-
|
17
|
-
# Wipe out provision sentinel file, we need to run provisioning after rebuild
|
18
|
-
@logger.debug("Looking for provision sentinel file.")
|
19
|
-
provision_file = env[:machine].data_dir.join("action_provision")
|
20
|
-
if provision_file.file?
|
21
|
-
@logger.debug("Removing provision sentinel file.")
|
22
|
-
provision_file.delete
|
23
|
-
end
|
24
|
-
|
25
|
-
template = { "sshKeyIds" => ssh_keys(env, true) }
|
26
|
-
template["customProvisionScriptUri"] = env[:machine].provider_config.post_install if env[:machine].provider_config.post_install
|
27
|
-
|
28
|
-
sl_warden { env[:sl_machine].reloadOperatingSystem("FORCE", template) }
|
29
|
-
|
30
|
-
@app.call(env)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
module VagrantPlugins
|
2
|
+
module SoftLayer
|
3
|
+
module Action
|
4
|
+
# This rebuilds the running instance.
|
5
|
+
class RebuildInstance
|
6
|
+
include Util::Network
|
7
|
+
include Util::Warden
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
@logger = Log4r::Logger.new("vagrant_softlayer::action::rebuild_instance")
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
env[:ui].info I18n.t("vagrant_softlayer.vm.rebuilding")
|
16
|
+
|
17
|
+
# Wipe out provision sentinel file, we need to run provisioning after rebuild
|
18
|
+
@logger.debug("Looking for provision sentinel file.")
|
19
|
+
provision_file = env[:machine].data_dir.join("action_provision")
|
20
|
+
if provision_file.file?
|
21
|
+
@logger.debug("Removing provision sentinel file.")
|
22
|
+
provision_file.delete
|
23
|
+
end
|
24
|
+
|
25
|
+
template = { "sshKeyIds" => ssh_keys(env, true) }
|
26
|
+
template["customProvisionScriptUri"] = env[:machine].provider_config.post_install if env[:machine].provider_config.post_install
|
27
|
+
|
28
|
+
sl_warden { env[:sl_machine].reloadOperatingSystem("FORCE", template) }
|
29
|
+
|
30
|
+
@app.call(env)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module SoftLayer
|
3
|
-
module Action
|
4
|
-
# This starts a stopped instance.
|
5
|
-
class StartInstance
|
6
|
-
include Util::Warden
|
7
|
-
|
8
|
-
def initialize(app, env)
|
9
|
-
@app = app
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
env[:ui].info I18n.t("vagrant_softlayer.vm.starting")
|
14
|
-
sl_warden { env[:sl_machine].powerOn }
|
15
|
-
|
16
|
-
@app.call(env)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
module VagrantPlugins
|
2
|
+
module SoftLayer
|
3
|
+
module Action
|
4
|
+
# This starts a stopped instance.
|
5
|
+
class StartInstance
|
6
|
+
include Util::Warden
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
env[:ui].info I18n.t("vagrant_softlayer.vm.starting")
|
14
|
+
sl_warden { env[:sl_machine].powerOn }
|
15
|
+
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module SoftLayer
|
3
|
-
module Action
|
4
|
-
# This stops the running instance.
|
5
|
-
class StopInstance
|
6
|
-
include Util::Warden
|
7
|
-
|
8
|
-
def initialize(app, env)
|
9
|
-
@app = app
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
if env[:machine].state.id == :halted
|
14
|
-
env[:ui].info I18n.t("vagrant_softlayer.vm.already_stopped")
|
15
|
-
else
|
16
|
-
if env[:force_halt]
|
17
|
-
env[:ui].info I18n.t("vagrant_softlayer.vm.stopping_force")
|
18
|
-
sl_warden { env[:sl_machine].powerOff }
|
19
|
-
else
|
20
|
-
env[:ui].info I18n.t("vagrant_softlayer.vm.stopping")
|
21
|
-
sl_warden { env[:sl_machine].powerOffSoft }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
@app.call(env)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
module VagrantPlugins
|
2
|
+
module SoftLayer
|
3
|
+
module Action
|
4
|
+
# This stops the running instance.
|
5
|
+
class StopInstance
|
6
|
+
include Util::Warden
|
7
|
+
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
if env[:machine].state.id == :halted
|
14
|
+
env[:ui].info I18n.t("vagrant_softlayer.vm.already_stopped")
|
15
|
+
else
|
16
|
+
if env[:force_halt]
|
17
|
+
env[:ui].info I18n.t("vagrant_softlayer.vm.stopping_force")
|
18
|
+
sl_warden { env[:sl_machine].powerOff }
|
19
|
+
else
|
20
|
+
env[:ui].info I18n.t("vagrant_softlayer.vm.stopping")
|
21
|
+
sl_warden { env[:sl_machine].powerOffSoft }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
@app.call(env)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -19,8 +19,8 @@ module VagrantPlugins
|
|
19
19
|
|
20
20
|
retry_msg = lambda { @logger.debug("Object not found, retrying in 10 seconds.") }
|
21
21
|
|
22
|
-
# 20 minutes timeout
|
23
|
-
Timeout::timeout(
|
22
|
+
# Defaults to 20 minutes timeout
|
23
|
+
Timeout::timeout(env[:machine].provider_config.provision_timeout, Errors::SLProvisionTimeoutError) do
|
24
24
|
@logger.debug("Checking if the newly ordered machine has been provisioned.")
|
25
25
|
sl_warden(retry_msg, 10) do
|
26
26
|
while env[:sl_machine].getPowerState["name"] != "Running" || env[:sl_machine].object_mask( { "provisionDate" => "" } ).getObject == {}
|
@@ -31,7 +31,7 @@ module VagrantPlugins
|
|
31
31
|
end
|
32
32
|
|
33
33
|
env[:ui].info I18n.t("vagrant_softlayer.vm.provisioned")
|
34
|
-
|
34
|
+
|
35
35
|
@app.call(env)
|
36
36
|
end
|
37
37
|
end
|
@@ -15,8 +15,8 @@ module VagrantPlugins
|
|
15
15
|
def call(env)
|
16
16
|
env[:ui].info I18n.t("vagrant_softlayer.vm.wait_for_rebuild")
|
17
17
|
|
18
|
-
# 20 minutes timeout
|
19
|
-
Timeout::timeout(
|
18
|
+
# Defaults to 20 minutes timeout
|
19
|
+
Timeout::timeout(env[:machine].provider_config.rebuild_timeout, Errors::SLRebuildTimeoutError) do
|
20
20
|
@logger.debug("Checking if the instance has been rebuilt.")
|
21
21
|
sl_warden do
|
22
22
|
while env[:sl_machine].object_mask("activeTransactionCount").getObject["activeTransactionCount"] > 0
|
@@ -27,7 +27,7 @@ module VagrantPlugins
|
|
27
27
|
end
|
28
28
|
|
29
29
|
env[:ui].info I18n.t("vagrant_softlayer.vm.rebuilt")
|
30
|
-
|
30
|
+
|
31
31
|
@app.call(env)
|
32
32
|
end
|
33
33
|
end
|
@@ -54,6 +54,12 @@ module VagrantPlugins
|
|
54
54
|
# Whether or not the instance only has access to the private network.
|
55
55
|
attr_accessor :private_only
|
56
56
|
|
57
|
+
# The amount of time in seconds to wait for provision to complete.
|
58
|
+
attr_accessor :provision_timeout
|
59
|
+
|
60
|
+
# The amount of time in seconds to wait for rebuild to complete.
|
61
|
+
attr_accessor :rebuild_timeout
|
62
|
+
|
57
63
|
# The id or name of the ssh key to be provisioned.
|
58
64
|
attr_accessor :ssh_key
|
59
65
|
|
@@ -80,25 +86,27 @@ module VagrantPlugins
|
|
80
86
|
@endpoint_url = UNSET_VALUE
|
81
87
|
@username = UNSET_VALUE
|
82
88
|
|
83
|
-
@datacenter
|
84
|
-
@dedicated
|
85
|
-
@disk_capacity
|
86
|
-
@domain
|
87
|
-
@force_private_ip
|
88
|
-
@hostname
|
89
|
-
@image_guid
|
90
|
-
@hourly_billing
|
91
|
-
@local_disk
|
92
|
-
@max_memory
|
93
|
-
@network_speed
|
94
|
-
@operating_system
|
95
|
-
@post_install
|
96
|
-
@private_only
|
97
|
-
@
|
98
|
-
@
|
99
|
-
@
|
100
|
-
@
|
101
|
-
@
|
89
|
+
@datacenter = UNSET_VALUE
|
90
|
+
@dedicated = UNSET_VALUE
|
91
|
+
@disk_capacity = UNSET_VALUE
|
92
|
+
@domain = UNSET_VALUE
|
93
|
+
@force_private_ip = UNSET_VALUE
|
94
|
+
@hostname = UNSET_VALUE
|
95
|
+
@image_guid = UNSET_VALUE
|
96
|
+
@hourly_billing = UNSET_VALUE
|
97
|
+
@local_disk = UNSET_VALUE
|
98
|
+
@max_memory = UNSET_VALUE
|
99
|
+
@network_speed = UNSET_VALUE
|
100
|
+
@operating_system = UNSET_VALUE
|
101
|
+
@post_install = UNSET_VALUE
|
102
|
+
@private_only = UNSET_VALUE
|
103
|
+
@provision_timeout = UNSET_VALUE
|
104
|
+
@rebuild_timeout = UNSET_VALUE
|
105
|
+
@ssh_key = UNSET_VALUE
|
106
|
+
@start_cpus = UNSET_VALUE
|
107
|
+
@user_data = UNSET_VALUE
|
108
|
+
@vlan_private = UNSET_VALUE
|
109
|
+
@vlan_public = UNSET_VALUE
|
102
110
|
|
103
111
|
@load_balancers = []
|
104
112
|
@manage_dns = UNSET_VALUE
|
@@ -189,6 +197,12 @@ module VagrantPlugins
|
|
189
197
|
# Private-network only is false by default.
|
190
198
|
@private_only = false if @private_only == UNSET_VALUE
|
191
199
|
|
200
|
+
# The amount of time in seconds to wait for provision to complete.
|
201
|
+
@provision_timeout = 1200 if @provision_timeout == UNSET_VALUE
|
202
|
+
|
203
|
+
# The amount of time in seconds to wait for rebuild to complete.
|
204
|
+
@rebuild_timeout = 1200 if @rebuild_timeout == UNSET_VALUE
|
205
|
+
|
192
206
|
# SSH key should be specified in Vagrantfile, so we set default to nil.
|
193
207
|
@ssh_key = nil if @ssh_key == UNSET_VALUE
|
194
208
|
|
@@ -21,6 +21,14 @@ module VagrantPlugins
|
|
21
21
|
error_key(:load_balancer_not_found)
|
22
22
|
end
|
23
23
|
|
24
|
+
class SLProvisionTimeoutError < VagrantSoftLayerError
|
25
|
+
error_key(:provision_timeout_error)
|
26
|
+
end
|
27
|
+
|
28
|
+
class SLRebuildTimeoutError < VagrantSoftLayerError
|
29
|
+
error_key(:rebuild_timeout_error)
|
30
|
+
end
|
31
|
+
|
24
32
|
class SLSshKeyNotFound < VagrantSoftLayerError
|
25
33
|
error_key(:ssh_key_not_found)
|
26
34
|
end
|
data/locales/en.yml
CHANGED
@@ -120,6 +120,30 @@ en:
|
|
120
120
|
The load balancer you're trying to join has not been found.
|
121
121
|
|
122
122
|
Please check the configuration parameter for virtual IP address.
|
123
|
+
provision_timeout_error: |-
|
124
|
+
Timed out while waiting for the instance to be available. This
|
125
|
+
means that Vagrant was unable to communicate with the instance
|
126
|
+
within the configured time period.
|
127
|
+
|
128
|
+
Please check the instance status using another SoftLayer
|
129
|
+
client tool (e.g. `sl` command line utility). If the box appears
|
130
|
+
to be properly up, you may want to increase the provision timeout:
|
131
|
+
|
132
|
+
config.vm.provider :softlayer do |sl|
|
133
|
+
sl.provision_timeout = 99999 # in seconds
|
134
|
+
end
|
135
|
+
rebuild_timeout_error: |-
|
136
|
+
Timed out while waiting for the instance to be available. This
|
137
|
+
means that Vagrant was unable to communicate with the instance
|
138
|
+
within the configured time period.
|
139
|
+
|
140
|
+
Please check the instance status using another SoftLayer
|
141
|
+
client tool (e.g. `sl` command line utility). If the box appears
|
142
|
+
to be properly up, you may want to increase the rebuild timeout:
|
143
|
+
|
144
|
+
config.vm.provider :softlayer do |sl|
|
145
|
+
sl.rebuild_timeout = 99999 # in seconds
|
146
|
+
end
|
123
147
|
ssh_key_not_found: |-
|
124
148
|
The SSH key you're trying to set (%{key}) does not exists in the
|
125
149
|
SoftLayer account's keychain.
|
@@ -15,25 +15,27 @@ describe VagrantPlugins::SoftLayer::Config do
|
|
15
15
|
its("endpoint_url") { should eq VagrantPlugins::SoftLayer::API_PUBLIC_ENDPOINT }
|
16
16
|
its("username") { should be_nil }
|
17
17
|
|
18
|
-
its("datacenter")
|
19
|
-
its("dedicated")
|
20
|
-
its("disk_capacity")
|
21
|
-
its("domain")
|
22
|
-
its("force_private_ip")
|
23
|
-
its("hostname")
|
24
|
-
its("hourly_billing")
|
25
|
-
its("image_guid")
|
26
|
-
its("local_disk")
|
27
|
-
its("max_memory")
|
28
|
-
its("network_speed")
|
29
|
-
its("operating_system")
|
30
|
-
its("post_install")
|
31
|
-
its("private_only")
|
32
|
-
its("
|
33
|
-
its("
|
34
|
-
its("
|
35
|
-
its("
|
36
|
-
its("
|
18
|
+
its("datacenter") { should be_nil }
|
19
|
+
its("dedicated") { should be_false }
|
20
|
+
its("disk_capacity") { should be_nil }
|
21
|
+
its("domain") { should be_nil }
|
22
|
+
its("force_private_ip") { should be_false }
|
23
|
+
its("hostname") { should be_nil }
|
24
|
+
its("hourly_billing") { should be_true }
|
25
|
+
its("image_guid") { should be_nil }
|
26
|
+
its("local_disk") { should be_true }
|
27
|
+
its("max_memory") { should eq 1024 }
|
28
|
+
its("network_speed") { should eq 10 }
|
29
|
+
its("operating_system") { should eq "UBUNTU_LATEST" }
|
30
|
+
its("post_install") { should be_nil }
|
31
|
+
its("private_only") { should be_false }
|
32
|
+
its("provision_timeout") { should eq 1200 }
|
33
|
+
its("rebuild_timeout") { should eq 1200 }
|
34
|
+
its("ssh_key") { should be_nil }
|
35
|
+
its("start_cpus") { should eq 1 }
|
36
|
+
its("user_data") { should be_nil }
|
37
|
+
its("vlan_private") { should be_nil }
|
38
|
+
its("vlan_public") { should be_nil }
|
37
39
|
|
38
40
|
its("load_balancers") { should eq [] }
|
39
41
|
its("manage_dns") { should be_false }
|
@@ -53,7 +55,7 @@ describe VagrantPlugins::SoftLayer::Config do
|
|
53
55
|
end
|
54
56
|
|
55
57
|
context "integers" do
|
56
|
-
[:max_memory, :network_speed, :ssh_key, :start_cpus, :vlan_private, :vlan_public].each do |attribute|
|
58
|
+
[:max_memory, :network_speed, :provision_timeout, :rebuild_timeout, :ssh_key, :start_cpus, :vlan_private, :vlan_public].each do |attribute|
|
57
59
|
it "should not default #{attribute} if overridden" do
|
58
60
|
config.send("#{attribute}=".to_sym, 999)
|
59
61
|
config.finalize!
|
@@ -131,26 +133,28 @@ describe VagrantPlugins::SoftLayer::Config do
|
|
131
133
|
config.api_key = "An API key"
|
132
134
|
config.username = "An username"
|
133
135
|
|
134
|
-
config.datacenter
|
135
|
-
config.dedicated
|
136
|
-
config.domain
|
137
|
-
config.disk_capacity
|
138
|
-
config.force_private_ip
|
139
|
-
config.hostname
|
140
|
-
config.hourly_billing
|
141
|
-
config.image_guid
|
142
|
-
config.local_disk
|
143
|
-
config.max_memory
|
144
|
-
config.network_speed
|
145
|
-
config.operating_system
|
146
|
-
config.post_install
|
147
|
-
config.
|
148
|
-
config.
|
149
|
-
config.
|
150
|
-
config.
|
151
|
-
config.
|
152
|
-
|
153
|
-
config.
|
136
|
+
config.datacenter = "ams01"
|
137
|
+
config.dedicated = false
|
138
|
+
config.domain = "example.com"
|
139
|
+
config.disk_capacity = { 0 => 25 }
|
140
|
+
config.force_private_ip = false
|
141
|
+
config.hostname = "vagrant"
|
142
|
+
config.hourly_billing = true
|
143
|
+
config.image_guid = nil
|
144
|
+
config.local_disk = true
|
145
|
+
config.max_memory = 1024
|
146
|
+
config.network_speed = 10
|
147
|
+
config.operating_system = "UBUNTU_LATEST"
|
148
|
+
config.post_install = "http://example.com/foo"
|
149
|
+
config.provision_timeout = 1200
|
150
|
+
config.rebuild_timeout = 1200
|
151
|
+
config.ssh_key = ["First key", "Second key"]
|
152
|
+
config.start_cpus = 1
|
153
|
+
config.user_data = "some metadata"
|
154
|
+
config.vlan_private = 111
|
155
|
+
config.vlan_public = 222
|
156
|
+
|
157
|
+
config.manage_dns = false
|
154
158
|
|
155
159
|
machine.stub_chain(:config, :vm, :hostname).and_return(nil)
|
156
160
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-softlayer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Audiolize GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: softlayer_api
|