kitchen-bluebox 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/.travis.yml +3 -0
- data/Gemfile +8 -0
- data/LICENSE +15 -0
- data/README.md +32 -0
- data/Rakefile +16 -0
- data/kitchen-bluebox.gemspec +29 -0
- data/lib/kitchen/driver/bluebox.rb +94 -0
- data/lib/kitchen/driver/bluebox_version.rb +25 -0
- metadata +173 -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,32 @@
|
|
1
|
+
# Kitchen::Driver::Bluebox
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/blueboxgroup/kitchen-bluebox.png)](https://travis-ci.org/blueboxgroup/kitchen-bluebox)
|
4
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/blueboxgroup/kitchen-bluebox)
|
5
|
+
|
6
|
+
TODO: Write a gem description
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'kitchen-bluebox'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install kitchen-bluebox
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'cane/rake_task'
|
3
|
+
require 'tailor/rake_task'
|
4
|
+
|
5
|
+
desc "Run cane to check quality metrics"
|
6
|
+
Cane::RakeTask.new
|
7
|
+
|
8
|
+
Tailor::RakeTask.new
|
9
|
+
|
10
|
+
desc "Display LOC stats"
|
11
|
+
task :stats do
|
12
|
+
puts "\n## Production Code Stats"
|
13
|
+
sh "countloc -r lib/kitchen"
|
14
|
+
end
|
15
|
+
|
16
|
+
task :default => [ :cane, :tailor, :stats ]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kitchen/driver/bluebox_version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "kitchen-bluebox"
|
8
|
+
gem.version = Kitchen::Driver::BLUEBOX_VERSION
|
9
|
+
gem.authors = ["Fletcher Nichol"]
|
10
|
+
gem.email = ["fnichol@nichol.ca"]
|
11
|
+
gem.description =
|
12
|
+
%q{Kitchen::Driver::Bluebox - A Blue Box block API driver for Test Kitchen}
|
13
|
+
gem.summary = gem.description
|
14
|
+
gem.homepage = "https://github.com/blueboxgroup/kitchen-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 'test-kitchen', '~> 1.0.0.alpha.0'
|
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
|
+
gem.add_development_dependency 'countloc'
|
29
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012, Fletcher Nichol
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require 'benchmark'
|
20
|
+
require 'fog'
|
21
|
+
|
22
|
+
require 'kitchen'
|
23
|
+
|
24
|
+
module Kitchen
|
25
|
+
|
26
|
+
module Driver
|
27
|
+
|
28
|
+
# Blue Box blocks API driver for Test Kitchen.
|
29
|
+
#
|
30
|
+
# @author Fletcher Nichol <fnichol@nichol.ca>
|
31
|
+
class Bluebox < Kitchen::Driver::SSHBase
|
32
|
+
|
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, 'kitchen'
|
37
|
+
default_config :port, '22'
|
38
|
+
|
39
|
+
required_config :bluebox_customer_id
|
40
|
+
required_config :bluebox_api_key
|
41
|
+
|
42
|
+
def create(state)
|
43
|
+
server = create_server
|
44
|
+
state[:block_id] = server.id
|
45
|
+
state[:hostname] = server.ips.first['address']
|
46
|
+
|
47
|
+
info("Blocks instance <#{state[:block_id]}> created.")
|
48
|
+
server.wait_for { print "."; ready? } ; print "(server ready)"
|
49
|
+
wait_for_sshd(state[:hostname]) ; print "(ssh ready)\n"
|
50
|
+
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
51
|
+
raise ActionFailed, ex.message
|
52
|
+
end
|
53
|
+
|
54
|
+
def destroy(state)
|
55
|
+
return if state[:block_id].nil?
|
56
|
+
|
57
|
+
connection.destroy_block(state[:block_id])
|
58
|
+
info("Blocks instance <#{state[:block_id]}> destroyed.")
|
59
|
+
state.delete(:block_id)
|
60
|
+
state.delete(:hostname)
|
61
|
+
rescue Fog::Errors::Error, Excon::Errors::Error => ex
|
62
|
+
raise ActionFailed, ex.message
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def connection
|
68
|
+
Fog::Compute.new(
|
69
|
+
:provider => :bluebox,
|
70
|
+
:bluebox_customer_id => config[:bluebox_customer_id],
|
71
|
+
:bluebox_api_key => config[:bluebox_api_key],
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
def create_server
|
76
|
+
opts = {
|
77
|
+
:flavor_id => config[:flavor_id],
|
78
|
+
:image_id => config[:image_id],
|
79
|
+
:location_id => config[:location_id],
|
80
|
+
:hostname => instance.name,
|
81
|
+
:username => config[:username],
|
82
|
+
}
|
83
|
+
if config[:password]
|
84
|
+
opts[:password] = config[:password]
|
85
|
+
end
|
86
|
+
if config[:ssh_public_key] && File.exists?(config[:ssh_public_key])
|
87
|
+
opts[:public_key] = IO.read(config[:ssh_public_key])
|
88
|
+
end
|
89
|
+
|
90
|
+
connection.servers.create(opts)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012, Fletcher Nichol
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
module Kitchen
|
20
|
+
|
21
|
+
module Driver
|
22
|
+
|
23
|
+
BLUEBOX_VERSION = "0.5.0"
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kitchen-bluebox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fletcher Nichol
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-02 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: test-kitchen
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0.alpha.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: 1.0.0.alpha.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
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: countloc
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Kitchen::Driver::Bluebox - A Blue Box block API driver for Test Kitchen
|
127
|
+
email:
|
128
|
+
- fnichol@nichol.ca
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- .travis.yml
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- kitchen-bluebox.gemspec
|
140
|
+
- lib/kitchen/driver/bluebox.rb
|
141
|
+
- lib/kitchen/driver/bluebox_version.rb
|
142
|
+
homepage: https://github.com/blueboxgroup/kitchen-bluebox
|
143
|
+
licenses: []
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
segments:
|
155
|
+
- 0
|
156
|
+
hash: -2100783807985549325
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
hash: -2100783807985549325
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 1.8.24
|
169
|
+
signing_key:
|
170
|
+
specification_version: 3
|
171
|
+
summary: Kitchen::Driver::Bluebox - A Blue Box block API driver for Test Kitchen
|
172
|
+
test_files: []
|
173
|
+
has_rdoc:
|