knife-digital_ocean 2.4.0 → 2.4.1
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 -0
- data/CHANGELOG.md +4 -0
- data/README.md +7 -6
- data/lib/chef/knife/digital_ocean_base.rb +2 -4
- data/lib/chef/knife/digital_ocean_domain_create.rb +1 -1
- data/lib/chef/knife/digital_ocean_domain_destroy.rb +1 -1
- data/lib/chef/knife/digital_ocean_domain_record_create.rb +1 -1
- data/lib/chef/knife/digital_ocean_domain_record_destroy.rb +1 -1
- data/lib/chef/knife/digital_ocean_domain_record_edit.rb +1 -1
- data/lib/chef/knife/digital_ocean_droplet_create.rb +6 -6
- data/lib/chef/knife/digital_ocean_droplet_destroy.rb +11 -18
- data/lib/chef/knife/digital_ocean_droplet_power.rb +2 -2
- data/lib/chef/knife/digital_ocean_droplet_powercycle.rb +2 -2
- data/lib/chef/knife/digital_ocean_droplet_reboot.rb +2 -2
- data/lib/chef/knife/digital_ocean_droplet_rebuild.rb +2 -2
- data/lib/chef/knife/digital_ocean_droplet_rename.rb +2 -2
- data/lib/chef/knife/digital_ocean_droplet_resize.rb +2 -2
- data/lib/chef/knife/digital_ocean_droplet_snapshot.rb +2 -2
- data/lib/chef/knife/digital_ocean_image_destroy.rb +1 -1
- data/lib/chef/knife/digital_ocean_image_transfer.rb +3 -3
- data/lib/chef/knife/digital_ocean_sshkey_create.rb +1 -1
- data/lib/chef/knife/digital_ocean_sshkey_destroy.rb +1 -1
- data/lib/knife-digital_ocean/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd36cab124f582b57336810c5ba2a1a26afc5fa1
|
|
4
|
+
data.tar.gz: c7706cae3df44fa1fdd30d9cfb500f321fc5f511
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c365439ec60572e7b4f88e9934a9e09c5ba9999cddacb6cfa040102e75d01361ef811af3fb486652a516841829239ea77d3d4dba98509b58aec471e73f5b8f5c
|
|
7
|
+
data.tar.gz: 3e5b2ce87d2025a41ffe64db10a05118ff283ae8475420b05d51374291da4f346066a42d19a7c6b60d07ae450c4e047df2726e39047355308964699867b9be24
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -297,7 +297,7 @@ OK
|
|
|
297
297
|
OK
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
####
|
|
300
|
+
#### Create a droplet from a Snapshot
|
|
301
301
|
```shell
|
|
302
302
|
➜ knife digital_ocean snapshot -I 1824315 -N 'my-super-awesome-snapshot'
|
|
303
303
|
OK
|
|
@@ -308,15 +308,16 @@ OK
|
|
|
308
308
|
```shell
|
|
309
309
|
➜ knife digital_ocean region list
|
|
310
310
|
Name Slug
|
|
311
|
-
New York 1 nyc1
|
|
312
311
|
Amsterdam 1 ams1
|
|
313
|
-
San Francisco 1 sfo1
|
|
314
|
-
New York 2 nyc2
|
|
315
312
|
Amsterdam 2 ams2
|
|
316
|
-
|
|
313
|
+
Amsterdam 3 ams3
|
|
314
|
+
Frankfurt 1 fra1
|
|
317
315
|
London 1 lon1
|
|
316
|
+
New York 1 nyc1
|
|
317
|
+
New York 2 nyc2
|
|
318
318
|
New York 3 nyc3
|
|
319
|
-
|
|
319
|
+
San Francisco 1 sfo1
|
|
320
|
+
Singapore 1 sgp1
|
|
320
321
|
```
|
|
321
322
|
|
|
322
323
|
### List sizes (instance types)
|
|
@@ -59,9 +59,7 @@ class Chef
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
if errors.each { |e| ui.error(e) }.any?
|
|
63
|
-
exit 1
|
|
64
|
-
end
|
|
62
|
+
exit 1 if errors.each { |e| ui.error(e) }.any?
|
|
65
63
|
end
|
|
66
64
|
|
|
67
65
|
def locate_config_value(key)
|
|
@@ -71,7 +69,7 @@ class Chef
|
|
|
71
69
|
|
|
72
70
|
def wait_for_status(result, status: 'in-progress', sleep: 3)
|
|
73
71
|
print 'Waiting '
|
|
74
|
-
while result.status == 'in-progress'
|
|
72
|
+
while result.status == 'in-progress'
|
|
75
73
|
sleep sleep
|
|
76
74
|
print('.')
|
|
77
75
|
|
|
@@ -47,7 +47,7 @@ class Chef
|
|
|
47
47
|
|
|
48
48
|
domain = DropletKit::Domain.new ip_address: locate_config_value(:ip_address), name: locate_config_value(:name)
|
|
49
49
|
result = client.domains.create domain
|
|
50
|
-
ui.info 'OK' if result.class == DropletKit::Domain
|
|
50
|
+
ui.info 'OK' if result.class == DropletKit::Domain || ui.error(JSON.parse(result)['message'])
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -36,7 +36,7 @@ class Chef
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
result = client.domains.delete(name: locate_config_value(:domain))
|
|
39
|
-
ui.info 'OK' if result == true
|
|
39
|
+
ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -71,7 +71,7 @@ class Chef
|
|
|
71
71
|
data: locate_config_value(:data)
|
|
72
72
|
)
|
|
73
73
|
result = client.domain_records.create domain_record, for_domain: locate_config_value(:domain)
|
|
74
|
-
ui.info 'OK' if result.class == DropletKit::DomainRecord
|
|
74
|
+
ui.info 'OK' if result.class == DropletKit::DomainRecord || ui.error(JSON.parse(result)['message'])
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
end
|
|
@@ -46,7 +46,7 @@ class Chef
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
result = client.domain_records.delete for_domain: locate_config_value(:domain), id: locate_config_value(:record)
|
|
49
|
-
ui.info 'OK' if result == true
|
|
49
|
+
ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -81,7 +81,7 @@ class Chef
|
|
|
81
81
|
data: locate_config_value(:data)
|
|
82
82
|
)
|
|
83
83
|
result = client.domain_records.update domain_record, for_domain: locate_config_value(:domain), id: locate_config_value(:record)
|
|
84
|
-
ui.info 'OK' if result == true
|
|
84
|
+
ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
end
|
|
@@ -58,7 +58,7 @@ class Chef
|
|
|
58
58
|
short: '-K KEYID',
|
|
59
59
|
long: '--ssh-keys KEY_ID',
|
|
60
60
|
description: 'Comma spearated list of your SSH key ids',
|
|
61
|
-
proc:
|
|
61
|
+
proc: ->(o) { o.split(/[\s,]+/) }
|
|
62
62
|
|
|
63
63
|
option :identity_file,
|
|
64
64
|
short: '-i IDENTITY_FILE',
|
|
@@ -77,9 +77,9 @@ class Chef
|
|
|
77
77
|
proc: proc { |s| Chef::Config[:knife][:solo] = s }
|
|
78
78
|
|
|
79
79
|
option :zero,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
long: '--[no-]zero',
|
|
81
|
+
description: 'Do a chef-zero bootstrap on the droplet using knife-zero',
|
|
82
|
+
proc: proc { |z| Chef::Config[:knife][:zero] = z }
|
|
83
83
|
|
|
84
84
|
option :ssh_user,
|
|
85
85
|
short: '-x USERNAME',
|
|
@@ -98,7 +98,7 @@ class Chef
|
|
|
98
98
|
short: '-r RUN_LIST',
|
|
99
99
|
long: '--run-list RUN_LIST',
|
|
100
100
|
description: 'Comma separated list of roles/recipes to apply',
|
|
101
|
-
proc:
|
|
101
|
+
proc: ->(o) { o.split(/[\s,]+/) },
|
|
102
102
|
default: []
|
|
103
103
|
|
|
104
104
|
option :template_file,
|
|
@@ -132,7 +132,7 @@ class Chef
|
|
|
132
132
|
short: '-j JSON',
|
|
133
133
|
long: '--json-attributes JSON',
|
|
134
134
|
description: 'A JSON string to be added to the first run of chef-client',
|
|
135
|
-
proc:
|
|
135
|
+
proc: ->(o) { JSON.parse(o) }
|
|
136
136
|
|
|
137
137
|
option :private_networking,
|
|
138
138
|
long: '--private_networking',
|
|
@@ -36,33 +36,26 @@ class Chef
|
|
|
36
36
|
|
|
37
37
|
droplets_ids = []
|
|
38
38
|
|
|
39
|
-
unless locate_config_value(:server)
|
|
40
|
-
ui.error('Server cannot be empty. => -S <server-id>')
|
|
41
|
-
exit 1
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
unless locate_config_value(:all)
|
|
45
|
-
ui.error('Warning all servers will be lost unless you exit with ctrl-c now!')
|
|
46
|
-
15.times{|x| print x; print 13.chr; sleep 15}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
if locate_config_value(:all) && !client.droplets
|
|
50
|
-
ui.error('You don`t have droplets')
|
|
51
|
-
exit 1
|
|
52
|
-
end
|
|
53
|
-
|
|
54
39
|
if locate_config_value(:server)
|
|
55
40
|
droplets_ids = [locate_config_value(:server)]
|
|
41
|
+
elsif locate_config_value(:all)
|
|
42
|
+
ui.error('Warning all servers will be lost unless you exit with ctrl-c now!')
|
|
43
|
+
15.times { |x| print x; print 13.chr; sleep 1 }
|
|
44
|
+
droplets_ids = client.droplets.all.map(&:id)
|
|
45
|
+
else
|
|
46
|
+
ui.error 'You need to specify either a --server id or --all'
|
|
47
|
+
exit 1
|
|
56
48
|
end
|
|
57
49
|
|
|
58
|
-
if
|
|
59
|
-
|
|
50
|
+
if droplet_ids.empty?
|
|
51
|
+
ui.error('Could not find any droplet(s)')
|
|
52
|
+
exit 1
|
|
60
53
|
end
|
|
61
54
|
|
|
62
55
|
droplets_ids.each do |id|
|
|
63
56
|
ui.info "Delete droplet with id: #{id}"
|
|
64
57
|
result = client.droplets.delete(id: id)
|
|
65
|
-
ui.info 'OK' if result == true
|
|
58
|
+
ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
|
|
66
59
|
end
|
|
67
60
|
end
|
|
68
61
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletPower < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet power (options)'
|
|
@@ -61,6 +61,6 @@ class Chef
|
|
|
61
61
|
|
|
62
62
|
wait_for_status(result)
|
|
63
63
|
end
|
|
64
|
-
|
|
64
|
+
end
|
|
65
65
|
end
|
|
66
66
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletPowercycle < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet powercycle (options)'
|
|
@@ -43,6 +43,6 @@ class Chef
|
|
|
43
43
|
|
|
44
44
|
wait_for_status(result, status: 'active')
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletReboot < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet reboot (options)'
|
|
@@ -43,6 +43,6 @@ class Chef
|
|
|
43
43
|
|
|
44
44
|
wait_for_status(result)
|
|
45
45
|
end
|
|
46
|
-
|
|
46
|
+
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletRebuild < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet rebuild (options)'
|
|
@@ -53,6 +53,6 @@ class Chef
|
|
|
53
53
|
|
|
54
54
|
wait_for_status(result, status: 'active')
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletRename < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet rename (options)'
|
|
@@ -53,6 +53,6 @@ class Chef
|
|
|
53
53
|
|
|
54
54
|
wait_for_status(result)
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletResize < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet resize (options)'
|
|
@@ -53,6 +53,6 @@ class Chef
|
|
|
53
53
|
|
|
54
54
|
wait_for_status(result)
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -14,7 +14,7 @@ require 'chef/knife/digital_ocean_base'
|
|
|
14
14
|
|
|
15
15
|
class Chef
|
|
16
16
|
class Knife
|
|
17
|
-
|
|
17
|
+
class DigitalOceanDropletSnapshot < Knife
|
|
18
18
|
include Knife::DigitalOceanBase
|
|
19
19
|
|
|
20
20
|
banner 'knife digital_ocean droplet snapshot (options)'
|
|
@@ -53,6 +53,6 @@ class Chef
|
|
|
53
53
|
|
|
54
54
|
wait_for_status(result, status: 'active')
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -52,12 +52,12 @@ class Chef
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
print 'Waiting '
|
|
55
|
-
while result.status == 'in-progress'
|
|
55
|
+
while result.status == 'in-progress'
|
|
56
56
|
sleep 8
|
|
57
57
|
print('.')
|
|
58
58
|
|
|
59
|
-
break if client.images.find(id: locate_config_value(:id))
|
|
60
|
-
|
|
59
|
+
break if client.images.find(id: locate_config_value(:id))
|
|
60
|
+
.regions.include? locate_config_value(:region)
|
|
61
61
|
end
|
|
62
62
|
ui.info 'OK'
|
|
63
63
|
end
|
|
@@ -47,7 +47,7 @@ class Chef
|
|
|
47
47
|
|
|
48
48
|
ssh_key = DropletKit::SSHKey.new name: locate_config_value(:name), public_key: File.read(File.expand_path(locate_config_value(:public_key)))
|
|
49
49
|
result = client.ssh_keys.create(ssh_key)
|
|
50
|
-
ui.info 'OK' if result.class == DropletKit::SSHKey
|
|
50
|
+
ui.info 'OK' if result.class == DropletKit::SSHKey || ui.error(JSON.parse(result)['message'])
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knife-digital_ocean
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roland Moriz
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2015-
|
|
12
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: chef
|
|
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
334
334
|
version: '0'
|
|
335
335
|
requirements: []
|
|
336
336
|
rubyforge_project:
|
|
337
|
-
rubygems_version: 2.4.
|
|
337
|
+
rubygems_version: 2.4.5
|
|
338
338
|
signing_key:
|
|
339
339
|
specification_version: 4
|
|
340
340
|
summary: A plugin for chef's knife to manage instances of DigitalOcean servers
|