chef-metal 0.6 → 0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f75d0eea4f0ab10f62670396310edd0576e866f
4
- data.tar.gz: 6dd9f7a2319e535163b35772f1efa62b6d32bd7e
3
+ metadata.gz: f78844f0b35265a0587a59130f2cc18f094c91ee
4
+ data.tar.gz: 4456458de1b2708269d784c6dd1c42559353b861
5
5
  SHA512:
6
- metadata.gz: bdb8c0681270de564b0adc840e73a382c8bef6a1aa358692e81b80b480f670d6be31c1128f87e0ce8b6774168a74d0731d3975264d7a2e7ed0b97ac13455d924
7
- data.tar.gz: a58484ee3eafe1c46914fe624587c2476e16f42c9b935f7bdcae29b6e409354745a7e57884ed97fc86031174bf6344caf95096b7de0c745410bdf4fc50e7dadb
6
+ metadata.gz: dbec23e421ace3000e3f09dca9142120683fbd5201d4187adf73f8381b36a1d4863a803a716e8bc77e69b0ce69b1d6c17980ea8fbdc355d37534d7a452a6de62
7
+ data.tar.gz: 3652afb4356159e48a3103c6fe1e9f6477219074453cd9fd11f164dce9c44f717f80c75e23d2d78f7202d7151c9f110e731d7e9aea109b816f64da67a0e38b0a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Chef Metal Changelog
2
2
 
3
+ ## 0.7 (4/5/2014)
4
+
5
+ - Change transport interface: add ability to rewrite URL instead of forwarding ports
6
+
3
7
  ## 0.6 (4/4/2014)
4
8
 
5
9
  - Vagrant and Fog provisioners moved to their own gems (chef-metal-vagrant and chef-metal-fog)
@@ -22,11 +22,7 @@ module ChefMetal
22
22
 
23
23
  # If the chef server lives on localhost, tunnel the port through to the guest
24
24
  chef_server_url = machine_resource.chef_server[:chef_server_url]
25
- url = URI(chef_server_url)
26
- # TODO IPv6
27
- if is_localhost(url.host)
28
- machine.forward_remote_port_to_local(url.port, url.port)
29
- end
25
+ chef_server_url = machine.make_url_available_to_remote(chef_server_url)
30
26
 
31
27
  # Create client.rb and client.pem on machine
32
28
  content = client_rb_content(chef_server_url, machine.node['name'])
@@ -67,8 +67,8 @@ module ChefMetal
67
67
  end
68
68
  end
69
69
 
70
- def forward_remote_port_to_local(remote_port, local_port)
71
- transport.forward_remote_port_to_local(remote_port, local_port)
70
+ def make_url_available_to_remote(local_url)
71
+ transport.make_url_available_to_remote(local_url)
72
72
  end
73
73
 
74
74
  def disconnect
@@ -17,7 +17,6 @@ module ChefMetal
17
17
  raise "converge not overridden on #{self.class}"
18
18
  end
19
19
 
20
-
21
20
  def execute(action_handler, command)
22
21
  raise "execute not overridden on #{self.class}"
23
22
  end
@@ -67,9 +66,10 @@ module ChefMetal
67
66
  raise "get_attributes not overridden on #{self.class}"
68
67
  end
69
68
 
70
- # Forward a remote port to local for the duration of the current connection
71
- def forward_remote_port_to_local(remote_port, local_port)
72
- raise "forward_remote_port_to_local not overridden on #{self.class}"
69
+ # Ensure the given URL can be reached by the remote side (possibly by port forwarding)
70
+ # Must return the URL that the remote side can use to reach the local_url
71
+ def make_url_available_to_remote(local_url)
72
+ raise "make_url_available_to_remote not overridden on #{self.class}"
73
73
  end
74
74
 
75
75
  def disconnect
@@ -1,4 +1,6 @@
1
1
  require 'chef_metal/transport'
2
+ require 'uri'
3
+ require 'socket'
2
4
 
3
5
  module ChefMetal
4
6
  class Transport
@@ -94,10 +96,15 @@ module ChefMetal
94
96
  end
95
97
  end
96
98
 
97
- def forward_remote_port_to_local(remote_port, local_port)
98
- # TODO IPv6
99
- Chef::Log.debug("Forwarding local server 127.0.0.1:#{local_port} to port #{remote_port} on #{username}@#{host}")
100
- session.forward.remote(local_port, "127.0.0.1", remote_port)
99
+ def make_url_available_to_remote(local_url)
100
+ uri = URI(local_url)
101
+ host = Socket.getaddrinfo(uri.host, uri.scheme, nil, :STREAM)[0][3]
102
+ if host == '127.0.0.1' || host == '[::1]'
103
+ # TODO IPv6
104
+ Chef::Log.debug("Forwarding local server 127.0.0.1:#{uri.port} to port #{uri.port} on #{username}@#{host}")
105
+ session.forward.remote(uri.port, "127.0.0.1", uri.port)
106
+ end
107
+ local_url
101
108
  end
102
109
 
103
110
  def disconnect
@@ -20,9 +20,8 @@ module ChefMetal
20
20
  write_file(path, IO.read(local_path))
21
21
  end
22
22
 
23
- # Forward requests to a port on the guest to a server on the host
24
- def forward_remote_port_to_local(remote_port, local_port)
25
- raise "forward_remote_port_to_local not overridden on #{self.class}"
23
+ def make_url_available_to_remote(local_url)
24
+ raise "make_url_available_to_remote not overridden on #{self.class}"
26
25
  end
27
26
 
28
27
  def disconnect
@@ -1,3 +1,3 @@
1
1
  module ChefMetal
2
- VERSION = '0.6'
2
+ VERSION = '0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef