knife-joyent 0.4.11 → 0.4.12

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: cbe5b0c80211fc7f11c9442bce84cd0eefac2ceb
4
- data.tar.gz: 7d0c7a4cc3dae56e13f8387712501ad38aafb9e2
3
+ metadata.gz: cbadbfdfac0b82475098817aa9df09ebffc045c6
4
+ data.tar.gz: fa9ce1e48f64143ec93718585e971d65dba56eb9
5
5
  SHA512:
6
- metadata.gz: ec963568f5407fb9615a50c8581eb081832063f7134c14f89696175c36008d654ed19b49b84a6e8d1d1e874ae53d9ce96e5095b38026fbd0fdcd14ea68063fbe
7
- data.tar.gz: 7951a60a59a017eda0a6a6d610b3ef9931408ff13f303091059fd926699539b7d1986c28c880b2ffbaf0091ebe9917e3a2e80ae6eb9ef4b45fd51be7a31bcd1e
6
+ metadata.gz: 05932dc50d37e0f493c7eb00f79e7080c4e0136e1f2e8f2de52909a3fb9cd6c0a845e2aaf841717ab773efd5c8d8c08ad7e3a0aa8b5b9bdba8805b7d90a051af
7
+ data.tar.gz: 112e490a67295fa28c799fb032fa6883e89975242a6eecfdeb2aef060a4307b3481b68437c60390f9ba2da6f2e3275acbd403e0b08f4b62c61c6a982fc2174c0
data/knife-joyent.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
 
20
- s.add_dependency "fog", ">= 1.28.0"
20
+ s.add_dependency "fog", '~> 1.23'
21
21
  s.add_dependency "multi_json", "~> 1.7"
22
22
  s.add_dependency "joyent-cloud-pricing", ">= 1.1.0"
23
23
  s.add_dependency 'chef', '>= 11.16.2', '< 12.1'
@@ -262,7 +262,7 @@ class Chef
262
262
  bootstrap.config[:identity_file] = config[:identity_file]
263
263
  Chef::Log.debug("Bootstrap identity_file = #{bootstrap.config[:identity_file]}")
264
264
 
265
- bootstrap.config[:ssh_gateway] = config[:ssh_gateway]
265
+ bootstrap.config[:ssh_gateway] = determine_ssh_gateway(bootstrap_ip)
266
266
  Chef::Log.debug("Bootstrap ssh_gateway= #{bootstrap.config[:ssh_gateway]}")
267
267
 
268
268
  bootstrap.config[:first_boot_attributes] = config[:json_attributes]
@@ -271,6 +271,34 @@ class Chef
271
271
  bootstrap
272
272
  end
273
273
 
274
+ # src: https://github.com/chef/knife-ec2/blob/master/lib/chef/knife/ec2_server_create.rb#L741-L770
275
+ def determine_ssh_gateway
276
+ # ssh_gateway config takes precedence over derived value
277
+ if config[:ssh_gateway]
278
+ Chef::Log.debug("Using ssh gateway #{config[:ssh_gateway]} from knife config")
279
+ return config[:ssh_gateway]
280
+ end
281
+
282
+ ssh_proxy = Net::SSH::Config.for(hostname)[:proxy]
283
+ if ssh_proxy.respond_to?(:command_line_template)
284
+ # ssh gateway_hostname nc %h %p
285
+ proxy_pattern = /ssh\s+(\S+)\s+nc/
286
+ matchdata = proxy_pattern.match(ssh_proxy.command_line_template)
287
+ if matchdata.nil?
288
+ Chef::Log.debug("Unable to determine ssh gateway for '#{hostname}' from ssh config template: #{ssh_proxy.command_line_template}")
289
+ nil
290
+ else
291
+ # Return hostname extracted from command line template
292
+ Chef::Log.debug("Using ssh gateway #{matchdata[1]} from ssh config")
293
+ matchdata[1]
294
+ end
295
+ else
296
+ # Return nil if we cannot find an ssh_gateway
297
+ Chef::Log.debug("No ssh gateway found, making a direct connection")
298
+ nil
299
+ end
300
+ end
301
+
274
302
  def determine_bootstrap_ip(server)
275
303
  server_ips = server.ips.select{ |ip|
276
304
  ip and not(is_loopback(ip) or is_linklocal(ip))
@@ -1,3 +1,3 @@
1
1
  module KnifeJoyent
2
- VERSION = "0.4.11"
2
+ VERSION = "0.4.12"
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-joyent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Chan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.28.0
19
+ version: '1.23'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.28.0
26
+ version: '1.23'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement