jamie-bluebox 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +20 -0
- data/.travis.yml +3 -0
- data/Gemfile +8 -0
- data/LICENSE +15 -0
- data/README.md +29 -0
- data/Rakefile +10 -0
- data/jamie-bluebox.gemspec +28 -0
- data/lib/jamie/driver/bluebox.rb +67 -0
- data/lib/jamie/driver/bluebox_version.rb +7 -0
- metadata +157 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
|
2
|
+
|
|
3
|
+
Copyright 2012 Fletcher Nichol
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Jamie::Driver::Bluebox
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'jamie-driver-bluebox'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install jamie-driver-bluebox
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
TODO: Write usage instructions here
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
1. Fork it
|
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'jamie/driver/bluebox_version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "jamie-bluebox"
|
|
8
|
+
gem.version = Jamie::Driver::BLUEBOX_VERSION
|
|
9
|
+
gem.authors = ["Fletcher Nichol"]
|
|
10
|
+
gem.email = ["fnichol@nichol.ca"]
|
|
11
|
+
gem.description =
|
|
12
|
+
%q{Jamie::Driver::Bluebox - A Blue Box block API driver for Jamie}
|
|
13
|
+
gem.summary = gem.description
|
|
14
|
+
gem.homepage = "https://github.com/jamie-ci/jamie-bluebox"
|
|
15
|
+
|
|
16
|
+
gem.files = `git ls-files`.split($/)
|
|
17
|
+
gem.executables = []
|
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
gem.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
gem.add_dependency 'jamie'
|
|
22
|
+
gem.add_dependency 'fog'
|
|
23
|
+
|
|
24
|
+
gem.add_development_dependency 'yard'
|
|
25
|
+
gem.add_development_dependency 'maruku'
|
|
26
|
+
gem.add_development_dependency 'cane'
|
|
27
|
+
gem.add_development_dependency 'tailor'
|
|
28
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
require 'benchmark'
|
|
4
|
+
require 'fog'
|
|
5
|
+
|
|
6
|
+
require 'jamie'
|
|
7
|
+
|
|
8
|
+
module Jamie
|
|
9
|
+
|
|
10
|
+
module Driver
|
|
11
|
+
|
|
12
|
+
# Blue Box blocks API driver for Jamie.
|
|
13
|
+
class Bluebox < Jamie::Driver::SSHBase
|
|
14
|
+
|
|
15
|
+
default_config 'flavor_id', '94fd37a7-2606-47f7-84d5-9000deda52ae'
|
|
16
|
+
default_config 'image_id', '573b8e80-823f-4100-bc2c-51b7c60f633c'
|
|
17
|
+
default_config 'location_id', '37c2bd9a-3e81-46c9-b6e2-db44a25cc675'
|
|
18
|
+
default_config 'username', 'jamie'
|
|
19
|
+
default_config 'port', '22'
|
|
20
|
+
|
|
21
|
+
def create(instance, state)
|
|
22
|
+
server = create_server(instance)
|
|
23
|
+
state['block_id'] = server.id
|
|
24
|
+
state['hostname'] = server.ips.first['address']
|
|
25
|
+
|
|
26
|
+
elapsed = Benchmark.measure do
|
|
27
|
+
server.wait_for { print "."; ready? } ; print "(server ready)"
|
|
28
|
+
wait_for_sshd(state['hostname']) ; print "(ssh read)\n"
|
|
29
|
+
end
|
|
30
|
+
puts " Created #{instance.name} in #{elapsed.real} seconds."
|
|
31
|
+
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
|
32
|
+
raise ActionFailed, ex.message
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def destroy(instance, state)
|
|
36
|
+
return if state['block_id'].nil?
|
|
37
|
+
|
|
38
|
+
connection.destroy_block(state['block_id'])
|
|
39
|
+
state.delete('block_id')
|
|
40
|
+
state.delete('hostname')
|
|
41
|
+
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
|
42
|
+
raise ActionFailed, ex.message
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def connection
|
|
48
|
+
Fog::Compute.new(
|
|
49
|
+
:provider => :bluebox,
|
|
50
|
+
:bluebox_customer_id => config['bluebox_customer_id'],
|
|
51
|
+
:bluebox_api_key => config['bluebox_api_key'],
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def create_server(instance)
|
|
56
|
+
connection.servers.create(
|
|
57
|
+
:flavor_id => config['flavor_id'],
|
|
58
|
+
:image_id => config['image_id'],
|
|
59
|
+
:location_id => config['location_id'],
|
|
60
|
+
:hostname => instance.name,
|
|
61
|
+
:username => config['username'],
|
|
62
|
+
:password => config['password'],
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jamie-bluebox
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Fletcher Nichol
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-12-27 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: jamie
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: fog
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: yard
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: maruku
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :development
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: cane
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ! '>='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '0'
|
|
86
|
+
type: :development
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: tailor
|
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
|
97
|
+
none: false
|
|
98
|
+
requirements:
|
|
99
|
+
- - ! '>='
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '0'
|
|
102
|
+
type: :development
|
|
103
|
+
prerelease: false
|
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
106
|
+
requirements:
|
|
107
|
+
- - ! '>='
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
description: Jamie::Driver::Bluebox - A Blue Box block API driver for Jamie
|
|
111
|
+
email:
|
|
112
|
+
- fnichol@nichol.ca
|
|
113
|
+
executables: []
|
|
114
|
+
extensions: []
|
|
115
|
+
extra_rdoc_files: []
|
|
116
|
+
files:
|
|
117
|
+
- .gitignore
|
|
118
|
+
- .travis.yml
|
|
119
|
+
- Gemfile
|
|
120
|
+
- LICENSE
|
|
121
|
+
- README.md
|
|
122
|
+
- Rakefile
|
|
123
|
+
- jamie-bluebox.gemspec
|
|
124
|
+
- lib/jamie/driver/bluebox.rb
|
|
125
|
+
- lib/jamie/driver/bluebox_version.rb
|
|
126
|
+
homepage: https://github.com/jamie-ci/jamie-bluebox
|
|
127
|
+
licenses: []
|
|
128
|
+
post_install_message:
|
|
129
|
+
rdoc_options: []
|
|
130
|
+
require_paths:
|
|
131
|
+
- lib
|
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
|
+
none: false
|
|
134
|
+
requirements:
|
|
135
|
+
- - ! '>='
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '0'
|
|
138
|
+
segments:
|
|
139
|
+
- 0
|
|
140
|
+
hash: -2248373637053170227
|
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
|
+
none: false
|
|
143
|
+
requirements:
|
|
144
|
+
- - ! '>='
|
|
145
|
+
- !ruby/object:Gem::Version
|
|
146
|
+
version: '0'
|
|
147
|
+
segments:
|
|
148
|
+
- 0
|
|
149
|
+
hash: -2248373637053170227
|
|
150
|
+
requirements: []
|
|
151
|
+
rubyforge_project:
|
|
152
|
+
rubygems_version: 1.8.24
|
|
153
|
+
signing_key:
|
|
154
|
+
specification_version: 3
|
|
155
|
+
summary: Jamie::Driver::Bluebox - A Blue Box block API driver for Jamie
|
|
156
|
+
test_files: []
|
|
157
|
+
has_rdoc:
|