kitchen-joyent 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjUwMmFiODljMGU4YmQ5OTJmMWI1NGJmNDUwZWVkZjI5MTdkYTg4OA==
5
+ data.tar.gz: !binary |-
6
+ Y2UwYTU0MmNkZTJkNzZlZGUwMGJhMzFiNWYyYTgzZTJmMTAxMjZkYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDdkOWVjZjRhYjNmYTVhY2M1ZGU3NmY2MzA5MTA5Y2FjZTY2NzljYmM1Nzgw
10
+ MTIwZTJiNDNhMWEzODNkNmMwZGZhODNiYzBjM2I1MTNmZDYxODRlOTYzMzlh
11
+ MWQzZmVmMTkyYWFjOGYxMTUwZTNmZGFkMzE3YTI4ZjUyMzVmMzM=
12
+ data.tar.gz: !binary |-
13
+ MDYyMjMzZGY1NTYwNGM0MjE0MTNjMzc4MDBjZGJjZjI0YjQ1YjI0MDBkZWRh
14
+ ZGNlYjlmNDUyYjk0ZTllYjVmYjlkNDk1OWYyYmQ1ZGRjNjA1MzUwOTVhNWJj
15
+ MzNhM2E5N2IyMWUzNGEzN2Q0YThmNjc3NmNiOGIyNzJmZGVhNzQ=
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .kitchen
19
+ *.sw?
20
+ *~
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ AlignParameters:
2
+ Enabled: false
3
+
4
+ Encoding:
5
+ Enabled: false
6
+
7
+ LineLength:
8
+ Max: 200
9
+
10
+ Semicolon:
11
+ Enabled: false
12
+
13
+ AccessModifierIndentation:
14
+ Enabled: false
15
+
16
+ MethodLength:
17
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ bundler_args: --without development integration
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ before_install:
7
+ - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
8
+ script:
9
+ - bundle exec rubocop
10
+ - bundle exec rspec --color --format progress
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.1.0 / 2013-05-12
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kitchen-joyent.gemspec
4
+ gemspec
5
+
data/LICENSE.txt ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Sean OMeara (<someara@gmail.com>)
2
+
3
+ Copyright (c) 2013 Sean OMeara
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,218 @@
1
+ # Kitchen::Joyent
2
+
3
+ A Joyent API driver for Test Kitchen 1.0!
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'kitchen-joyent'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install kitchen-joyent
18
+
19
+ ## Usage
20
+
21
+ Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
22
+
23
+ driver_plugin: joyent
24
+ driver_config:
25
+ joyent_username: <%= ENV['SDC_CLI_ACCOUNT'] %>
26
+ joyent_keyfile: <%= ENV['SDC_CLI_IDENTITY'] %>
27
+ joyent_keyname: <%= ENV['SDC_CLI_KEY_ID'] %>
28
+ joyent_url: <%= ENV['SDC_CLI_URL'] %>
29
+ require_chef_omnibus: latest (if you'll be using Chef)
30
+
31
+ Until we get SmartOS, OmniOS, and FreeBSD into Omnitruck, you'll need
32
+ to override the Chef bootstrap script.
33
+ chef_omnibus_url: http://path.to.an.script.sh
34
+
35
+ # Example .kitchen.yml
36
+
37
+ ```
38
+ ---
39
+ driver_plugin: joyent
40
+ driver_config:
41
+ joyent_username: <%= ENV['SDC_CLI_ACCOUNT'] %>
42
+ joyent_keyfile: <%= ENV['SDC_CLI_IDENTITY'] %>
43
+ joyent_keyname: <%= ENV['SDC_CLI_KEY_ID'] %>
44
+ joyent_url: <%= ENV['SDC_CLI_URL'] %>
45
+ require_chef_omnibus: true
46
+ chef_omnibus_url:
47
+ http://raw.github.com/someara/kitchen-joyent/master/scripts/install-smartos.sh
48
+ sudo: false
49
+
50
+ platforms:
51
+ - name: smartos-1330
52
+ driver_config:
53
+ joyent_image_id: 87b9f4ac-5385-11e3-a304-fb868b82fe10
54
+ joyent_flavor_id: g3-standard-4-smartos
55
+
56
+ - name: freebsd-9
57
+ driver_config:
58
+ joyent_image_id: df8d2ee6-d87f-11e2-b257-2f02c6f6ce80
59
+ joyent_flavor_id: g3-standard-4-kvm
60
+
61
+ - name: centos-6
62
+ driver_config:
63
+ joyent_image_id: 325dbc5e-2b90-11e3-8a3e-bfdcb1582a8d
64
+ joyent_flavor_id: g3-standard-4-kvm
65
+
66
+ suites:
67
+ - name: default
68
+ run_list: ["recipe[unix-tester]"]
69
+ attributes: {}
70
+ ```
71
+
72
+ ### List of Images
73
+ ```
74
+ $ knife joyent image list
75
+ ID Name Version OS
76
+ Type
77
+ f669428c-a939-11e2-a485-b790efc0f0c1 base 13.1.0 smartos smartmachine
78
+ e3364212-05c0-11e3-9576-3f3ee9e951a7 base 13.2.0 smartos smartmachine
79
+ 60ed3a3e-92c7-11e2-ba4a-9b6d5feaa0c4 base 1.9.1 smartos smartmachine
80
+ b83f8276-1fdd-11e3-989b-4bddb088a8a0 base 13.2.1 smartos smartmachine
81
+ 84cb7edc-3f22-11e2-8a2a-3f2a7b148699 base 1.8.4 smartos smartmachine
82
+ 753ceee6-5372-11e3-8f4e-f79c1154e596 base 13.3.0 smartos smartmachine
83
+ 55330ab4-066f-11e2-bd0f-434f2462fada base 1.8.1 smartos smartmachine
84
+ 60a3b1fa-0674-11e2-abf5-cb82934a8e24 base64 1.8.1 smartos smartmachine
85
+ 87b9f4ac-5385-11e3-a304-fb868b82fe10 base64 13.3.0 smartos smartmachine
86
+ 0084dad6-05c1-11e3-9476-8f8320925eea base64 13.2.0 smartos smartmachine
87
+ fdea06b0-3f24-11e2-ac50-0b645575ce9d base64 1.8.4 smartos smartmachine
88
+ 17c98640-1fdb-11e3-bf51-3708ce78e75a base64 13.2.1 smartos smartmachine
89
+ cf7e2f40-9276-11e2-af9a-0bad2233fb0b base64 1.9.1 smartos smartmachine
90
+ 9eac5c0c-a941-11e2-a7dc-57a6b041988f base64 13.1.0 smartos smartmachine
91
+ bae3f528-e01f-11e2-b2cb-1360087a7d5f cassandra 13.1.0 smartos smartmachine
92
+ 2539f6de-0b5a-11e2-b647-fb08c3503fb2 centos-5.7 1.3.0 linux virtualmachine
93
+ e4cd7b9e-4330-11e1-81cf-3bb50a972bda centos-6 1.0.1 linux virtualmachine
94
+ 30e9e4c8-bbf2-11e2-ac3b-3b598ee13393 centos-6 2.4.2 linux virtualmachine
95
+ 8700b668-0da4-11e2-bde4-17221283a2f4 centos-6 1.3.0 linux virtualmachine
96
+ 325dbc5e-2b90-11e3-8a3e-bfdcb1582a8d centos-6 2.5.0 linux virtualmachine
97
+ 87c556ac-ab9d-11e2-914d-07682fcab47d centos-6 2.4.1 linux virtualmachine
98
+ 46ecf60e-52c8-11e2-b212-9b51fc749547 debian-6.0.6 2.3.1 linux virtualmachine
99
+ 94384a12-bbeb-11e2-aec2-2bfa9742484b debian-6.0.7 2.4.2 linux virtualmachine
100
+ 014e2254-a853-11e2-81c9-b318c31fa17a debian-6.0.7 2.4.1 linux virtualmachine
101
+ e6ac6784-44b3-11e1-8555-87c3dd87aafe debian-6.03 1.0.0 linux virtualmachine
102
+ e42f8c84-bbea-11e2-b920-078fab2aab1f fedora 2.4.2 linux virtualmachine
103
+ df8d2ee6-d87f-11e2-b257-2f02c6f6ce80 freebsd 1.0.0 bsd virtualmachine
104
+ 274bc2bc-d919-11e2-b797-83245409fbeb hadoop 13.1.0 smartos smartmachine
105
+ 48489174-e351-11e2-88c0-a31eb2b342ee java 13.1.0 smartos smartmachine
106
+ 2c6b0348-d8f6-11e2-91f4-ef498b553611 manta-build 13.1.0 smartos smartmachine
107
+ d2409672-29f3-11e3-ba86-6f782523cb41 mongodb 13.2.1 smartos smartmachine
108
+ ec5defa8-16fe-11e3-948e-8f59b3488902 mongodb 13.2.0 smartos smartmachine
109
+ f953e97e-4991-11e1-9ea4-27c6e7e8afda nodejs 1.3.3 smartos smartmachine
110
+ 133263be-3c2c-11e3-8d3a-a30c43ae58fd nodejs 13.2.2 smartos smartmachine
111
+ 1fc068b0-13b0-11e2-9f4e-2f3f6a96d9bc nodejs 1.4.0 smartos smartmachine
112
+ beb2dbd4-b26f-11e2-8ad4-935c80092aa6 nodejs 13.1.0 smartos smartmachine
113
+ ffed3d9e-2c2f-11e3-9a12-bf5267821b0b nodejs 13.2.1 smartos smartmachine
114
+ dc1a8b5e-043c-11e2-9d94-0f3fcb2b0c6d percona 1.6.0 smartos smartmachine
115
+ 3882b5da-b0e8-11e2-b3a9-dbcf26c3e051 percona 13.1.0 smartos smartmachine
116
+ fb6e7820-60ee-11e3-93b6-7f34ea3f2616 percona 13.3.0 smartos smartmachine
117
+ 1567edb0-b33e-11e2-a0d2-bf73e2825ffe riak 13.1.0 smartos smartmachine
118
+ 01b2c898-945f-11e1-a523-af1afbe22822 smartos 1.6.3 smartos smartmachine
119
+ 489754f2-5e01-11e1-8ff8-f770c2116b0d smartos 1.5.4 smartos smartmachine
120
+ f9e4be48-9466-11e1-bc41-9f993f5dff36 smartos64 1.6.3 smartos smartmachine
121
+ 31bc4dbe-5e06-11e1-907c-5bed6b255fd1 smartos64 1.5.4 smartos smartmachine
122
+ 56a0655c-3cc6-11e3-9c79-5701599fdf05 standard 13.2.3 smartos smartmachine
123
+ dac2ad6e-2aa5-11e3-885f-8fd408fc6a82 standard 13.2.1 smartos smartmachine
124
+ 34509f68-1ae7-11e3-b816-d3edf71c7840 standard 13.2.0 smartos smartmachine
125
+ 3390ca7c-f2e7-11e1-8818-c36e0b12e58b standard 1.0.7 smartos smartmachine
126
+ 399775e4-163e-11e3-8d42-7b14b732ae17 standard64 13.2.0 smartos smartmachine
127
+ a0f8cf30-f2ea-11e1-8a51-5793736be67c standard64 1.0.7 smartos smartmachine
128
+ b779b49a-29e4-11e3-9b1d-0b0b41ccdcad standard64 13.2.1 smartos smartmachine
129
+ 610e04c4-3cc4-11e3-9867-df64b21b66fe standard64 13.2.3 smartos smartmachine
130
+ 3cd9ef64-1fa5-11e3-be45-1fa28ec74f4a stm-1000H 13.2.0 smartos smartmachine
131
+ efe2c3e8-1fb8-11e3-b4c4-eb64d18f0b71 stm-1000M 13.2.0 smartos smartmachine
132
+ 6e99eff4-1fb9-11e3-9d00-3b6b25be1e62 stm-1000M-SAF 13.2.0 smartos smartmachine
133
+ ef905526-1fb9-11e3-a095-576400e02b54 stm-2000L 13.2.0 smartos smartmachine
134
+ 6bf3c40e-1fba-11e3-9847-4f44ccd9abe9 stm-2000L-SAF 13.2.0 smartos smartmachine
135
+ 0bcda78c-2066-11e3-8f62-d7edf9742dbd stm-2000L-SAF-STX 13.2.0 smartos smartmachine
136
+ 36f3b80c-2066-11e3-9215-5ffe647b58f0 stm-2000L-STX 13.2.0 smartos smartmachine
137
+ 08c63ac6-2067-11e3-abea-a7c7c71e8f15 stm-2000M-SAF-STX 13.2.0 smartos smartmachine
138
+ 8b503466-2066-11e3-b5c8-c7e50b85619c stm-2000M-STX 13.2.0 smartos smartmachine
139
+ e96103b6-1fba-11e3-8dba-3b2f9d336fa1 stm-4000L 13.2.0 smartos smartmachine
140
+ 67e5fc46-1fbb-11e3-b1c7-274da29ae2f6 stm-500L-10 13.2.0 smartos smartmachine
141
+ e4093946-1fbb-11e3-8b61-bb9e496e0da4 stm-500M-200 13.2.0 smartos smartmachine
142
+ 4b4c141e-1fb4-11e3-a10e-6f99cfdf8806 stm-developer 13.2.0 smartos smartmachine
143
+ 71101322-43a5-11e1-8f01-cf2a3031a7f4 ubuntu-10.04 1.0.1 linux virtualmachine
144
+ 3162a91e-8b5d-11e2-a78f-9780813f9142 ubuntu-12.04 2.4.0 linux virtualmachine
145
+ da144ada-a558-11e2-8762-538b60994628 ubuntu-12.04 2.4.1 linux virtualmachine
146
+ 64e1b2ee-52c8-11e2-bedd-7f919cc63ab9 ubuntu-12.04 2.3.1 linux virtualmachine
147
+ d2ba0f30-bbe8-11e2-a9a2-6bc116856d85 ubuntu-12.04 2.4.2a linux virtualmachine
148
+ 13328c9a-9173-11e2-a9a5-2ff43d306c21 ws2008ent-r2-sp1 2.0.2 windows virtualmachine
149
+ 5f101d16-90ac-11e2-b9c2-877979ff6041 ws2008std-r2-sp1 2.0.2 windows virtualmachine
150
+ 95f6c9a6-a2bd-11e2-b753-dbf2651bf890 ws2012std 1.0.1 windows virtualmachine
151
+ ```
152
+
153
+ ### List of Flavors (Sizes)
154
+ ```
155
+ $ knife joyent flavor list
156
+ Name RAM Disk Swap Price $/Hr
157
+ g3-standard-0.25-kvm 0.25 GB 16 GB 0 GB
158
+ g3-standard-0.25-smartos 0.25 GB 16 GB 0 GB
159
+ g3-standard-0.5-smartos 0.50 GB 16 GB 1 GB
160
+ Extra Small 512 MB 0.50 GB 15 GB 1 GB
161
+ g3-standard-0.5-kvm 0.50 GB 16 GB 1 GB
162
+ g3-standard-0.625-kvm 0.62 GB 20 GB 1 GB $0.020
163
+ g3-standard-0.625-smartos 0.62 GB 20 GB 1 GB $0.020
164
+ g3-standard-1-kvm 1.00 GB 33 GB 2 GB
165
+ g3-standard-1-smartos 1.00 GB 33 GB 2 GB
166
+ Small 1GB 1.00 GB 30 GB 2 GB
167
+ g3-standard-1.75-kvm 1.75 GB 56 GB 4 GB $0.056
168
+ g3-standard-1.75-smartos 1.75 GB 56 GB 4 GB $0.056
169
+ g3-highcpu-1.75-smartos 1.75 GB 75 GB 4 GB $0.127
170
+ g3-highcpu-1.75-kvm 1.75 GB 75 GB 4 GB $0.127
171
+ g3-standard-2-kvm 2.00 GB 66 GB 4 GB
172
+ g3-standard-2-smartos 2.00 GB 66 GB 4 GB
173
+ Medium 2GB 2.00 GB 60 GB 4 GB
174
+ g3-standard-3.75-kvm 3.75 GB 123 GB 8 GB $0.120
175
+ g3-standard-3.75-smartos 3.75 GB 123 GB 8 GB $0.120
176
+ g3-standard-4-kvm 4.00 GB 131 GB 8 GB
177
+ g3-highcpu-4-kvm 4.00 GB 150 GB 8 GB
178
+ g3-standard-4-smartos 4.00 GB 131 GB 8 GB
179
+ Medium 4GB 4.00 GB 120 GB 8 GB
180
+ g3-highcpu-4-smartos 4.00 GB 150 GB 8 GB
181
+ g3-highcpu-7-kvm 7.00 GB 263 GB 14 GB $0.508
182
+ g3-highcpu-7-smartos 7.00 GB 263 GB 14 GB $0.508
183
+ g3-standard-7.5-smartos 7.50 GB 738 GB 15 GB $0.240
184
+ g3-standard-7.5-kvm 7.50 GB 738 GB 15 GB $0.240
185
+ g3-highcpu-8-smartos 8.00 GB 300 GB 14 GB
186
+ g3-standard-8-kvm 8.00 GB 789 GB 16 GB
187
+ Large 8GB 8.00 GB 240 GB 16 GB
188
+ g3-standard-8-smartos 8.00 GB 789 GB 16 GB
189
+ g3-highcpu-8-kvm 8.00 GB 300 GB 14 GB
190
+ g3-standard-15-smartos 15.00 GB 1467 GB 30 GB $0.480
191
+ g3-standard-15-kvm 15.00 GB 1467 GB 30 GB $0.480
192
+ Large 16GB 16.00 GB 480 GB 32 GB
193
+ g3-highcpu-16-smartos 16.00 GB 600 GB 32 GB $1.160
194
+ g3-highmemory-17.125-smartos 17.12 GB 420 GB 34 GB $0.409
195
+ g3-highmemory-17.125-kvm 17.12 GB 420 GB 34 GB $0.409
196
+ g3-highcpu-24-smartos 24.00 GB 900 GB 48 GB $1.739
197
+ g3-standard-30-smartos 30.00 GB 1683 GB 60 GB $0.960
198
+ g3-standard-30-kvm 30.00 GB 1683 GB 60 GB $0.960
199
+ XL 32GB 32.00 GB 760 GB 64 GB
200
+ g3-standard-32-smartos 32.00 GB 1683 GB 64 GB
201
+ g3-highmemory-34.25-kvm 34.25 GB 843 GB 68 GB $0.817
202
+ g3-highmemory-34.25-smartos 34.25 GB 843 GB 68 GB $0.817
203
+ g3-standard-48-smartos 48.00 GB 1683 GB 96 GB $1.536
204
+ XXL 48GB 48.00 GB 1024 GB 96 GB
205
+ g3-standard-64-smartos 64.00 GB 2100 GB 128 GB $2.048
206
+ XXXL 64GB 64.00 GB 1536 GB 128 GB
207
+ g3-highmemory-68.375-smartos 68.38 GB 1122 GB 137 GB $1.630
208
+ g3-highmemory-68.375-kvm 68.38 GB 1122 GB 137 GB $1.630
209
+ g3-standard-80-smartos 80.00 GB 2625 GB 160 GB $2.560
210
+ ```
211
+
212
+ ## Contributing
213
+
214
+ 1. Fork it
215
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
216
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
217
+ 4. Push to the branch (`git push origin my-new-feature`)
218
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
3
+ require 'cane/rake_task'
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc 'Run Cane to check quality metrics'
7
+ Cane::RakeTask.new
8
+
9
+ desc 'Run RuboCop on the lib directory'
10
+ Rubocop::RakeTask.new(:rubocop) do |task|
11
+ task.patterns = ['lib/**/*.rb']
12
+ # don't abort rake on failure
13
+ task.fail_on_error = false
14
+ end
15
+
16
+ desc 'Display LOC stats'
17
+ task :loc do
18
+ puts "\n## LOC Stats"
19
+ sh 'countloc -r lib/kitchen'
20
+ end
21
+
22
+ desc 'Run RSpec unit tests'
23
+ RSpec::Core::RakeTask.new(:spec)
24
+
25
+ task :default => [:cane, :rubocop, :loc, :spec]
26
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/driver/joyent_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-joyent'
8
+ spec.version = Kitchen::Driver::JOYENT_VERSION
9
+ spec.authors = ['Sean OMeara']
10
+ spec.email = ['someara@gmail.com']
11
+ spec.description = %q{A Test Kitchen Joyent driver}
12
+ spec.summary = spec.description
13
+ spec.homepage = 'https://github.com/someara/kitchen-joyent'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'test-kitchen', '~> 1.0'
22
+ spec.add_dependency 'fog'
23
+
24
+ spec.add_development_dependency 'rubocop'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'cane'
27
+ spec.add_development_dependency 'countloc'
28
+ spec.add_development_dependency 'rspec'
29
+ end
@@ -0,0 +1,101 @@
1
+ # Encoding: utf-8
2
+ #
3
+ # Author:: Sean OMeara (<someara@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Sean OMeara
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
+ require 'kitchen'
22
+ require 'etc'
23
+ require 'socket'
24
+
25
+ module Kitchen
26
+ module Driver
27
+ # Joyent driver for Kitchen.
28
+ #
29
+ # @author Sean OMerara <someara@gmail.com>
30
+ class Joyent < Kitchen::Driver::SSHBase
31
+ default_config :joyent_url, 'https://us-sw-1.api.joyentcloud.com'
32
+ default_config :joyent_image_id, '87b9f4ac-5385-11e3-a304-fb868b82fe10'
33
+ default_config :joyent_flavor_id, 'g3-standard-4-smartos'
34
+ default_config :username, 'root'
35
+ default_config :port, '22'
36
+ default_config :sudo, false
37
+
38
+ def create(state)
39
+ server = create_server
40
+ state[:server_id] = server.id
41
+ info("Joyent <#{state[:server_id]}> created.")
42
+ server.wait_for { print '.'; ready? }
43
+
44
+ print '(server ready)'
45
+ state[:hostname] = server.public_ip_address
46
+ wait_for_sshd(state[:hostname])
47
+ print "(ssh ready)\n"
48
+ debug("joyent:create #{state[:hostname]}")
49
+ rescue Fog::Errors::Error, Excon::Errors::Error => ex
50
+ raise ActionFailed, ex.message
51
+ end
52
+
53
+ def destroy(state)
54
+ return if state[:server_id].nil?
55
+
56
+ server = compute.servers.get(state[:server_id])
57
+ server.destroy unless server.nil?
58
+ info("Joyent instance <#{state[:server_id]}> destroyed.")
59
+ state.delete(:server_id)
60
+ state.delete(:hostname)
61
+ end
62
+
63
+ private
64
+
65
+ def compute
66
+ debug_compute_config
67
+
68
+ server_def = {
69
+ provider: :joyent,
70
+ joyent_username: config[:joyent_username],
71
+ joyent_keyname: config[:joyent_keyname],
72
+ joyent_keyfile: config[:joyent_keyfile],
73
+ }
74
+
75
+ Fog::Compute.new(server_def)
76
+ end
77
+
78
+ def create_server
79
+ debug_server_config
80
+
81
+ compute.servers.create(
82
+ joyent_url: config[:joyent_url],
83
+ dataset: config[:joyent_image_id],
84
+ package: config[:joyent_flavor_id],
85
+ )
86
+ end
87
+
88
+ def debug_server_config
89
+ debug("joyent: joyent_url #{config[:joyent_url]}")
90
+ debug("joyent: image_id #{config[:joyent_image_id]}")
91
+ debug("joyent: flavor_id #{config[:joyent_flavor_id]}")
92
+ end
93
+
94
+ def debug_compute_config
95
+ debug("joyent_username #{config[:joyent_username]}")
96
+ debug("joyent_keyname #{config[:joyent_keyname]}")
97
+ debug("joyent_keyfile #{config[:joyent_keyfile]}")
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Sean Omeara (<someara@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Greg Fitzgerald
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
+ # Kitchen
21
+ module Driver
22
+ # Version string for Joyent Kitchen provider
23
+ JOYENT_VERSION = '0.1.0'
24
+ end
25
+ end
@@ -0,0 +1,4 @@
1
+ pkgin -y install ruby193
2
+ pkgin -y install gcc47
3
+ pkgin -y install gmake
4
+ gem install chef --version 11.8.2 --no-ri --no-rdoc
@@ -0,0 +1,247 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Sean OMeara (<someara@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Sean OMeara
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 'logger'
20
+ require 'stringio'
21
+ require 'rspec'
22
+ require 'kitchen'
23
+ require_relative '../../spec_helper'
24
+
25
+ describe Kitchen::Driver::Joyent do
26
+ let(:logged_output) { StringIO.new }
27
+ let(:logger) { Logger.new(logged_output) }
28
+ let(:config) { Hash.new }
29
+ let(:state) { Hash.new }
30
+
31
+ let(:instance) do
32
+ double(name: 'honeybadger', logger: logger, to_str: 'instance')
33
+ end
34
+
35
+ let(:driver) do
36
+ d = Kitchen::Driver::Joyent.new(config)
37
+ d.instance = instance
38
+ d
39
+ end
40
+
41
+ describe '#initialize'do
42
+ context 'default options' do
43
+
44
+ it 'defaults to us-sw-1' do
45
+ expect(driver[:joyent_url]).to eq('https://us-sw-1.api.joyentcloud.com')
46
+ end
47
+
48
+ it 'defaults to a base64 13.3.0' do
49
+ expect(driver[:joyent_image_id]).to eq('87b9f4ac-5385-11e3-a304-fb868b82fe10')
50
+ end
51
+
52
+ it 'defaults to joyent_flavor_id g3-standard-4-smartos' do
53
+ expect(driver[:joyent_flavor_id]).to eq('g3-standard-4-smartos')
54
+ end
55
+
56
+ it 'defaults to SSH with root user on port 22' do
57
+ expect(driver[:username]).to eq('root')
58
+ expect(driver[:port]).to eq('22')
59
+ end
60
+
61
+ it 'does not use sudo' do
62
+ expect(driver[:sudo]).to eq(false)
63
+ end
64
+
65
+ end
66
+
67
+ context 'overridden options' do
68
+ let(:config) do
69
+ {
70
+ joyent_url: 'https://internal.sdc.installation.biz',
71
+ joyent_image_id: 'df8d2ee6-d87f-11e2-b257-2f02c6f6ce80',
72
+ joyent_flavor_id: 'g3-standard-4-kvm',
73
+ username: 'r00t',
74
+ port: '2222'
75
+ }
76
+ end
77
+
78
+ it 'uses all the overridden options' do
79
+ drv = driver
80
+ config.each do |k, v|
81
+ expect(drv[k]).to eq(v)
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ describe '#create' do
88
+ let(:server) do
89
+ double(
90
+ 'id' => 'test123', 'wait_for' => true,
91
+ 'public_ip_address' => '1.2.3.4'
92
+ )
93
+ end
94
+ let(:driver) do
95
+ d = Kitchen::Driver::Joyent.new(config)
96
+ d.instance = instance
97
+ d.stub(:create_server).and_return(server)
98
+ d.stub(:wait_for_sshd).with('1.2.3.4').and_return(true)
99
+ d
100
+ end
101
+
102
+ context 'when only supplying username, keyname, and keyfile' do
103
+ let(:config) do
104
+ {
105
+ joyent_username: 'robocop',
106
+ joyent_keyname: 'pewpewpew',
107
+ joyent_keyfile: '/path/to/key'
108
+ }
109
+ end
110
+
111
+ it 'gets a proper server ID' do
112
+ driver.create(state)
113
+ expect(state[:server_id]).to eq('test123')
114
+ end
115
+
116
+ it 'gets a proper hostname (IP)' do
117
+ driver.create(state)
118
+ expect(state[:hostname]).to eq('1.2.3.4')
119
+ end
120
+ end
121
+ end
122
+
123
+ describe '#destroy' do
124
+ let(:server_id) { '12345' }
125
+ let(:hostname) { 'example.com' }
126
+ let(:state) { { server_id: server_id, hostname: hostname } }
127
+ let(:server) { double(nil?: false, destroy: true) }
128
+ let(:servers) { double(get: server) }
129
+ let(:compute) { double(servers: servers) }
130
+
131
+ let(:driver) do
132
+ d = Kitchen::Driver::Joyent.new(config)
133
+ d.instance = instance
134
+ d.stub(:compute).and_return(compute)
135
+ d
136
+ end
137
+
138
+ context 'a live server that needs to be destroyed' do
139
+ it 'destroys the server' do
140
+ state.should_receive(:delete).with(:server_id)
141
+ state.should_receive(:delete).with(:hostname)
142
+ driver.destroy(state)
143
+ end
144
+ end
145
+
146
+ context 'no server ID present' do
147
+ let(:state) { Hash.new }
148
+
149
+ it 'does nothing' do
150
+ driver.stub(:compute)
151
+ driver.should_not_receive(:compute)
152
+ state.should_not_receive(:delete)
153
+ driver.destroy(state)
154
+ end
155
+ end
156
+
157
+ context 'a server that was already destroyed' do
158
+ let(:servers) do
159
+ s = double('servers')
160
+ s.stub(:get).with('12345').and_return(nil)
161
+ s
162
+ end
163
+ let(:compute) { double(servers: servers) }
164
+ let(:driver) do
165
+ d = Kitchen::Driver::Joyent.new(config)
166
+ d.instance = instance
167
+ d.stub(:compute).and_return(compute)
168
+ d
169
+ end
170
+
171
+ it 'does not try to destroy the server again' do
172
+ allow_message_expectations_on_nil
173
+ driver.destroy(state)
174
+ end
175
+ end
176
+ end
177
+
178
+ describe '#compute' do
179
+ let(:config) do
180
+ {
181
+ joyent_username: 'honeybadger',
182
+ joyent_keyname: 'dontcare',
183
+ joyent_keyfile: 'dat.pem'
184
+ }
185
+ end
186
+
187
+ context 'all requirements provided' do
188
+ it 'creates a new compute connection' do
189
+ Fog::Compute.stub(:new) { |arg| arg }
190
+ res = config.merge(provider: :joyent)
191
+ expect(driver.send(:compute)).to eq(res)
192
+ end
193
+ end
194
+
195
+ context 'no joyent_username provided' do
196
+ let(:config) { { joyent_username: 'honeybadger' } }
197
+
198
+ it 'raises an error' do
199
+ expect { driver.send(:compute) }.to raise_error(ArgumentError)
200
+ end
201
+ end
202
+
203
+ context 'no joyent_keyname provided' do
204
+ let(:config) { { joyent_keyname: 'dontcare' } }
205
+
206
+ it 'raises an error' do
207
+ expect { driver.send(:compute) }.to raise_error(ArgumentError)
208
+ end
209
+ end
210
+
211
+ context 'no joyent_keyfile provided' do
212
+ let(:config) { { joyent_keyfile: '/path/to/dat.pem' } }
213
+
214
+ it 'raises an error' do
215
+ expect { driver.send(:compute) }.to raise_error(ArgumentError)
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ describe '#create_server' do
222
+ let(:config) do
223
+ {
224
+ joyent_url: 'https://us-sw-1.api.joyentcloud.com',
225
+ dataset: '87b9f4ac-5385-11e3-a304-fb868b82fe10',
226
+ package: 'g3-standard-4-smartos',
227
+ }
228
+ end
229
+ before(:each) { @config = config.dup }
230
+ let(:servers) do
231
+ s = double('servers')
232
+ s.stub(:create) { |arg| arg }
233
+ s
234
+ end
235
+ let(:compute) { double(servers: servers) }
236
+ let(:driver) do
237
+ d = Kitchen::Driver::Joyent.new(config)
238
+ d.instance = instance
239
+ d.stub(:compute).and_return(compute)
240
+ d
241
+ end
242
+
243
+ it 'creates the server using a compute connection' do
244
+ expect(driver.send(:create_server)).to eq(@config)
245
+ end
246
+ end
247
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Sean OMeara (<someara@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Sean OMeara
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 'rspec'
20
+ require 'rspec/autorun'
21
+ require_relative '../lib/kitchen/driver/joyent'
22
+
23
+ RSpec.configure do |config|
24
+ config.tty = true
25
+ config.color = true
26
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-joyent
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean OMeara
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-kitchen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fog
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cane
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: countloc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A Test Kitchen Joyent driver
112
+ email:
113
+ - someara@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rubocop.yml
120
+ - .travis.yml
121
+ - CHANGELOG.md
122
+ - Gemfile
123
+ - LICENSE.txt
124
+ - README.md
125
+ - Rakefile
126
+ - kitchen-joyent.gemspec
127
+ - lib/kitchen/driver/joyent.rb
128
+ - lib/kitchen/driver/joyent_version.rb
129
+ - scripts/install-smartos.sh
130
+ - spec/kitchen/driver/joyent_spec.rb
131
+ - spec/spec_helper.rb
132
+ homepage: https://github.com/someara/kitchen-joyent
133
+ licenses:
134
+ - Apache 2.0
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.1.8
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: A Test Kitchen Joyent driver
156
+ test_files:
157
+ - spec/kitchen/driver/joyent_spec.rb
158
+ - spec/spec_helper.rb