chef-provisioning 0.17 → 0.18

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: e0c37376aede638b149fb1aa359b47260e7dd532
4
- data.tar.gz: c75da4c89e3b9cd12a5a97906f1cc708b4f42989
3
+ metadata.gz: 5c4cefaa41a622f8b28242c0d77384e123f88562
4
+ data.tar.gz: 354056ddabbf9c6010af17895a069c4ece6240f9
5
5
  SHA512:
6
- metadata.gz: 27e6d46bbeb25ba1185014913f7c20c5a0adeb73ffe9c1bae191ec914fb3ccfc2ca795a657ab52333720643a80231ea2bead2b65bd899654dfcf7a3c08d313e9
7
- data.tar.gz: 9a043f593fa6db7f7a8275fa2a21286bad930bb1be47249dfaa1b0331570d6defefcb51c57dc67b3158168d6ec24f454700245c590220c73f14b19b315eb1172
6
+ metadata.gz: c447345478be4935d4e55de75f197bb4f182d1cb153ddf6142eee50679bd99922438a63789c5c6cefe46261a7e6bda8d2929e9dc3d2bbec413d72b7b1532e81f
7
+ data.tar.gz: c2ebf41170f13d2d8537327393410b2f91756955c3d4b3c2bc59d1ab0a86e82cdf55694a0b2fa3bfa7025ced2bbf7be2df5832992c254d5dde8464a99537e6c0
data/CHANGELOG.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # Chef Provisioning Changelog
2
2
 
3
+ ## 0.18 (1/27/2015)
4
+
5
+ - Allow `ssl_verify_mode` to be overridden (@mivok)
6
+ - Support `machine_options[:convergence_options][:bootstrap_proxy]` (@mivok)
7
+ - Allow `machine_options[:ssh_gateway]` without username (no @) (@mivok)
8
+ - Fix issue with net-ssh 2.9.2
9
+ - Add `action :destroy` to `machine_image` (@miguelcnf)
10
+
3
11
  ## 0.17 (12/17/2014)
4
12
 
5
- - Make machine batch convergent
13
+ - Make machine batch convergent
6
14
  - Consolidate load balancer create and update
7
15
  - Update some URLs
8
16
  - SSL verification fix
@@ -194,7 +202,7 @@
194
202
 
195
203
  ## 0.8 (4/8/2014)
196
204
 
197
- - New machine_execute resource! (irving@getchef.com)
205
+ - New machine_execute resource! (irving@chef.io)
198
206
  - Experimental "metal" command line: metal execute NODENAME COMMAND ARGS
199
207
  - Transport: Add ability to stream execute() for better nested chef-client debugging
200
208
 
@@ -209,14 +217,14 @@
209
217
 
210
218
  ## 0.5 (4/3/2014)
211
219
 
212
- * Provisioner interface changes designed to allow provisioners to be used outside of Chef (doubt@getchef.com)
220
+ * Provisioner interface changes designed to allow provisioners to be used outside of Chef (doubt@chef.io)
213
221
  * All Provisioner and Machine methods now take "action_handler" instead of "driver." It uses the ActionHandler interface described in action_handler.rb. In short:
214
222
  - driver.run_context -> action_handler.recipe_context
215
223
  - driver.updated_by_last_action(true) -> action_handler.updated!
216
224
  - driver.converge_by -> action_handler.perform_action
217
225
  - driver.cookbook_name -> driver.debug_name
218
226
  * Convergence strategy: delete_chef_objects() -> cleanup_convergence()
219
- * Ability to get back to a machine from a node (another Provisioner interface change) (doubt@getchef.com):
227
+ * Ability to get back to a machine from a node (another Provisioner interface change) (doubt@chef.io):
220
228
  * Provisioners must create a file named `chef_provisioning/provisioner_init/<scheme>_init.rb`. It will be required when a node is encountered with that scheme. It should call Chef::Provisioning.add_registered_provisioner_class(<scheme>, <provisioner class name>). For the provisioner_url `fog:AWS:21348723432`, the scheme is "fog" and the file is `chef_provisioningprovisioner_init/fog_init.rb`. It should call `Chef::Provisioning.add_registered_provisioner_class('fog', Chef::Provisioning::Provisioner::FogProvisioner)`.
221
229
  * Provisioner classes must implement the class method `inflate(node)`, which should create a Provisioner instance appropriate to the given `node` (generally by looking at `node['normal']['provisioner_output']`)
222
230
  * New `NoConverge` convergence strategy that creates a node but does not install Chef or converge.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- [![Stories in Ready](https://badge.waffle.io/opscode/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/opscode/chef-provisioning)
1
+ [![Stories in Ready](https://badge.waffle.io/chef/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/chef/chef-provisioning)
2
2
  Chef Provisioning
3
3
  ==========
4
- [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/opscode/chef-provisioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/chef/chef-provisioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
5
 
6
6
  This library solves the problem of repeatably creating machines and infrastructures in Chef. It has a plugin model that lets you write bootstrappers for your favorite infrastructures, including VirtualBox, EC2, LXC, bare metal, and many more!
7
7
 
@@ -9,19 +9,22 @@ This library solves the problem of repeatably creating machines and infrastructu
9
9
 
10
10
  Date | Blog
11
11
  -----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------
12
- 6/3/2014 | [machine_batch and parallelization](https://github.com/opscode/chef-provisioning/blob/master/docs/blogs/2012-05-28-machine_batch.html.markdown#chef-provisioning-parallelization)
13
- 6/3/2014 | [Chef Provisioning, Configuration and Drivers](https://github.com/opscode/chef-provisioning/blob/master/docs/blogs/2012-05-22-new-driver-interface.html.markdown#chef-provisioning-configuration-and-drivers)
14
- 3/4/2014 | [Chef Metal 0.2: Overview](http://www.getchef.com/blog/2014/03/04/chef-metal-0-2-release/) - this is a pretty good overview (though dated).
15
- 12/20/2013 | [Chef Metal Alpha](http://www.getchef.com/blog/2013/12/20/chef-metal-alpha/)
12
+ 2014-12-15 | [Using Chef Provisioning to Build Chef Server](https://www.chef.io/blog/2014/12/15/sysadvent-day-14-using-chef-provisioning-to-build-chef-server/)
13
+ 2014-11-12 | [Chef Launches Policy-Based Provisioning](https://www.chef.io/blog/2014/11/12/chef-launches-policy-based-provisioning/)
14
+ 2014-11-12 | [Chef Provisioning: Infrastructure As Code](https://www.chef.io/blog/2014/11/12/chef-provisioning-infrastructure-as-code/)
15
+ 2014-06-03 | [machine_batch and parallelization](https://github.com/chef/chef-provisioning/blob/master/docs/blogs/2012-05-28-machine_batch.html.markdown#chef-provisioning-parallelization)
16
+ 2014-06-03 | [Chef Provisioning, Configuration and Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/blogs/2012-05-22-new-driver-interface.html.markdown#chef-provisioning-configuration-and-drivers)
17
+ 2014-03-04 | [Chef Metal 0.2: Overview](http://www.chef.io/blog/2014/03/04/chef-metal-0-2-release/) - this is a pretty good overview (though dated).
18
+ 2013-12-20 | [Chef Metal Alpha](http://www.chef.io/blog/2013/12/20/chef-metal-alpha/)
16
19
 
17
20
  Documentation
18
21
  -------------
19
- * [Chef Docs](https://docs.getchef.com/provisioning.html)
20
- * [Frequently Asked Questions](https://github.com/opscode/chef-provisioning/blob/master/docs/faq.md)
21
- * [Configuration](https://github.com/opscode/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
22
- * [Writing Drivers](https://github.com/opscode/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
23
- * [Embedding](https://github.com/opscode/chef-provisioning/blob/master/docs/embedding.md)
24
- * [Providers](https://github.com/opscode/chef-provisioning/blob/master/docs/providers)
22
+ * [Chef Docs](https://docs.chef.io/provisioning.html)
23
+ * [Frequently Asked Questions](https://github.com/chef/chef-provisioning/blob/master/docs/faq.md)
24
+ * [Configuration](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
25
+ * [Writing Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
26
+ * [Embedding](https://github.com/chef/chef-provisioning/blob/master/docs/embedding.md)
27
+ * [Providers](https://github.com/chef/chef-provisioning/blob/master/docs/providers)
25
28
 
26
29
  Try It Out
27
30
  ----------
@@ -46,7 +49,7 @@ If you have an AWS account, you can spin up a machine there like this:
46
49
 
47
50
  ```
48
51
  gem install chef-provisioning chef-provisioning-fog
49
- export CHEF_DRIVER=fog:AWS
52
+ export CHEF_DRIVER=aws
50
53
  chef-client -z simple.rb
51
54
  ```
52
55
 
@@ -83,7 +86,7 @@ Chef Provisioning has two major abstractions: the machine resource, and drivers.
83
86
 
84
87
  You declare what your machines do (recipes, tags, etc.) with the `machine` resource, the fundamental unit of Chef Provisioning. You will typically declare `machine` resources in a separate, OS/provisioning-independent file that declares the *topology* of your app--your machines and the recipes that will run on them.
85
88
 
86
- The machine resources from the example [myapp::small](https://github.com/opscode/chef-provisioning/blob/master/cookbooks/myapp/recipes/small.rb) are pretty straightforward. Here's a copy/paste:
89
+ The machine resources from the example [myapp::small](https://github.com/chef/chef-provisioning/blob/master/cookbooks/myapp/recipes/small.rb) are pretty straightforward. Here's a copy/paste:
87
90
 
88
91
  ```ruby
89
92
  machine 'mario' do
@@ -119,20 +122,20 @@ Drivers save their data in the Chef node itself, so that they will be accessible
119
122
  Drivers each have their own repository. Current drivers:
120
123
 
121
124
  **Cloud:**
122
- - [AWS](https://github.com/opscode/chef-provisioning-aws)
123
- - [Azure](https://github.com/opscode/chef-provisioning-azure)
124
- - [FOG: EC2, DigitalOcean, OpenStack, etc.](https://github.com/opscode/chef-provisioning-fog)
125
+ - [AWS](https://github.com/chef/chef-provisioning-aws)
126
+ - [Azure](https://github.com/chef/chef-provisioning-azure)
127
+ - [FOG: EC2, DigitalOcean, OpenStack, etc.](https://github.com/chef/chef-provisioning-fog)
125
128
 
126
129
  **Virtualization:**
127
- - [Vagrant: VirtualBox, VMWare Fusion, etc.](https://github.com/opscode/chef-provisioning-vagrant)
130
+ - [Vagrant: VirtualBox, VMWare Fusion, etc.](https://github.com/chef/chef-provisioning-vagrant)
128
131
  - [VSphere](https://github.com/RallySoftware-cookbooks/chef-metal-vsphere) (not yet up to date with 0.11)
129
132
 
130
133
  **Containers:**
131
- - [Docker](https://github.com/opscode/chef-provisioning-docker)
132
- - [LXC](https://github.com/opscode/chef-provisioning-lxc)
134
+ - [Docker](https://github.com/chef/chef-provisioning-docker)
135
+ - [LXC](https://github.com/chef/chef-provisioning-lxc)
133
136
 
134
137
  **Bare Metal:**
135
- - [Hanlon](https://github.com/opscode/chef-provisioning-hanlon)
138
+ - [Hanlon](https://github.com/chef/chef-provisioning-hanlon)
136
139
  - [OpenCrowbar](https://github.com/newgoliath/chef-provisioning-crowbar) OpenCrowbar controls your real metal. It discovers, inventories, configs RAID & BIOS and networks, and installs your OS. [OpenCrowbar website](http://www.opencrowbar.org) [OpenCrowbar github](https://github.com/opencrowbar/core)
137
140
  - [SSH (no PXE)](https://github.com/double-z/chef-metal-ssh) (not yet up to date with 0.11)
138
141
 
@@ -147,7 +150,7 @@ chef-client -z vagrant_linux.rb simple.rb
147
150
 
148
151
  This is a chef-client run, which runs multiple **recipes.** Chef Provisioning is nothing but resources you put in recipes.
149
152
 
150
- The driver is specified on the command line. Drivers are URLs. You could use `vagrant:~/vms` or `fog:AWS:default:us-east-1' as driver URLs. More information [here.](https://github.com/opscode/chef-provisioning/blob/master/docs/configuration.md#setting-the-driver-with-a-driver-url)
153
+ The driver is specified on the command line. Drivers are URLs. You could use `vagrant:~/vms` or `fog:AWS:default:us-east-1' as driver URLs. More information [here.](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#setting-the-driver-with-a-driver-url)
151
154
 
152
155
  The `vagrant_linux.rb` recipe handles the physical specification of the machines and Vagrant box:
153
156
 
@@ -260,6 +263,6 @@ Chef Provisioning also works with Test Kitchen, allowing you to test entire clus
260
263
  Bugs and The Plan
261
264
  -----------------
262
265
 
263
- Please submit bugs, gripes and feature requests at [https://github.com/opscode/chef-provisioning/issues](https://twitter.com/jkeiser2), contact jkeiser on Twitter at @jkeiser2, email at [jkeiser@getchef.com](mailto:jkeiser@getchef.com)
266
+ Please submit bugs, gripes and feature requests at [https://github.com/chef/chef-provisioning/issues](https://github.com/chef/chef-provisioning/issues), contact John Keiser on Twitter at [@jkeiser2](https://twitter.com/jkeiser2), email at [jkeiser@chef.io](mailto:jkeiser@chef.io)
264
267
 
265
- To contribute, just make a PR in the appropriate repo--also, make sure you've [signed the Chef Contributor License Agreement](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L) (quick couple of minutes online), since this is going into core Chef eventually. It takes some time to process, so if you've just done it, let me know in the PR :) If you already signed this for a Chef contribution, you don't need to do so again--if you're not sure, you can check for your name [here](https://wiki.opscode.com/display/chef/Approved+Contributors)!
268
+ To contribute, just make a PR in the appropriate repo--also, make sure you've [signed the Chef Contributor License Agreement](https://supermarket.chef.io) (through your Chef Supermarket profile), since this is going into core Chef eventually. If you already signed this for a Chef contribution, you don't need to do so again--if you're not sure, you can check for your name [here](https://supermarket.chef.io/contributors) or if you signed up long ago check the [old list](https://github.com/chef/chef/blob/master/CLA_ARCHIVE.md)!
@@ -36,6 +36,14 @@ class MachineImage < Chef::Provider::LWRPBase
36
36
  end
37
37
 
38
38
  action :destroy do
39
+ # Get the image mapping on the server (from name to image-id)
40
+ image_spec = Chef::Provisioning::ChefImageSpec.get(new_resource.name, new_resource.chef_server) ||
41
+ Chef::Provisioning::ChefImageSpec.empty(new_resource.name, new_resource.chef_server)
42
+
43
+ if image_spec.location
44
+ new_driver.destroy_image(action_handler, image_spec, new_resource.image_options)
45
+ image_spec.delete(action_handler)
46
+ end
39
47
  end
40
48
 
41
49
  def create_image(image_spec)
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  #
3
- # Author:: Douglas Triggs (<doug@getchef.com>)
3
+ # Author:: Douglas Triggs (<doug@chef.io>)
4
4
  #
5
5
  # Copyright (C) 2014, Chef, Inc.
6
6
  #
@@ -15,7 +15,7 @@ module Provisioning
15
15
  end
16
16
 
17
17
  #
18
- # Get a ImageSpec from the chef server. If the node does not exist on the
18
+ # Get a ImageSpec from the chef server. If the image does not exist on the
19
19
  # server, it returns nil.
20
20
  #
21
21
  def self.get(name, chef_server = Cheffish.default_chef_server)
@@ -51,12 +51,12 @@ module Provisioning
51
51
  end
52
52
 
53
53
  #
54
- # Save this node to the server. If you have significant information that
54
+ # Save this image to the server. If you have significant information that
55
55
  # could be lost, you should do this as quickly as possible. Data will be
56
56
  # saved automatically for you after allocate_image and ready_image.
57
57
  #
58
58
  def save(action_handler)
59
- # Save the node to the server.
59
+ # Save the image to the server.
60
60
  _self = self
61
61
  _chef_server = _self.chef_server
62
62
  Chef::Provisioning.inline_resource(action_handler) do
@@ -72,14 +72,14 @@ module Provisioning
72
72
  end
73
73
 
74
74
  def delete(action_handler)
75
- # Save the node to the server.
75
+ # Delete the image from the server.
76
76
  _self = self
77
77
  _chef_server = _self.chef_server
78
78
  Chef::Provisioning.inline_resource(action_handler) do
79
79
  chef_data_bag_item _self.name do
80
80
  data_bag 'images'
81
81
  chef_server _chef_server
82
- action :destroy
82
+ action :delete
83
83
  end
84
84
  end
85
85
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  #
3
- # Author:: Douglas Triggs (<doug@getchef.com>)
3
+ # Author:: Douglas Triggs (<doug@chef.io>)
4
4
  #
5
5
  # Copyright (C) 2014, Chef, Inc.
6
6
  #
@@ -103,7 +103,7 @@ module Provisioning
103
103
  #
104
104
  # Figure out the URL to the metadata
105
105
  #
106
- metadata_url="https://www.opscode.com/chef/metadata"
106
+ metadata_url="https://www.chef.io/chef/metadata"
107
107
  metadata_url << "?v=#{@chef_version}"
108
108
  metadata_url << "&prerelease=#{@prerelease ? 'true' : 'false'}"
109
109
  metadata_url << "&p=#{platform.strip}"
@@ -9,7 +9,7 @@ module Provisioning
9
9
 
10
10
  def initialize(convergence_options, config)
11
11
  super
12
- @install_msi_url = convergence_options[:install_msi_url] || 'http://www.opscode.com/chef/install.msi'
12
+ @install_msi_url = convergence_options[:install_msi_url] || 'http://www.chef.io/chef/install.msi'
13
13
  @install_msi_path = convergence_options[:install_msi_path] || "$env:TEMP\\#{File.basename(@install_msi_url)}"
14
14
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
15
15
  end
@@ -42,10 +42,11 @@ module Provisioning
42
42
  def converge(action_handler, machine)
43
43
  super
44
44
 
45
- # TODO For some reason I get a 500 back if I don't do -l debug
46
45
  action_handler.open_stream(machine.node['name']) do |stdout|
47
46
  action_handler.open_stream(machine.node['name']) do |stderr|
48
- machine.execute(action_handler, "chef-client -l debug",
47
+ command_line = "chef-client"
48
+ command_line << " -l #{config[:log_level].to_s}" if config[:log_level]
49
+ machine.execute(action_handler, command_line,
49
50
  :stream_stdout => stdout,
50
51
  :stream_stderr => stderr,
51
52
  :timeout => @chef_client_timeout)
@@ -13,7 +13,7 @@ module Provisioning
13
13
  :client_pem_path => '/etc/chef/client.pem'
14
14
  })
15
15
  super(convergence_options, config)
16
- @install_sh_url = convergence_options[:install_sh_url] || 'http://www.opscode.com/chef/install.sh'
16
+ @install_sh_url = convergence_options[:install_sh_url] || 'http://www.chef.io/chef/install.sh'
17
17
  @install_sh_path = convergence_options[:install_sh_path] || '/tmp/chef-install.sh'
18
18
  @bootstrap_env = convergence_options[:bootstrap_proxy] ? "http_proxy=#{convergence_options[:bootstrap_proxy]}" : ""
19
19
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
@@ -170,18 +170,26 @@ module Provisioning
170
170
  end
171
171
 
172
172
  def client_rb_content(chef_server_url, node_name)
173
- if chef_server_url.downcase.start_with?("https")
174
- ssl_verify_mode = ':verify_peer'
175
- else
176
- ssl_verify_mode = ':verify_none'
177
- end
178
-
179
- <<EOM
173
+ ssl_verify_mode = convergence_options[:ssl_verify_mode]
174
+ ssl_verify_mode ||= if chef_server_url.downcase.start_with?("https")
175
+ :verify_peer
176
+ else
177
+ :verify_none
178
+ end
179
+
180
+ content = <<EOM
180
181
  chef_server_url #{chef_server_url.inspect}
181
182
  node_name #{node_name.inspect}
182
183
  client_key #{convergence_options[:client_pem_path].inspect}
183
- ssl_verify_mode #{ssl_verify_mode}
184
+ ssl_verify_mode #{ssl_verify_mode.to_sym.inspect}
184
185
  EOM
186
+ unless convergence_options[:bootstrap_proxy].nil?
187
+ content << <<EOM
188
+ http_proxy #{convergence_options[:bootstrap_proxy].inspect}
189
+ https_proxy #{convergence_options[:bootstrap_proxy].inspect}
190
+ EOM
191
+ end
192
+ content
185
193
  end
186
194
  end
187
195
  end
@@ -103,7 +103,7 @@ module Provisioning
103
103
  # Returns a triplet:
104
104
  # platform, platform_version, machine_architecture = machine.detect_os(action_handler)
105
105
  # This triplet is suitable for passing to the Chef metadata API:
106
- # https://www.opscode.com/chef/metadata?p=PLATFORM&pv=PLATFORM_VERSION&m=MACHINE_ARCHITECTURE
106
+ # https://www.chef.io/chef/metadata?p=PLATFORM&pv=PLATFORM_VERSION&m=MACHINE_ARCHITECTURE
107
107
  def detect_os(action_handler)
108
108
  raise "detect_os not overridden on #{self.class}"
109
109
  end
@@ -24,7 +24,9 @@ module Provisioning
24
24
  # - :ssh_pty_enable: set to false to disable pty (some instances don't
25
25
  # support this, most do)
26
26
  # - :ssh_gateway: the gateway to use, e.g. "jkeiser@145.14.51.45:222".
27
- # nil (the default) means no gateway.
27
+ # nil (the default) means no gateway. If the username is omitted,
28
+ # then the default username is used instead (i.e. the user running
29
+ # chef, or the username configured in .ssh/config).
28
30
  # - global_config: an options hash that looks suspiciously similar to
29
31
  # Chef::Config, containing at least the key :log_level.
30
32
  #
@@ -280,8 +282,10 @@ module Provisioning
280
282
 
281
283
  def gateway
282
284
  gw_user, gw_host = options[:ssh_gateway].split('@')
285
+ # If we didn't have an '@' in the above, then the value is actually
286
+ # the hostname, not the username.
287
+ gw_host, gw_user = gw_user, gw_host if gw_host.nil?
283
288
  gw_host, gw_port = gw_host.split(':')
284
- gw_user = ssh_options[:ssh_username] unless gw_user
285
289
 
286
290
  ssh_start_opts = { timeout:10 }.merge(ssh_options)
287
291
  ssh_start_opts[:port] = gw_port || 22
@@ -310,22 +314,34 @@ module Provisioning
310
314
  def forward_port(local_port, local_host, remote_port, remote_host)
311
315
  # This bit is from the documentation.
312
316
  if session.forward.respond_to?(:active_remote_destinations)
313
- got_remote_port, remote_host = session.forward.active_remote_destinations[[local_port, local_host]]
314
- if !got_remote_port
317
+ # active_remote_destinations tells us exactly what remotes the current
318
+ # ssh session is *actually* tracking. If multiple people share this
319
+ # session and set up their own remotes, this will prevent us from
320
+ # overwriting them.
321
+
322
+ actual_remote_port, actual_remote_host = session.forward.active_remote_destinations[[local_port, local_host]]
323
+ if !actual_remote_port
315
324
  Chef::Log.debug("Forwarding local server #{local_host}:#{local_port} to #{username}@#{self.host}")
316
325
 
317
- session.forward.remote(local_port, local_host, remote_port, remote_host) do |actual_remote_port|
318
- got_remote_port = actual_remote_port || :error
326
+ session.forward.remote(local_port, local_host, remote_port, remote_host) do |new_remote_port, new_remote_host|
327
+ actual_remote_host = new_remote_host
328
+ actual_remote_port = new_remote_port || :error
319
329
  :no_exception # I'll take care of it myself, thanks
320
330
  end
321
331
  # Kick SSH until we get a response
322
- session.loop { !got_remote_port }
323
- if got_remote_port == :error
332
+ session.loop { !actual_remote_port }
333
+ if actual_remote_port == :error
324
334
  return nil
325
335
  end
326
336
  end
327
- [ got_remote_port, remote_host ]
337
+ [ actual_remote_port, actual_remote_host ]
328
338
  else
339
+ # If active_remote_destinations isn't on net-ssh, we stash our own list
340
+ # of ports *we* have forwarded on the connection, and hope that we are
341
+ # right.
342
+ # TODO let's remove this when net-ssh 2.9.2 is old enough, and
343
+ # bump the required net-ssh version.
344
+
329
345
  @forwarded_ports ||= {}
330
346
  remote_port, remote_host = @forwarded_ports[[local_port, local_host]]
331
347
  if !remote_port
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Provisioning
3
- VERSION = '0.17'
3
+ VERSION = '0.18'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,129 +1,129 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.17'
4
+ version: '0.18'
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-12-17 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.0'
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
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-scp
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: net-ssh-gateway
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: inifile
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cheffish
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.8'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: winrm
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.2.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.2.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: A library for creating machines and infrastructures idempotently in Chef.
126
- email: jkeiser@opscode.com
126
+ email: jkeiser@chef.io
127
127
  executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files:
@@ -135,8 +135,6 @@ files:
135
135
  - LICENSE
136
136
  - README.md
137
137
  - Rakefile
138
- - lib/.DS_Store
139
- - lib/chef/.DS_Store
140
138
  - lib/chef/provider/load_balancer.rb
141
139
  - lib/chef/provider/machine.rb
142
140
  - lib/chef/provider/machine_batch.rb
@@ -144,7 +142,6 @@ files:
144
142
  - lib/chef/provider/machine_file.rb
145
143
  - lib/chef/provider/machine_image.rb
146
144
  - lib/chef/provisioning.rb
147
- - lib/chef/provisioning/.DS_Store
148
145
  - lib/chef/provisioning/action_handler.rb
149
146
  - lib/chef/provisioning/add_prefix_action_handler.rb
150
147
  - lib/chef/provisioning/chef_image_spec.rb
@@ -179,7 +176,7 @@ files:
179
176
  - lib/chef/resource/machine_file.rb
180
177
  - lib/chef/resource/machine_image.rb
181
178
  - lib/chef_metal.rb
182
- homepage: http://wiki.opscode.com/display/chef
179
+ homepage: http://github.com/chef/chef-provisioning/README.md
183
180
  licenses: []
184
181
  metadata: {}
185
182
  post_install_message:
@@ -188,12 +185,12 @@ require_paths:
188
185
  - lib
189
186
  required_ruby_version: !ruby/object:Gem::Requirement
190
187
  requirements:
191
- - - '>='
188
+ - - ">="
192
189
  - !ruby/object:Gem::Version
193
190
  version: '0'
194
191
  required_rubygems_version: !ruby/object:Gem::Requirement
195
192
  requirements:
196
- - - '>='
193
+ - - ">="
197
194
  - !ruby/object:Gem::Version
198
195
  version: '0'
199
196
  requirements: []
data/lib/.DS_Store DELETED
Binary file
data/lib/chef/.DS_Store DELETED
Binary file
Binary file