knife-digital_ocean 0.7.0 → 2.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -8
- data/CHANGELOG.md +6 -1
- data/Guardfile +4 -5
- data/README.md +98 -117
- data/Rakefile +9 -9
- data/knife-digital_ocean.gemspec +9 -9
- data/lib/chef/knife/digital_ocean_base.rb +12 -24
- data/lib/chef/knife/digital_ocean_droplet_create.rb +102 -101
- data/lib/chef/knife/digital_ocean_droplet_destroy.rb +8 -9
- data/lib/chef/knife/digital_ocean_droplet_list.rb +16 -34
- data/lib/chef/knife/digital_ocean_image_list.rb +18 -31
- data/lib/chef/knife/digital_ocean_region_list.rb +8 -12
- data/lib/chef/knife/digital_ocean_size_list.rb +6 -12
- data/lib/chef/knife/digital_ocean_sshkey_list.rb +8 -11
- data/lib/knife-digital_ocean.rb +1 -1
- data/lib/knife-digital_ocean/version.rb +1 -1
- data/spec/lib/chef/knife/digital_ocean_droplet_create_spec.rb +64 -66
- data/spec/lib/chef/knife/digital_ocean_droplet_destroy_spec.rb +0 -1
- data/spec/lib/chef/knife/digital_ocean_droplet_list_spec.rb +0 -1
- data/spec/lib/chef/knife/digital_ocean_image_list_spec.rb +0 -1
- data/spec/lib/chef/knife/digital_ocean_region_list_spec.rb +0 -1
- data/spec/lib/chef/knife/digital_ocean_size_list_spec.rb +0 -1
- data/spec/lib/chef/knife/digital_ocean_sshkey_list_spec.rb +0 -1
- data/spec/lib/knife-digital_ocean/version_spec.rb +1 -2
- data/spec/spec_helper.rb +2 -4
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1d401db435fc6f27e515c65a389a56a6a5bd264
|
4
|
+
data.tar.gz: 53477ff41e28380766db1df3b496825ebb566fc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e974ec260b01f0dccd8c82d4628b542c511b679e60c99a1d2106b005f494e7acf8a8508754573f1daf6de803cc03a7f2a9fb84776c808e74c622b78de0ff0f83
|
7
|
+
data.tar.gz: 97743644ebfc76074dd3cc18246c17271e2865efd102ccdf09ee80cb0302f9542193b23f26eb4bff49ae4b5c47b8e96763e5f8d012091ef142caf793ca14a091
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
##
|
1
|
+
## 2.0.0 / 2014-11-07
|
2
|
+
|
3
|
+
* Now using Digital Ocean apiv2.
|
4
|
+
* Switched to the droplet_kit gem
|
5
|
+
* knife digital_ocean images list -G now replaced with -P or --public
|
6
|
+
* knife[:digital_ocean_api_key] and knife[:digital_ocean_client_id] replaced with knife[:digitalocean_access_token]
|
2
7
|
|
3
8
|
* [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.7.0...master)
|
4
9
|
|
data/Guardfile
CHANGED
@@ -4,15 +4,15 @@
|
|
4
4
|
guard 'rspec' do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
-
watch('spec/spec_helper.rb') {
|
7
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
8
8
|
|
9
9
|
# Rails example
|
10
10
|
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
11
|
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
12
|
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
-
watch(%r{^spec/support/(.+)\.rb$}) {
|
14
|
-
watch('config/routes.rb') {
|
15
|
-
watch('app/controllers/application_controller.rb') {
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
14
|
+
watch('config/routes.rb') { 'spec/routing' }
|
15
|
+
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
|
16
16
|
|
17
17
|
# Capybara features specs
|
18
18
|
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
@@ -21,4 +21,3 @@ guard 'rspec' do
|
|
21
21
|
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
22
|
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
23
|
end
|
24
|
-
|
data/README.md
CHANGED
@@ -9,8 +9,7 @@
|
|
9
9
|
This is a plugin for [Chef's](http://www.opscode.com/chef/) [knife](http://wiki.opscode.com/display/chef/Knife) tool. It allows you to bootstrap virtual machines with [DigitalOcean.com](https://www.digitalocean.com/) including the initial bootstrapping of chef on that system.
|
10
10
|
You can also use [knife-solo](http://matschaffer.github.com/knife-solo/) for chef bootstrapping or skip it altogether for another solution.
|
11
11
|
|
12
|
-
This knife plugin uses the [
|
13
|
-
|
12
|
+
This knife plugin uses the [droplet_kit](https://github.com/digitalocean/droplet_kit) rubygem.
|
14
13
|
|
15
14
|
## Installation
|
16
15
|
|
@@ -18,7 +17,6 @@ This knife plugin uses the [digital_ocean](https://github.com/rmoriz/digital_oce
|
|
18
17
|
➜ gem install knife-digital_ocean
|
19
18
|
```
|
20
19
|
|
21
|
-
|
22
20
|
## Overview
|
23
21
|
|
24
22
|
This plugin provides the following sub-commands:
|
@@ -50,8 +48,7 @@ This plugin provides the following sub-commands:
|
|
50
48
|
The best way is to put your API-credentials of DigitalOcean in your knife.rb file of choice (e.g. in ```~/.chef/knife.rb```):
|
51
49
|
|
52
50
|
```ruby
|
53
|
-
knife[:
|
54
|
-
knife[:digital_ocean_api_key] = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
|
51
|
+
knife[:digital_ocean_access_token] = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
|
55
52
|
```
|
56
53
|
|
57
54
|
## Usage
|
@@ -69,23 +66,23 @@ use method **A**:
|
|
69
66
|
__Examples__
|
70
67
|
|
71
68
|
```shell
|
72
|
-
➜ knife digital_ocean droplet create --server-name awesome-vm1.
|
73
|
-
--image
|
74
|
-
--location
|
75
|
-
--size
|
69
|
+
➜ knife digital_ocean droplet create --server-name awesome-vm1.vm.io \
|
70
|
+
--image debian-7-0-x64 \
|
71
|
+
--location nyc3 \
|
72
|
+
--size 1gb \
|
76
73
|
--ssh-keys 1234,1235 \
|
77
74
|
--ssh-port 22
|
78
75
|
```
|
79
76
|
|
80
77
|
```shell
|
81
|
-
➜ knife digital_ocean droplet create --server-name awesome-vm2.
|
82
|
-
--image
|
83
|
-
--location
|
84
|
-
--size
|
78
|
+
➜ knife digital_ocean droplet create --server-name awesome-vm2.vm.io \
|
79
|
+
--image debian-7.0-x64 \
|
80
|
+
--location sfo1 \
|
81
|
+
--size 512mb \
|
85
82
|
--ssh-keys 1234,1235 \
|
86
83
|
--bootstrap \
|
87
84
|
--run-list "role[base],role[webserver]" \
|
88
|
-
--secret-file "
|
85
|
+
--secret-file "/home/user/.ssh/secret_file" \
|
89
86
|
--ssh-port 22 \
|
90
87
|
--identity-file "~/.ssh/id_rsa" \
|
91
88
|
--private_networking
|
@@ -95,9 +92,9 @@ __Syntax__
|
|
95
92
|
|
96
93
|
```shell
|
97
94
|
➜ knife digital_ocean droplet create --server-name <FQDN> \
|
98
|
-
--image <IMAGE
|
99
|
-
--location <REGION
|
100
|
-
--size <SIZE
|
95
|
+
--image <IMAGE SLUG> \
|
96
|
+
--location <REGION SLUG> \
|
97
|
+
--size <SIZE SLUG> \
|
101
98
|
--ssh-keys <SSH KEY-ID(s), comma-separated> \
|
102
99
|
--ssh-port <SSH PORT> \
|
103
100
|
--bootstrap \
|
@@ -110,9 +107,9 @@ __Short Syntax__
|
|
110
107
|
|
111
108
|
```shell
|
112
109
|
➜ knife digital_ocean droplet create -N <FQDN> \
|
113
|
-
-I <IMAGE
|
114
|
-
-L <REGION
|
115
|
-
-S <SIZE
|
110
|
+
-I <IMAGE SLUG> \
|
111
|
+
-L <REGION SLUG> \
|
112
|
+
-S <SIZE SLUG> \
|
116
113
|
-K <SSH KEY-ID(s), comma-separated> \
|
117
114
|
-p <SSH PORT> \
|
118
115
|
-B \
|
@@ -129,10 +126,10 @@ Please consult the [knife-solo documentation](http://matschaffer.github.io/knife
|
|
129
126
|
__Example__
|
130
127
|
|
131
128
|
```bash
|
132
|
-
➜ knife digital_ocean droplet create --server-name awesome-vm1.
|
133
|
-
--image
|
134
|
-
--location
|
135
|
-
--size
|
129
|
+
➜ knife digital_ocean droplet create --server-name awesome-vm1.vm.io \
|
130
|
+
--image debian-7-0-x64 \
|
131
|
+
--location lon1 \
|
132
|
+
--size 2gb \
|
136
133
|
--ssh-keys 1234,4567 \
|
137
134
|
--run-list "<RUNLIST>" \
|
138
135
|
--solo
|
@@ -145,10 +142,10 @@ This will just create a droplet and return its IP-address. Nothing else. You can
|
|
145
142
|
__Example__
|
146
143
|
|
147
144
|
```bash
|
148
|
-
➜ knife digital_ocean droplet create --server-name awesome-vm1.
|
149
|
-
--image
|
150
|
-
--location
|
151
|
-
--size
|
145
|
+
➜ knife digital_ocean droplet create --server-name awesome-vm1.vm.io \
|
146
|
+
--image debian-7-0-x64 \
|
147
|
+
--location lon1 \
|
148
|
+
--size 2gb \
|
152
149
|
--ssh-keys 1234,4567
|
153
150
|
```
|
154
151
|
|
@@ -157,8 +154,8 @@ __Example__
|
|
157
154
|
```shell
|
158
155
|
➜ knife digital_ocean droplet list
|
159
156
|
ID Name Size Region IPv4 Image Status
|
160
|
-
12345 app20.ams.nl.
|
161
|
-
23456 awesome-vm1.
|
157
|
+
12345 app20.ams.nl.vm.io 1gb Amsterdam 1 185.14.123.123 25306 (Ubuntu 12.10 x32 Server) active
|
158
|
+
23456 awesome-vm1.vm.io 512mb Amsterdam 1 185.14.124.125 25306 (Ubuntu 12.10 x32 Server) active
|
162
159
|
```
|
163
160
|
|
164
161
|
### Destroy a droplet (server) including all of its data!
|
@@ -172,29 +169,32 @@ OK
|
|
172
169
|
|
173
170
|
```shell
|
174
171
|
➜ knife digital_ocean region list
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
172
|
+
Name Slug
|
173
|
+
New York 1 nyc1
|
174
|
+
Amsterdam 1 ams1
|
175
|
+
San Francisco 1 sfo1
|
176
|
+
New York 2 nyc2
|
177
|
+
Amsterdam 2 ams2
|
178
|
+
Singapore 1 sgp1
|
179
|
+
London 1 lon1
|
180
|
+
New York 3 nyc3
|
181
|
+
Amsterdam 3 ams3
|
182
182
|
```
|
183
183
|
|
184
184
|
### List sizes (instance types)
|
185
185
|
|
186
186
|
```shell
|
187
187
|
➜ knife digital_ocean size list
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
188
|
+
Slug
|
189
|
+
512mb
|
190
|
+
1gb
|
191
|
+
2gb
|
192
|
+
4gb
|
193
|
+
8gb
|
194
|
+
16gb
|
195
|
+
32gb
|
196
|
+
48gb
|
197
|
+
64gb
|
198
198
|
```
|
199
199
|
|
200
200
|
### List images
|
@@ -203,74 +203,68 @@ ID Name
|
|
203
203
|
|
204
204
|
```shell
|
205
205
|
➜ knife digital_ocean image list
|
206
|
-
ID Distribution Name
|
207
|
-
11111 Ubuntu app100.ams.nlxxxxx.net 2013-02-01
|
208
|
-
11112 Ubuntu app100.ams.nlxxxxx.net 2013-02-03
|
209
|
-
11113 Ubuntu init
|
206
|
+
ID Distribution Name
|
207
|
+
11111 Ubuntu app100.ams.nlxxxxx.net 2013-02-01
|
208
|
+
11112 Ubuntu app100.ams.nlxxxxx.net 2013-02-03
|
209
|
+
11113 Ubuntu init
|
210
210
|
```
|
211
211
|
|
212
|
-
|
213
|
-
#### Global images (OS)
|
212
|
+
#### Public images (OS)
|
214
213
|
|
215
214
|
```shell
|
216
|
-
➜ knife digital_ocean image list --
|
217
|
-
ID Distribution Name
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
215
|
+
➜ knife digital_ocean image list --public
|
216
|
+
ID Distribution Name Slug
|
217
|
+
6376601 Ubuntu Ruby on Rails on 14.04 (Nginx + Unicorn) ruby-on-rail
|
218
|
+
6423475 Ubuntu WordPress on 14.04 wordpress
|
219
|
+
6732690 Ubuntu LEMP on 14.04 lemp
|
220
|
+
6732691 Ubuntu LAMP on 14.04 lamp
|
221
|
+
6734341 Ubuntu node-v0.10.32 on 14.04 node
|
222
|
+
6734697 Ubuntu Django on 14.04 django
|
223
|
+
6738037 Ubuntu Dokku v0.2.3 on 14.04 (w/ Docker 1.2.0) dokku
|
224
|
+
6798184 Ubuntu MEAN on 14.04 mean
|
225
|
+
6854006 Ubuntu Drupal 7.32 on 14.04 drupal
|
226
|
+
6884371 Ubuntu Magento 1.9.0.1 on 14.04 magento
|
227
|
+
7284647 Ubuntu Ghost 0.5.3 on 14.04 ghost
|
228
|
+
7354580 Ubuntu Docker 1.3.1 on 14.04 docker
|
229
|
+
7518201 Ubuntu GitLab 7.4.3 CE on 14.04 gitlab
|
230
|
+
7572830 Ubuntu Redmine on 14.04 redmine
|
231
|
+
6370882 Fedora 20 x64 fedora-20-x6
|
232
|
+
6370885 Fedora 20 x32 fedora-20-x3
|
233
|
+
6370968 Fedora 19 x64 fedora-19-x6
|
234
|
+
6370969 Fedora 19 x32 fedora-19-x3
|
235
|
+
6372105 CentOS 6.5 x32 centos-6-5-x
|
236
|
+
6372108 CentOS 6.5 x64 centos-6-5-x
|
237
|
+
6372321 CentOS 5.10 x64 centos-5-8-x
|
238
|
+
6372425 CentOS 5.10 x32 centos-5-8-x
|
239
|
+
6372526 Debian 7.0 x64 debian-7-0-x
|
240
|
+
6372528 Debian 7.0 x32 debian-7-0-x
|
241
|
+
6372581 Debian 6.0 x64 debian-6-0-x
|
242
|
+
6372662 Debian 6.0 x32 debian-6-0-x
|
243
|
+
6374124 Ubuntu 10.04 x64 ubuntu-10-04
|
244
|
+
6374125 Ubuntu 10.04 x32 ubuntu-10-04
|
245
|
+
6374128 Ubuntu 12.04.5 x64 ubuntu-12-04
|
246
|
+
6374130 Ubuntu 12.04.5 x32 ubuntu-12-04
|
247
|
+
6882384 CoreOS 444.5.0 (beta) coreos-beta
|
248
|
+
6886342 CoreOS 444.5.0 (stable) coreos-stabl
|
249
|
+
6918735 Ubuntu 14.04 x32 ubuntu-14-04
|
250
|
+
6918990 Ubuntu 14.04 x64 ubuntu-14-04
|
251
|
+
7053293 CentOS 7.0 x64 centos-7-0-x
|
252
|
+
7111343 Ubuntu 14.10 x64 ubuntu-14-10
|
253
|
+
7111572 Ubuntu 14.10 x32 ubuntu-14-10
|
254
|
+
7556046 CoreOS CoreOS (alpha) 490.0.0 coreos-alpha
|
254
255
|
```
|
255
256
|
|
256
|
-
|
257
257
|
### SSH keys (previously uploaded via DigitalOcean's webfrontend)
|
258
258
|
|
259
259
|
```shell
|
260
260
|
➜ knife digital_ocean sshkey list
|
261
|
-
ID Name
|
262
|
-
1234 Alice
|
263
|
-
1235 Bob
|
264
|
-
1236 Chuck
|
265
|
-
1237 Craig
|
261
|
+
ID Name Fingerprint
|
262
|
+
1234 Alice e0:1a:1b:30:7f:bd:b2:cf:f2:4f:3b:35:3c:87:46:1c
|
263
|
+
1235 Bob b0:ca:40:36:7f:bd:b2:cf:f2:4f:2b:45:3c:28:41:5f
|
264
|
+
1236 Chuck g0:da:3e:15:7f:bd:b2:cf:f2:4f:3a:26:3c:34:52:2b
|
265
|
+
1237 Craig f0:fa:2b:22:7f:bd:b2:cf:f2:4f:4c:18:3c:66:54:1c
|
266
266
|
```
|
267
267
|
|
268
|
-
|
269
|
-
## Commercial Support
|
270
|
-
|
271
|
-
Commercial support is available. Please contact [https://roland.io/](https://roland.io/) or [http://moriz.com/](http://moriz.com/)
|
272
|
-
|
273
|
-
|
274
268
|
## Contributing
|
275
269
|
|
276
270
|
1. Fork it
|
@@ -290,20 +284,7 @@ For more information and a complete list see [the contributor page on GitHub](ht
|
|
290
284
|
|
291
285
|
Apache 2.0 (like Chef itself), see LICENSE.txt file.
|
292
286
|
|
293
|
-
|
294
|
-
## Mobile Application
|
295
|
-
|
296
|
-
Ever wanted to control your DigitalOcean Droplets with your iPhone, iPad or iPod Touch?
|
297
|
-
|
298
|
-
[Get my CloudOcean App!](http://cloudoceanapp.com/)
|
299
|
-
|
300
|
-
[](http://cloudoceanapp.com/)
|
301
|
-
|
302
|
-
|
303
287
|
## Copyright
|
304
288
|
|
305
289
|
Copyright © 2014 [Roland Moriz](https://roland.io), [Moriz GmbH](https://moriz.de/)
|
306
|
-
|
307
|
-
[](http://www.linkedin.com/in/rmoriz)
|
308
|
-
[](https://twitter.com/rmoriz)
|
309
|
-
|
290
|
+
Copyright © 2014 [Greg Fitzgerald](https://github.com/gregf)
|
data/Rakefile
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
#encoding: utf-8
|
1
|
+
# encoding: utf-8
|
2
2
|
require 'rubygems'
|
3
3
|
require 'bundler'
|
4
4
|
Bundler.setup
|
5
5
|
Bundler::GemHelper.install_tasks
|
6
6
|
|
7
7
|
require 'rspec/core/rake_task'
|
8
|
-
desc 'Run RSpec'
|
9
|
-
RSpec::Core::RakeTask.new do |spec|
|
10
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
11
|
-
spec.rspec_opts = ['--color', '--format nested']
|
12
|
-
end
|
13
8
|
|
14
|
-
|
15
|
-
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
require 'rubocop/rake_task'
|
12
|
+
desc 'Run RuboCop on the lib directory'
|
13
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
14
|
+
task.patterns = ['lib/**/*.rb']
|
15
|
+
end
|
16
16
|
|
17
|
-
task :
|
17
|
+
task default: :spec
|
data/knife-digital_ocean.gemspec
CHANGED
@@ -6,23 +6,23 @@ require 'knife-digital_ocean/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = 'knife-digital_ocean'
|
8
8
|
gem.version = Knife::DigitalOcean::VERSION
|
9
|
-
gem.authors = ['Roland Moriz']
|
10
|
-
gem.email = ['roland@moriz.de']
|
11
|
-
gem.description =
|
12
|
-
gem.summary =
|
9
|
+
gem.authors = ['Roland Moriz', 'Greg Fitzgerald']
|
10
|
+
gem.email = ['roland@moriz.de', 'greg@gregf.org']
|
11
|
+
gem.description = "A plugin for chef's knife to manage instances of DigitalOcean servers"
|
12
|
+
gem.summary = "A plugin for chef's knife to manage instances of DigitalOcean servers"
|
13
13
|
gem.homepage = 'https://github.com/rmoriz/knife-digital_ocean'
|
14
14
|
gem.license = 'Apache 2.0'
|
15
15
|
|
16
16
|
gem.add_dependency 'chef', '>= 10.18'
|
17
|
-
gem.add_dependency '
|
18
|
-
gem.add_dependency 'highline'
|
17
|
+
gem.add_dependency 'droplet_kit', '~> 1.1.2'
|
19
18
|
|
20
|
-
gem.add_development_dependency 'rspec', '~>
|
19
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
20
|
+
gem.add_development_dependency 'rubocop', '~> 0.27'
|
21
21
|
gem.add_development_dependency 'rake'
|
22
22
|
gem.add_development_dependency 'knife-solo'
|
23
23
|
|
24
|
-
gem.files = `git ls-files`.split(
|
25
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
24
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
25
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
26
26
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
27
27
|
gem.require_paths = ['lib']
|
28
28
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
5
5
|
# You may obtain a copy of the License at
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# Unless required by applicable law or agreed to in writing, software
|
10
10
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -15,10 +15,9 @@
|
|
15
15
|
class Chef
|
16
16
|
class Knife
|
17
17
|
module DigitalOceanBase
|
18
|
-
|
19
18
|
def self.load_deps
|
20
|
-
require '
|
21
|
-
require '
|
19
|
+
require 'droplet_kit'
|
20
|
+
require 'json'
|
22
21
|
end
|
23
22
|
|
24
23
|
def self.included(includer)
|
@@ -39,30 +38,19 @@ class Chef
|
|
39
38
|
#
|
40
39
|
deps { Chef::Knife::DigitalOceanBase.load_deps }
|
41
40
|
|
42
|
-
option :
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
option :digital_ocean_api_key,
|
49
|
-
:short => '-A API_KEY',
|
50
|
-
:long => '--digital_ocean_api_key API_KEY',
|
51
|
-
:description => 'Your DigitalOcean API_KEY',
|
52
|
-
:proc => Proc.new { |api_key| Chef::Config[:knife][:digital_ocean_api_key] = api_key }
|
41
|
+
option :digital_ocean_access_token,
|
42
|
+
short: '-A ACCESS_TOKEN',
|
43
|
+
long: '--digital_ocean_access_token ACCESS_TOKEN',
|
44
|
+
description: 'Your DigitalOcean ACCESS_TOKEN',
|
45
|
+
proc: proc { |access_token| Chef::Config[:knife][:digital_ocean_access_token] = access_token }
|
53
46
|
end
|
54
47
|
end
|
55
48
|
|
56
|
-
def h
|
57
|
-
@highline ||= HighLine.new
|
58
|
-
end
|
59
|
-
|
60
49
|
def client
|
61
|
-
|
62
|
-
:api_key => Chef::Config[:knife][:digital_ocean_api_key])
|
50
|
+
DropletKit::Client.new(access_token: Chef::Config[:knife][:digital_ocean_access_token])
|
63
51
|
end
|
64
52
|
|
65
|
-
def validate!(keys=[:
|
53
|
+
def validate!(keys = [:digital_ocean_access_token])
|
66
54
|
errors = []
|
67
55
|
|
68
56
|
keys.each do |k|
|
@@ -71,7 +59,7 @@ class Chef
|
|
71
59
|
end
|
72
60
|
end
|
73
61
|
|
74
|
-
if errors.each{|e| ui.error(e)}.any?
|
62
|
+
if errors.each { |e| ui.error(e) }.any?
|
75
63
|
exit 1
|
76
64
|
end
|
77
65
|
end
|