jamie-bluebox 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/jamie-bluebox.gemspec +1 -1
- data/lib/jamie/driver/bluebox.rb +23 -23
- data/lib/jamie/driver/bluebox_version.rb +1 -1
- metadata +6 -6
data/jamie-bluebox.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency 'jamie', '~> 0.1.0.
|
21
|
+
gem.add_dependency 'jamie', '~> 0.1.0.alpha21'
|
22
22
|
gem.add_dependency 'fog'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'yard'
|
data/lib/jamie/driver/bluebox.rb
CHANGED
@@ -30,31 +30,31 @@ module Jamie
|
|
30
30
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
31
31
|
class Bluebox < Jamie::Driver::SSHBase
|
32
32
|
|
33
|
-
default_config
|
34
|
-
default_config
|
35
|
-
default_config
|
36
|
-
default_config
|
37
|
-
default_config
|
33
|
+
default_config :flavor_id, '94fd37a7-2606-47f7-84d5-9000deda52ae'
|
34
|
+
default_config :image_id, '573b8e80-823f-4100-bc2c-51b7c60f633c'
|
35
|
+
default_config :location_id, '37c2bd9a-3e81-46c9-b6e2-db44a25cc675'
|
36
|
+
default_config :username, 'jamie'
|
37
|
+
default_config :port, '22'
|
38
38
|
|
39
39
|
def create(state)
|
40
40
|
server = create_server
|
41
|
-
state[
|
42
|
-
state[
|
41
|
+
state[:block_id] = server.id
|
42
|
+
state[:hostname] = server.ips.first['address']
|
43
43
|
|
44
|
-
info("Blocks instance <#{state[
|
44
|
+
info("Blocks instance <#{state[:block_id]}> created.")
|
45
45
|
server.wait_for { print "."; ready? } ; print "(server ready)"
|
46
|
-
wait_for_sshd(state[
|
46
|
+
wait_for_sshd(state[:hostname]) ; print "(ssh ready)\n"
|
47
47
|
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
48
48
|
raise ActionFailed, ex.message
|
49
49
|
end
|
50
50
|
|
51
51
|
def destroy(state)
|
52
|
-
return if state[
|
52
|
+
return if state[:block_id].nil?
|
53
53
|
|
54
|
-
connection.destroy_block(state[
|
55
|
-
info("Blocks instance <#{state[
|
56
|
-
state.delete(
|
57
|
-
state.delete(
|
54
|
+
connection.destroy_block(state[:block_id])
|
55
|
+
info("Blocks instance <#{state[:block_id]}> destroyed.")
|
56
|
+
state.delete(:block_id)
|
57
|
+
state.delete(:hostname)
|
58
58
|
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
59
59
|
raise ActionFailed, ex.message
|
60
60
|
end
|
@@ -64,22 +64,22 @@ module Jamie
|
|
64
64
|
def connection
|
65
65
|
Fog::Compute.new(
|
66
66
|
:provider => :bluebox,
|
67
|
-
:bluebox_customer_id => config[
|
68
|
-
:bluebox_api_key => config[
|
67
|
+
:bluebox_customer_id => config[:bluebox_customer_id],
|
68
|
+
:bluebox_api_key => config[:bluebox_api_key],
|
69
69
|
)
|
70
70
|
end
|
71
71
|
|
72
72
|
def create_server
|
73
73
|
opts = {
|
74
|
-
:flavor_id => config[
|
75
|
-
:image_id => config[
|
76
|
-
:location_id => config[
|
74
|
+
:flavor_id => config[:flavor_id],
|
75
|
+
:image_id => config[:image_id],
|
76
|
+
:location_id => config[:location_id],
|
77
77
|
:hostname => instance.name,
|
78
|
-
:username => config[
|
79
|
-
:password => config[
|
78
|
+
:username => config[:username],
|
79
|
+
:password => config[:password] || "",
|
80
80
|
}
|
81
|
-
if config[
|
82
|
-
opts[:public_key] = IO.read(config[
|
81
|
+
if config[:ssh_public_key] && File.exists?(config[:ssh_public_key])
|
82
|
+
opts[:public_key] = IO.read(config[:ssh_public_key])
|
83
83
|
end
|
84
84
|
|
85
85
|
connection.servers.create(opts)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jamie-bluebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jamie
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.1.0.
|
21
|
+
version: 0.1.0.alpha21
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.1.0.
|
29
|
+
version: 0.1.0.alpha21
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: fog
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
segments:
|
155
155
|
- 0
|
156
|
-
hash: -
|
156
|
+
hash: -4396382168898171825
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
none: false
|
159
159
|
requirements:
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
segments:
|
164
164
|
- 0
|
165
|
-
hash: -
|
165
|
+
hash: -4396382168898171825
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project:
|
168
168
|
rubygems_version: 1.8.24
|