chef-provisioning 1.5.1 → 1.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: 61583af178b0e390bfb0d73e544ea1c28ae5ef8c
4
- data.tar.gz: 1c5c95f663d16dc2f76652fb3e40844e8c986b47
3
+ metadata.gz: b74d8382b16381913bc3607db51e0ec5c00db19a
4
+ data.tar.gz: 75b2979d44492c4f37925babe8ee872f1ef2f69d
5
5
  SHA512:
6
- metadata.gz: 6df6459bd2fb26feec964e99318fc814a58cff4a878233c814793fe6ca1e11203744f849f89ed823842d06b1aecfb8ca175b65e11f4a55f2784ef1c434ea095b
7
- data.tar.gz: b5255c3719f59705c8dbfe71801f9d309b79c291c5a1d73c7f5439cc1913d2a915617e54e37adf9c55d80366b0ac7165079f589d1142ed2af70764671003b9ea
6
+ metadata.gz: bf096a63be29a06fd54291bc3d75d9c7fff2bea359b8e4825a454aea075b008c3f0c1d24d01d8ba1de1e398c192de0df4e64a1ef0999867a19fcbc3c5b63052a
7
+ data.tar.gz: 2d0f1630b268b13c7547e991fc3cfdb66216e0f37ace235e2d05009c29aa21a8da3362ee4498e2c48e75bb0e211ef49228915ec5e41bdd8b68d31346b027be89
@@ -1,10 +1,35 @@
1
1
  # Change Log
2
2
 
3
- ## [1.5.1](https://github.com/chef/chef-provisioning/tree/1.5.1) (2015-12-10)
4
- [Full Changelog](https://github.com/chef/chef-provisioning/compare/v1.5.0...1.5.1)
3
+ ## [Unreleased](https://github.com/chef/chef-provisioning/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/chef/chef-provisioning/compare/v1.5.1...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Custom port forwards. [\#445](https://github.com/chef/chef-provisioning/pull/445) ([causton81](https://github.com/causton81))
10
+
11
+ **Closed issues:**
12
+
13
+ - Chef::Exceptions::ContentLengthMismatch Response body length XXXX does not match HTTP Content-Length header XXXX [\#446](https://github.com/chef/chef-provisioning/issues/446)
5
14
 
6
15
  **Merged pull requests:**
7
16
 
17
+ - Fix Provisioning with Cheffish 1.x [\#496](https://github.com/chef/chef-provisioning/pull/496) ([jkeiser](https://github.com/jkeiser))
18
+ - Add "rake changelog" task [\#491](https://github.com/chef/chef-provisioning/pull/491) ([jkeiser](https://github.com/jkeiser))
19
+ - Stop using Chef::Provider::ChefNode directly \(cheffish 2.0 compat\) [\#490](https://github.com/chef/chef-provisioning/pull/490) ([jkeiser](https://github.com/jkeiser))
20
+ - Allow cheffish 2.0 as a dep [\#489](https://github.com/chef/chef-provisioning/pull/489) ([jkeiser](https://github.com/jkeiser))
21
+ - Updating to the latest release of net-ssh to consume net-ssh/net-ssh\#280 [\#485](https://github.com/chef/chef-provisioning/pull/485) ([tyler-ball](https://github.com/tyler-ball))
22
+
23
+ ## [v1.5.1](https://github.com/chef/chef-provisioning/tree/v1.5.1) (2015-12-10)
24
+ [Full Changelog](https://github.com/chef/chef-provisioning/compare/v1.5.0...v1.5.1)
25
+
26
+ **Closed issues:**
27
+
28
+ - machine resource is broken with 'stock' windows AMI [\#470](https://github.com/chef/chef-provisioning/issues/470)
29
+
30
+ **Merged pull requests:**
31
+
32
+ - Release preperation for 1.5.1 [\#479](https://github.com/chef/chef-provisioning/pull/479) ([tyler-ball](https://github.com/tyler-ball))
8
33
  - Require ResourceBuilder file before monkeypatching to ensure it is already defined [\#478](https://github.com/chef/chef-provisioning/pull/478) ([tyler-ball](https://github.com/tyler-ball))
9
34
  - Ensure target directory exists when using write\_file with WinRM [\#471](https://github.com/chef/chef-provisioning/pull/471) ([xenolinguist](https://github.com/xenolinguist))
10
35
 
@@ -13,7 +38,9 @@
13
38
 
14
39
  **Fixed bugs:**
15
40
 
41
+ - Method failed 'StartsWith' [\#460](https://github.com/chef/chef-provisioning/issues/460)
16
42
  - :converge action should not re-install chef-client if the desired version is already installed [\#428](https://github.com/chef/chef-provisioning/issues/428)
43
+ - machine converge property - no longer used? [\#427](https://github.com/chef/chef-provisioning/issues/427)
17
44
  - SSH available timeout needs to be configurable [\#362](https://github.com/chef/chef-provisioning/issues/362)
18
45
  - Making available? timeout use provided ssh\_options, fixes \#362 [\#466](https://github.com/chef/chef-provisioning/pull/466) ([tyler-ball](https://github.com/tyler-ball))
19
46
  - Pinning to mixlib-install 0.7.0 until 1.0 is out [\#464](https://github.com/chef/chef-provisioning/pull/464) ([tyler-ball](https://github.com/tyler-ball))
@@ -26,6 +53,7 @@
26
53
 
27
54
  **Merged pull requests:**
28
55
 
56
+ - Preping 1.5.0 release [\#467](https://github.com/chef/chef-provisioning/pull/467) ([tyler-ball](https://github.com/tyler-ball))
29
57
  - Add gemspec files to allow bundler to run from the gem [\#461](https://github.com/chef/chef-provisioning/pull/461) ([ksubrama](https://github.com/ksubrama))
30
58
  - Pin mixlib-install more strictly. [\#459](https://github.com/chef/chef-provisioning/pull/459) ([sersut](https://github.com/sersut))
31
59
 
@@ -35,9 +63,14 @@
35
63
  **Fixed bugs:**
36
64
 
37
65
  - ohai\_hints should be be created at c:\chef\ohai\hints when provisioning windows nodes [\#433](https://github.com/chef/chef-provisioning/issues/433)
66
+ - throw exception if Chef::Provisioning::Transport.:WinRM\#execute command is over 3040 chars [\#432](https://github.com/chef/chef-provisioning/issues/432)
38
67
  - Fix install\_sh\_arguments passing after the conversion to mixlib-install [\#452](https://github.com/chef/chef-provisioning/pull/452) ([irvingpop](https://github.com/irvingpop))
39
68
  - Windows ohai hints, fixes \#433 [\#435](https://github.com/chef/chef-provisioning/pull/435) ([hh](https://github.com/hh))
40
69
 
70
+ **Merged pull requests:**
71
+
72
+ - Preparing to release 1.4.1 [\#456](https://github.com/chef/chef-provisioning/pull/456) ([tyler-ball](https://github.com/tyler-ball))
73
+
41
74
  ## [v1.4.0](https://github.com/chef/chef-provisioning/tree/v1.4.0) (2015-09-16)
42
75
  [Full Changelog](https://github.com/chef/chef-provisioning/compare/v1.3.0...v1.4.0)
43
76
 
@@ -73,6 +106,7 @@
73
106
 
74
107
  **Merged pull requests:**
75
108
 
109
+ - IN PROGRESS: 1.4.0 changelog [\#444](https://github.com/chef/chef-provisioning/pull/444) ([jkeiser](https://github.com/jkeiser))
76
110
  - Remove dependency on chef gem [\#441](https://github.com/chef/chef-provisioning/pull/441) ([ksubrama](https://github.com/ksubrama))
77
111
  - Adding a CONTRIBUTING document [\#437](https://github.com/chef/chef-provisioning/pull/437) ([tyler-ball](https://github.com/tyler-ball))
78
112
  - Major generator/spec/Travis improvements [\#426](https://github.com/chef/chef-provisioning/pull/426) ([randomcamel](https://github.com/randomcamel))
@@ -806,4 +840,4 @@
806
840
  ## [v0.1](https://github.com/chef/chef-provisioning/tree/v0.1) (2013-12-21)
807
841
 
808
842
 
809
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
843
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
+ gem 'github_changelog_generator'
4
5
  #gem 'mixlib-install', path: '../mixlib-install'
5
6
  #gem 'net-ssh', :path => '../net-ssh'
6
7
  #gem 'chef', :path => '../chef'
@@ -12,4 +13,6 @@ gemspec
12
13
  #gem 'chef-zero', :path => '../chef-zero'
13
14
  group :development do
14
15
  # gem "berkshelf", github: "berkshelf/berkshelf"
16
+ # TODO we depend on the master branch until chef/chef is released
17
+ gem "chef", github: "chef/chef", branch: "master"
15
18
  end
data/README.md CHANGED
@@ -199,7 +199,21 @@ with_machine_options({
199
199
  ssh_options: { # a list of options to Net::SSH.start
200
200
  :auth_methods => [ 'publickey' ], # DEFAULT
201
201
  :keys_only => true, # DEFAULT
202
- :host_key_alias => "#{instance.id}.AWS" # DEFAULT
202
+ :host_key_alias => "#{instance.id}.AWS", # DEFAULT
203
+ :key_data => nil, # use key from ssh-agent instead of a local file; remember to ssh-add your keys!
204
+ :forward_agent => true, # you may want your ssh-agent to be available on your provisioned machines
205
+ :remote_forwards => [
206
+ # Give remote host access to squid proxy on provisioning node
207
+ {:remote_port => 3128, :local_host => 'localhost', :local_port => 3128,},
208
+ # Give remote host access to private git server
209
+ {:remote_port => 2222, :local_host => 'git.example.com', :local_port => 22,},
210
+ ],
211
+ # You can send net-ssh log info to the Chef::Log if you are having
212
+ # trouble with ssh.
213
+ :logger => Chef::Log,
214
+ # If you use :logger => Chef::Log and :verbose then your :verbose setting
215
+ # will override the global Chef::Config. Probably don't want to do this:
216
+ #:verbose => :warn,
203
217
  }
204
218
  })
205
219
  ```
data/Rakefile CHANGED
@@ -37,4 +37,17 @@ namespace :driver do
37
37
  Rake::Task['driver:verify'].invoke
38
38
  Rake::Task['driver:clean'].invoke
39
39
  end
40
- end
40
+ end
41
+
42
+ begin
43
+ require 'github_changelog_generator/task'
44
+
45
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
46
+ # config.future_release = ChefZero::VERSION
47
+ config.enhancement_labels = "enhancement,Enhancement,New Feature".split(',')
48
+ config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(',')
49
+ config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog".split(',')
50
+ end
51
+ rescue LoadError
52
+ # It's OK if the github_changelog_generator isn't there, that happens when we're testing older chef versions
53
+ end
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
12
12
  s.email = 'jkeiser@chef.io'
13
13
  s.homepage = 'http://github.com/chef/chef-provisioning/README.md'
14
14
 
15
- s.add_dependency 'net-ssh', '~> 2.0'
15
+ s.add_dependency 'net-ssh', '>= 2.9', '< 4.0'
16
16
  s.add_dependency 'net-scp', '~> 1.0'
17
17
  s.add_dependency 'net-ssh-gateway', '~> 1.2.0'
18
18
  s.add_dependency 'inifile', '~> 2.0'
19
- s.add_dependency 'cheffish', '~> 1.3', '>= 1.3.1' # 1.3.1 allows 'let' vars in unquoted recipes.
19
+ s.add_dependency 'cheffish', '>= 1.3.1', '< 3.0' # 1.3.1 allows 'let' vars in unquoted recipes.
20
20
  s.add_dependency 'winrm', '~> 1.3'
21
21
  s.add_dependency "mixlib-install", "~> 0.7.0"
22
22
 
@@ -1,5 +1,4 @@
1
1
  require 'chef/provider/lwrp_base'
2
- require 'chef/provider/chef_node'
3
2
  require 'openssl'
4
3
  require 'chef/provisioning/chef_provider_action_handler'
5
4
 
@@ -1,5 +1,5 @@
1
1
  require 'chef/provider/lwrp_base'
2
- require 'chef/provider/chef_node'
2
+ require 'chef/resource/chef_node'
3
3
  require 'openssl'
4
4
  require 'chef/provisioning/chef_provider_action_handler'
5
5
 
@@ -175,10 +175,16 @@ class Machine < Chef::Provider::LWRPBase
175
175
  end
176
176
 
177
177
  def load_current_resource
178
- node_driver = Chef::Provider::ChefNode.new(new_resource, run_context)
179
- node_driver.load_current_resource
180
- json = node_driver.new_json
181
- json['normal']['chef_provisioning'] = node_driver.current_json['normal']['chef_provisioning']
178
+ if defined?(Chef::Provider::ChefNode)
179
+ # Cheffish 1.x
180
+ node_provider = Chef::Provider::ChefNode.new(new_resource, run_context)
181
+ else
182
+ # Cheffish 2.x
183
+ node_provider = Chef::Resource::ChefNode.action_class.new(new_resource, run_context)
184
+ end
185
+ node_provider.load_current_resource
186
+ json = node_provider.new_json
187
+ json['normal']['chef_provisioning'] = node_provider.current_json['normal']['chef_provisioning']
182
188
  @machine_spec = chef_managed_entry_store.new_entry(:machine, new_resource.name, json)
183
189
  end
184
190
 
@@ -1,5 +1,4 @@
1
1
  require 'chef/provider/lwrp_base'
2
- require 'chef/provider/chef_node'
3
2
  require 'openssl'
4
3
  require 'chef/provisioning/chef_provider_action_handler'
5
4
 
@@ -42,6 +42,7 @@ module Provisioning
42
42
  @ssh_options = ssh_options
43
43
  @options = options
44
44
  @config = global_config
45
+ @remote_forwards = ssh_options.delete(:remote_forwards) { Array.new }
45
46
  end
46
47
 
47
48
  attr_reader :host
@@ -51,12 +52,25 @@ module Provisioning
51
52
  attr_reader :config
52
53
 
53
54
  def execute(command, execute_options = {})
54
- Chef::Log.info("Executing #{options[:prefix]}#{command} on #{username}@#{host}")
55
+ Chef::Log.info("#{self.object_id} Executing #{options[:prefix]}#{command} on #{username}@#{host}")
55
56
  stdout = ''
56
57
  stderr = ''
57
58
  exitstatus = nil
58
59
  session # grab session outside timeout, it has its own timeout
60
+
59
61
  with_execute_timeout(execute_options) do
62
+ @remote_forwards.each do |forward_info|
63
+ # -R flag to openssh client allows optional :remote_host and
64
+ # requires the other values so let's do that too.
65
+ remote_host = forward_info.fetch(:remote_host, 'localhost')
66
+ remote_port = forward_info.fetch(:remote_port)
67
+ local_host = forward_info.fetch(:local_host)
68
+ local_port = forward_info.fetch(:local_port)
69
+
70
+ actual_port, actual_host = forward_port(local_port, local_host, remote_port, remote_host)
71
+ Chef::Log.info("#{host} forwarded remote #{actual_host}:#{actual_port} to local #{local_host}:#{local_port}")
72
+ end
73
+
60
74
  channel = session.open_channel do |channel|
61
75
  # Enable PTY unless otherwise specified, some instances require this
62
76
  unless options[:ssh_pty_enable] == false
@@ -85,6 +99,20 @@ module Provisioning
85
99
  end
86
100
 
87
101
  channel.wait
102
+
103
+ @remote_forwards.each do |forward_info|
104
+ # -R flag to openssh client allows optional :remote_host and
105
+ # requires the other values so let's do that too.
106
+ remote_host = forward_info.fetch(:remote_host, 'localhost')
107
+ remote_port = forward_info.fetch(:remote_port)
108
+ local_host = forward_info.fetch(:local_host)
109
+ local_port = forward_info.fetch(:local_port)
110
+
111
+ session.forward.cancel_remote(remote_port, remote_host)
112
+ session.loop { session.forward.active_remotes.include?([remote_port, remote_host]) }
113
+
114
+ Chef::Log.info("#{host} canceled remote forward #{remote_host}:#{remote_port}")
115
+ end
88
116
  end
89
117
 
90
118
  Chef::Log.info("Completed #{command} on #{username}@#{host}: exit status #{exitstatus}")
@@ -156,15 +184,17 @@ module Provisioning
156
184
  end
157
185
  uri.host = host
158
186
  uri.port = port
187
+ Chef::Log.info("Port forwarded: local URL #{local_url} is available to #{self.host} as #{uri.to_s} for the duration of this SSH connection.")
188
+ else
189
+ Chef::Log.info("#{host} not forwarding non-local #{local_url}")
159
190
  end
160
- Chef::Log.info("Port forwarded: local URL #{local_url} is available to #{self.host} as #{uri.to_s} for the duration of this SSH connection.")
161
191
  uri.to_s
162
192
  end
163
193
 
164
194
  def disconnect
165
195
  if @session
166
196
  begin
167
- Chef::Log.debug("Closing SSH session on #{username}@#{host}")
197
+ Chef::Log.info("Closing SSH session on #{username}@#{host}")
168
198
  @session.close
169
199
  rescue
170
200
  ensure
@@ -177,7 +207,7 @@ module Provisioning
177
207
  timeout = ssh_options[:timeout] || 10
178
208
  execute('pwd', :timeout => timeout)
179
209
  true
180
- rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ENETUNREACH, Errno::EHOSTDOWN, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::Disconnect
210
+ rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ENETUNREACH, Errno::EHOSTDOWN, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::Disconnect, Net::SSH::ConnectionTimeout
181
211
  Chef::Log.debug("#{username}@#{host} unavailable: network connection failed or broke: #{$!.inspect}")
182
212
  disconnect
183
213
  false
@@ -199,7 +229,7 @@ module Provisioning
199
229
  if gateway? then gateway.ssh(host, username, ssh_start_opts)
200
230
  else Net::SSH.start(host, username, ssh_start_opts)
201
231
  end
202
- rescue Timeout::Error
232
+ rescue Timeout::Error, Net::SSH::ConnectionTimeout
203
233
  Chef::Log.debug("Timed out connecting to SSH: #{$!}")
204
234
  raise InitialConnectTimeout.new($!)
205
235
  end
@@ -333,7 +363,7 @@ module Provisioning
333
363
 
334
364
  actual_remote_port, actual_remote_host = session.forward.active_remote_destinations[[local_port, local_host]]
335
365
  if !actual_remote_port
336
- Chef::Log.debug("Forwarding local server #{local_host}:#{local_port} to #{username}@#{self.host}")
366
+ Chef::Log.info("Forwarding local server #{local_host}:#{local_port} to #{username}@#{self.host}")
337
367
 
338
368
  session.forward.remote(local_port, local_host, remote_port, remote_host) do |new_remote_port, new_remote_host|
339
369
  actual_remote_host = new_remote_host
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Provisioning
3
- VERSION = '1.5.1'
3
+ VERSION = '1.6.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2016-02-03 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
- version: '2.0'
19
+ version: '2.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '2.0'
29
+ version: '2.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: net-scp
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -70,22 +76,22 @@ dependencies:
70
76
  name: cheffish
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
79
  - - ">="
77
80
  - !ruby/object:Gem::Version
78
81
  version: 1.3.1
82
+ - - "<"
83
+ - !ruby/object:Gem::Version
84
+ version: '3.0'
79
85
  type: :runtime
80
86
  prerelease: false
81
87
  version_requirements: !ruby/object:Gem::Requirement
82
88
  requirements:
83
- - - "~>"
84
- - !ruby/object:Gem::Version
85
- version: '1.3'
86
89
  - - ">="
87
90
  - !ruby/object:Gem::Version
88
91
  version: 1.3.1
92
+ - - "<"
93
+ - !ruby/object:Gem::Version
94
+ version: '3.0'
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: winrm
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -269,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
275
  version: '0'
270
276
  requirements: []
271
277
  rubyforge_project:
272
- rubygems_version: 2.4.7
278
+ rubygems_version: 2.4.5.1
273
279
  signing_key:
274
280
  specification_version: 4
275
281
  summary: A library for creating machines and infrastructures idempotently in Chef.