kitchen-linode 0.4.0 → 0.6.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
  SHA1:
3
- metadata.gz: 198c98c7ff9a1c80bb355e61914dafda2b5e23ea
4
- data.tar.gz: 2d9a0a9d1997743deff97d46671d0bb6dcec19a3
3
+ metadata.gz: 721f77582e4f5220860cdfc0b07a58ece05360ad
4
+ data.tar.gz: 16ba66a9d1f5bc84e5ca5f75b9bd5fcc071a6566
5
5
  SHA512:
6
- metadata.gz: a68a46f8e6e36c56b8044ec1e1307f2bc402d39b4d244c83e8b9d3e6ae166677967e5680c9b590ff1d96e753bab41e4940e861b7d88346a987e07e928e4788ed
7
- data.tar.gz: 422acc48129a8342977e1c12455d8b7a857de0dbbf14c6e1c3a9f750d1a4e4363c338cd86a0fe128ba269c88a6203371dc5f2943dc4bf9b301ea3626b276ab1a
6
+ metadata.gz: 500c0f06315b5265aaa38ff63075f185a7f84ae8dae5cfffc768d15e5d85d6482b0fca90a309c65cc4756f0e0796ac44861e0b1b367fb90231eb7d4940daf0ec
7
+ data.tar.gz: 49c617d270a94a2f652d83139fbc77a965ceb71b06d927bdfc0a1603dcc3150b5ededb65c910de0c34deae1a783a5bdacb39080e2101a51909e9640aeae371c5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 0.6.0
2
+
3
+ * added an info line
4
+
5
+ ## 0.5.0
6
+
7
+ * added loop to retry initial ssh session on Linode
8
+
9
+ ## 0.4.0
10
+
11
+ * set default ssh timeout to 600 seconds
12
+ * added some more information lines
13
+
1
14
  ## 0.3.0
2
15
 
3
16
  * added option for ssh timeout, set default to 60 seconds
@@ -32,12 +32,12 @@ module Kitchen
32
32
 
33
33
  default_config :username, 'root'
34
34
  default_config :password, nil
35
- default_config(:image) { |driver| driver.default_image }
36
- default_config :data_center, 1
37
- default_config :flavor, 1
35
+ default_config :image, "Debian 8.1"
36
+ default_config :data_center, "Atlanta"
37
+ default_config :flavor, "Linode 1024"
38
38
  default_config :payment_terms, 1
39
39
  default_config :ssh_key_name, nil
40
- default_config :kernel, 215
40
+ default_config :kernel, "Latest 64 bit"
41
41
 
42
42
  default_config :sudo, true
43
43
  default_config :port, 22
@@ -96,7 +96,7 @@ module Kitchen
96
96
 
97
97
  def create_server
98
98
  if config[:password].nil?
99
- config[:password] = [*('a'..'z'),*('0'..'9')].shuffle[0,20].join
99
+ config[:password] = [*('a'..'z'),*('A'..'Z'),*('0'..'9')].shuffle[0,20].join
100
100
  end
101
101
 
102
102
  # set datacenter
@@ -135,7 +135,7 @@ module Kitchen
135
135
  else
136
136
  image = compute.images.find { |i| i.name == config[:image] }
137
137
  if image.nil?
138
- image = compute.images.find { |i| i.name == /#{config[:image]}/ }
138
+ image = compute.images.find { |i| i.name =~ /#{config[:image]}/ }
139
139
  end
140
140
  end
141
141
  if config[:image].nil?
@@ -148,7 +148,7 @@ module Kitchen
148
148
  else
149
149
  kernel = compute.kernels.find { |k| k.name == config[:kernel] }
150
150
  if kernel.nil?
151
- kernel = compute.kernels.find { |k| k.name == /#{config[:kernel]}/ }
151
+ kernel = compute.kernels.find { |k| k.name =~ /#{config[:kernel]}/ }
152
152
  end
153
153
  end
154
154
  if config[:kernel].nil?
@@ -176,25 +176,38 @@ module Kitchen
176
176
  end
177
177
 
178
178
  def setup_ssh(server, state)
179
- info "Using public SSH key <#{config[:public_key_path]}>"
180
- info "Using private SSH key <#{config[:private_key_path]}>"
181
179
  state[:ssh_key] = config[:private_key_path]
182
- do_ssh_setup(state, config, server)
180
+ do_ssh_setup(state, config)
183
181
  end
184
182
 
185
- def do_ssh_setup(state, config, server)
183
+ def do_ssh_setup(state, config)
186
184
  info "Setting up SSH access for key <#{config[:public_key_path]}>"
187
- info "Connecting <#{config[:username]}@#{state[:hostname]}>"
185
+ info "Connecting <#{config[:username]}@#{state[:hostname]}>..."
188
186
  ssh = Fog::SSH.new(state[:hostname],
189
187
  config[:username],
190
- password: config[:password],
191
- timeout: config[:ssh_timeout])
188
+ :password => config[:password],
189
+ :timeout => config[:ssh_timeout])
192
190
  pub_key = open(config[:public_key_path]).read
193
- ssh.run([
194
- %(mkdir .ssh),
195
- %(echo "#{pub_key}" >> ~/.ssh/authorized_keys),
196
- %(passwd -l #{config[:username]})
197
- ])
191
+ @max_interval = 60
192
+ @max_retries = 10
193
+ @retries = 0
194
+ begin
195
+ ssh.run([
196
+ %(mkdir .ssh),
197
+ %(echo "#{pub_key}" >> ~/.ssh/authorized_keys),
198
+ %(passwd -l #{config[:username]})
199
+ ])
200
+ rescue
201
+ @retries ||= 0
202
+ if @retries < @max_retries
203
+ info "Retrying connection..."
204
+ sleep [2**(@retries - 1), @max_interval].min
205
+ @retries += 1
206
+ retry
207
+ else
208
+ raise
209
+ end
210
+ end
198
211
  info "Done setting up SSH access."
199
212
  end
200
213
 
@@ -20,6 +20,6 @@ module Kitchen
20
20
 
21
21
  module Driver
22
22
  # Version string for Linode Kitchen driver
23
- LINODE_VERSION = "0.4.0"
23
+ LINODE_VERSION = "0.6.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-linode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen