kitchen-digitalocean 0.12.0 → 0.13.0

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
  SHA256:
3
- metadata.gz: 799bdf4032943a828a9e301f4627c041f5b1c53a446a9e3fc94a1e7c2857e9eb
4
- data.tar.gz: bc667b0ec4efaef1e90a94330d5ed7605a98a5cf8dfe72664ed5f4326ef9cc31
3
+ metadata.gz: 57b24c201f1bc0b22c851d8d7ed316c6658af9a5eae401cc5656ed2de97e632e
4
+ data.tar.gz: 9ae18f394de58c969b81db50ed82fcf187be07a4419a490a228da7899a5da66c
5
5
  SHA512:
6
- metadata.gz: 07bf2504e78e1ce84f3e09bdb1b566aad331553242792622317c01fc13d266611d596e106e26b437807e8a7e678bbbbc824a96abaecef5ea35dec2074b652453
7
- data.tar.gz: 8b3d820d5ca6402ebc0d71861552af622d06ca468e33abed098246960f889303f202e0aae9204037fc6d7b9bdcdaaeb155b94689be1e5b2fec429c8592d3e6c3
6
+ metadata.gz: 2ab3ba2374832a91f659e881b2096a77045010a14c9eb571dcff691afe680bfb3044eab8156a148c2d1e1a08dc357d1bbd5980d008257c5b585cbffb0138df7f
7
+ data.tar.gz: faacfdc85d589fbe10e617558c8cbe8df7cbd49dd942fa51d032237f24ffe941af5738eee01b66992d782bf94122466b395c675bdd75f60a5cd2db088b5c0e07
@@ -17,13 +17,13 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
19
19
 
20
- require 'benchmark' unless defined?(Benchmark)
21
- require 'droplet_kit' unless defined?(DropletKit)
22
- require 'kitchen'
23
- require 'etc' unless defined?(Etc)
24
- require 'socket' unless defined?(Socket)
25
- require 'json' unless defined?(JSON)
26
- autoload :YAML, 'yaml'
20
+ require "benchmark" unless defined?(Benchmark)
21
+ require "droplet_kit" unless defined?(DropletKit)
22
+ require "kitchen"
23
+ require "etc" unless defined?(Etc)
24
+ require "socket" unless defined?(Socket)
25
+ require "json" unless defined?(JSON)
26
+ autoload :YAML, "yaml"
27
27
 
28
28
  module Kitchen
29
29
  module Driver
@@ -31,9 +31,9 @@ module Kitchen
31
31
  #
32
32
  # @author Greg Fitzgerald <greg@gregf.org>
33
33
  class Digitalocean < Kitchen::Driver::SSHBase
34
- default_config :username, 'root'
35
- default_config :port, '22'
36
- default_config :size, 's-1vcpu-1gb'
34
+ default_config :username, "root"
35
+ default_config :port, "22"
36
+ default_config :size, "s-1vcpu-1gb"
37
37
  default_config :monitoring, false
38
38
  default_config(:image, &:default_image)
39
39
  default_config(:server_name, &:default_name)
@@ -45,32 +45,32 @@ module Kitchen
45
45
  default_config :vpcs, nil
46
46
 
47
47
  default_config :region do
48
- ENV['DIGITALOCEAN_REGION'] || 'nyc1'
48
+ ENV["DIGITALOCEAN_REGION"] || "nyc1"
49
49
  end
50
50
 
51
51
  default_config :digitalocean_access_token do
52
- ENV['DIGITALOCEAN_ACCESS_TOKEN']
52
+ ENV["DIGITALOCEAN_ACCESS_TOKEN"]
53
53
  end
54
54
 
55
55
  default_config :ssh_key_ids do
56
- ENV['DIGITALOCEAN_SSH_KEY_IDS'] || ENV['SSH_KEY_IDS']
56
+ ENV["DIGITALOCEAN_SSH_KEY_IDS"] || ENV["SSH_KEY_IDS"]
57
57
  end
58
58
 
59
59
  required_config :digitalocean_access_token
60
60
  required_config :ssh_key_ids
61
61
 
62
62
  PLATFORM_SLUG_MAP = {
63
- 'centos-7' => 'centos-7-x64',
64
- 'centos-8' => 'centos-8-x64',
65
- 'debian-9' => 'debian-9-x64',
66
- 'debian-10' => 'debian-10-x64',
67
- 'fedora-32' => 'fedora-32-x64',
68
- 'fedora-33' => 'fedora-33-x64',
69
- 'freebsd-11' => 'freebsd-11-x64-zfs',
70
- 'freebsd-12' => 'freebsd-12-x64-zfs',
71
- 'ubuntu-16' => 'ubuntu-16-04-x64',
72
- 'ubuntu-18' => 'ubuntu-18-04-x64',
73
- 'ubuntu-20' => 'ubuntu-20-04-x64'
63
+ "centos-7" => "centos-7-x64",
64
+ "centos-8" => "centos-8-x64",
65
+ "debian-9" => "debian-9-x64",
66
+ "debian-10" => "debian-10-x64",
67
+ "fedora-32" => "fedora-32-x64",
68
+ "fedora-33" => "fedora-33-x64",
69
+ "freebsd-11" => "freebsd-11-x64-zfs",
70
+ "freebsd-12" => "freebsd-12-x64-zfs",
71
+ "ubuntu-16" => "ubuntu-16-04-x64",
72
+ "ubuntu-18" => "ubuntu-18-04-x64",
73
+ "ubuntu-20" => "ubuntu-20-04-x64",
74
74
  }.freeze
75
75
 
76
76
  def create(state)
@@ -85,21 +85,21 @@ module Kitchen
85
85
  droplet = client.droplets.find(id: state[:server_id])
86
86
 
87
87
  break if droplet && droplet.networks[:v4] &&
88
- droplet.networks[:v4].any? { |n| n[:type] == 'public' }
88
+ droplet.networks[:v4].any? { |n| n[:type] == "public" }
89
89
  end
90
90
  droplet ||= client.droplets.find(id: state[:server_id])
91
91
 
92
92
  state[:hostname] = droplet.networks[:v4]
93
- .find { |n| n[:type] == 'public' }['ip_address']
93
+ .find { |n| n[:type] == "public" }["ip_address"]
94
94
 
95
95
  if config[:firewalls]
96
- debug('trying to add the firewall by id')
96
+ debug("trying to add the firewall by id")
97
97
  fw_ids = if config[:firewalls].is_a?(String)
98
98
  config[:firewalls].split(/\s+|,\s+|,+/)
99
99
  elsif config[:firewalls].is_a?(Array)
100
100
  config[:firewalls]
101
101
  else
102
- warn('firewalls attribute is not string/array, ignoring')
102
+ warn("firewalls attribute is not string/array, ignoring")
103
103
  []
104
104
  end
105
105
  debug("firewall : #{YAML.dump(fw_ids.inspect)}")
@@ -107,7 +107,7 @@ module Kitchen
107
107
  firewall = client.firewalls.find(id: fw_id)
108
108
  if firewall
109
109
  client.firewalls
110
- .add_droplets([droplet.id], id: firewall.id)
110
+ .add_droplets([droplet.id], id: firewall.id)
111
111
  debug("firewall added: #{firewall.id}")
112
112
  else
113
113
  warn("firewalls id: '#{fw_id}' was not found in api, ignoring")
@@ -129,7 +129,7 @@ module Kitchen
129
129
 
130
130
  break unless droplet
131
131
 
132
- if droplet.status != 'new'
132
+ if droplet.status != "new"
133
133
  client.droplets.delete(id: state[:server_id])
134
134
  break
135
135
  end
@@ -162,11 +162,11 @@ module Kitchen
162
162
  # Total: 63
163
163
  def default_name
164
164
  [
165
- instance.name.gsub(/\W/, '')[0..14],
166
- (Etc.getlogin || 'nologin').gsub(/\W/, '')[0..14],
167
- Socket.gethostname.gsub(/\W/, '')[0..22],
168
- Array.new(7) { rand(36).to_s(36) }.join
169
- ].join('-').tr('_', '-')
165
+ instance.name.gsub(/\W/, "")[0..14],
166
+ (Etc.getlogin || "nologin").gsub(/\W/, "")[0..14],
167
+ Socket.gethostname.gsub(/\W/, "")[0..22],
168
+ Array.new(7) { rand(36).to_s(36) }.join,
169
+ ].join("-").tr("_", "-")
170
170
  end
171
171
 
172
172
  private
@@ -201,8 +201,8 @@ module Kitchen
201
201
  resp = client.droplets.create(droplet)
202
202
 
203
203
  if resp.class != DropletKit::Droplet
204
- error JSON.parse(resp)['message']
205
- error 'Please check your access token is set correctly.'
204
+ error JSON.parse(resp)["message"]
205
+ error "Please check your access token is set correctly."
206
206
  else
207
207
  resp
208
208
  end
@@ -20,7 +20,7 @@
20
20
  module Kitchen
21
21
  module Driver
22
22
  # Version string for Digital Ocean Kitchen driver
23
- DIGITALOCEAN_VERSION = '0.12.0'
23
+ DIGITALOCEAN_VERSION = "0.13.0"
24
24
  end
25
25
  end
26
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-digitalocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Fitzgerald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-13 00:00:00.000000000 Z
11
+ date: 2021-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: droplet_kit
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '1.17'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '3'
42
+ version: '4'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,21 +49,7 @@ dependencies:
49
49
  version: '1.17'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '3'
53
- - !ruby/object:Gem::Dependency
54
- name: bundler
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '0'
60
- type: :development
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: '0'
52
+ version: '4'
67
53
  - !ruby/object:Gem::Dependency
68
54
  name: cane
69
55
  requirement: !ruby/object:Gem::Requirement
@@ -135,19 +121,19 @@ dependencies:
135
121
  - !ruby/object:Gem::Version
136
122
  version: '3.8'
137
123
  - !ruby/object:Gem::Dependency
138
- name: rubocop
124
+ name: chefstyle
139
125
  requirement: !ruby/object:Gem::Requirement
140
126
  requirements:
141
- - - "~>"
127
+ - - '='
142
128
  - !ruby/object:Gem::Version
143
- version: '1.1'
129
+ version: 2.0.5
144
130
  type: :development
145
131
  prerelease: false
146
132
  version_requirements: !ruby/object:Gem::Requirement
147
133
  requirements:
148
- - - "~>"
134
+ - - '='
149
135
  - !ruby/object:Gem::Version
150
- version: '1.1'
136
+ version: 2.0.5
151
137
  - !ruby/object:Gem::Dependency
152
138
  name: simplecov
153
139
  requirement: !ruby/object:Gem::Requirement