knife-digital_ocean 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1bedce18b715271ffb566428d10d5ab93e1af8f2
4
- data.tar.gz: 5ba947ad792cfa26ec4232457cea6e79cf6dd96c
3
+ metadata.gz: dd36cab124f582b57336810c5ba2a1a26afc5fa1
4
+ data.tar.gz: c7706cae3df44fa1fdd30d9cfb500f321fc5f511
5
5
  SHA512:
6
- metadata.gz: 138af5bec6a1ea1483e41cd5b30503ba53007f04e8f3203288c5e153d63702f8660dc36d350b4e4bb60e169f61c86b3ea5a81c39e66578bbab700f5e604df7fe
7
- data.tar.gz: acebc494d1a7b4dab59844e9ac9358837eeae99e28c55c5e9d7a202eb801db06622924d91f5e8fc091f728fb9b531ee1cebb05f54f22d697e7c0afa96f130d3f
6
+ metadata.gz: c365439ec60572e7b4f88e9934a9e09c5ba9999cddacb6cfa040102e75d01361ef811af3fb486652a516841829239ea77d3d4dba98509b58aec471e73f5b8f5c
7
+ data.tar.gz: 3e5b2ce87d2025a41ffe64db10a05118ff283ae8475420b05d51374291da4f346066a42d19a7c6b60d07ae450c4e047df2726e39047355308964699867b9be24
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 2.1.0
5
+ - 2.2.2
5
6
  env:
6
7
  - DIGITALOCEAN_ACCESS_TOKEN="fake_access_token"
7
8
  script: bundle exec rake spec
@@ -1,3 +1,7 @@
1
+ # 2.4.1 / 2015-07-01
2
+
3
+ * Fix knife digital_ocean droplet destroy
4
+
1
5
  # 2.4.0 / 2015-04-11
2
6
 
3
7
  * Add knife-zero bootstrapping support
data/README.md CHANGED
@@ -297,7 +297,7 @@ OK
297
297
  OK
298
298
  ```
299
299
 
300
- #### Resize A Droplet
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
- Singapore 1 sgp1
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
- Amsterdam 3 ams3
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' do
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 or ui.error JSON.parse(result)['message']
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 or ui.error JSON.parse(result)['message']
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 or ui.error JSON.parse(result)['message']
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 or ui.error JSON.parse(result)['message']
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 or ui.error JSON.parse(result)['message']
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: lambda { |o| o.split(/[\s,]+/) }
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
- 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 }
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: lambda { |o| o.split(/[\s,]+/) },
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: lambda { |o| JSON.parse(o) }
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 locate_config_value(:all)
59
- droplets_ids = client.droplets.all.map(&:id)
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 or ui.error JSON.parse(result)['message']
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
- class DigitalOceanDropletPower < Knife
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
- end
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
- class DigitalOceanDropletPowercycle < Knife
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
- end
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
- class DigitalOceanDropletReboot < Knife
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
- end
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
- class DigitalOceanDropletRebuild < Knife
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
- end
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
- class DigitalOceanDropletRename < Knife
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
- end
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
- class DigitalOceanDropletResize < Knife
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
- end
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
- class DigitalOceanDropletSnapshot < Knife
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
- end
56
+ end
57
57
  end
58
58
  end
@@ -35,7 +35,7 @@ class Chef
35
35
  end
36
36
 
37
37
  result = client.images.delete(id: locate_config_value(:id))
38
- ui.info 'OK' if result == true or ui.error JSON.parse(result)['message']
38
+ ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
39
39
  end
40
40
  end
41
41
  end
@@ -52,12 +52,12 @@ class Chef
52
52
  end
53
53
 
54
54
  print 'Waiting '
55
- while result.status == 'in-progress' do
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
- regions.include? locate_config_value(:region)
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 or ui.error JSON.parse(result)['message']
50
+ ui.info 'OK' if result.class == DropletKit::SSHKey || 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.ssh_keys.delete id: locate_config_value(:id)
39
- ui.info 'OK' if result == true or ui.error JSON.parse(result)['message']
39
+ ui.info 'OK' if result == true || ui.error(JSON.parse(result)['message'])
40
40
  end
41
41
  end
42
42
  end
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module DigitalOcean
3
- VERSION = '2.4.0'
3
+ VERSION = '2.4.1'
4
4
  end
5
5
  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.0
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-04-11 00:00:00.000000000 Z
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.6
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