knife-windows 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,6 +2,7 @@ Knife Windows Plugin
2
2
  ====================
3
3
  [![Build Status Master](https://travis-ci.org/chef/knife-windows.svg?branch=master)](https://travis-ci.org/chef/knife-windows)
4
4
  [![Build Status Master](https://ci.appveyor.com/api/projects/status/github/chef/knife-windows?branch=master&svg=true&passingText=master%20-%20Ok&pendingText=master%20-%20Pending&failingText=master%20-%20Failing)](https://ci.appveyor.com/project/Chef/knife-windows/branch/master)
5
+ [![Gem Version](https://badge.fury.io/rb/knife-windows.svg)](https://badge.fury.io/rb/knife-windows)
5
6
 
6
7
  This plugin adds additional functionality to the Chef Knife CLI tool for
7
8
  configuring / interacting with nodes running Microsoft Windows:
@@ -1,34 +1,34 @@
1
- <!---
2
- This file is reset every time a new release is done. The contents of this file are for the currently unreleased version.
3
-
4
- Example Note:
5
-
6
- ## Example Heading
7
- Details about the thing that changed that needs to get included in the Release Notes in markdown.
8
- -->
9
- # knife-windows 1.1.0 release notes:
10
- This release of knife-windows includes an important fix for an
11
- incompatibility issue with Chef Client 12.5 during bootstrap. If you
12
- are running knife-windows 1.0.0, please upgrade to this version. See
13
- the following issue for details: https://github.com/chef/knife-windows/pull/302
14
-
15
- You can install this version using the `gem` command:
16
-
17
- gem install knife-windows
18
-
19
- ## Reporting issues and contributing
20
- `knife-windows` issues like those addressed in this release should be reported in the ticketing system at https://github.com/chef/knife-windows/issues. You can learn more about how to contribute features and bug fixes to `knife-windows` in the [Chef Contributions document](http://docs.chef.io/community_contributions.html).
21
-
22
- ## New features -- proxy support for WinRM
23
- The `winrm` and `bootstrap windows winrm` subcommands now honor the
24
- proxy server configured via the `http_proxy` setting in `knife.rb` for
25
- WinRM traffic.
26
-
27
- ## Issues fixed in knife-windows 1.1.0
28
- See the [knife-windows 1.1.0 CHANGELOG](https://github.com/chef/knife-windows/blob/1.1.0/CHANGELOG.md)
29
- for the list of issues fixed in this release.
30
-
31
- ## knife-windows on RubyGems and Github
32
- https://rubygems.org/gems/knife-windows
33
- https://github.com/chef/knife-windows
34
-
1
+ <!---
2
+ This file is reset every time a new release is done. The contents of this file are for the currently unreleased version.
3
+
4
+ Example Note:
5
+
6
+ ## Example Heading
7
+ Details about the thing that changed that needs to get included in the Release Notes in markdown.
8
+ -->
9
+ # knife-windows 1.1.0 release notes:
10
+ This release of knife-windows includes an important fix for an
11
+ incompatibility issue with Chef Client 12.5 during bootstrap. If you
12
+ are running knife-windows 1.0.0, please upgrade to this version. See
13
+ the following issue for details: https://github.com/chef/knife-windows/pull/302
14
+
15
+ You can install this version using the `gem` command:
16
+
17
+ gem install knife-windows
18
+
19
+ ## Reporting issues and contributing
20
+ `knife-windows` issues like those addressed in this release should be reported in the ticketing system at https://github.com/chef/knife-windows/issues. You can learn more about how to contribute features and bug fixes to `knife-windows` in the [Chef Contributions document](http://docs.chef.io/community_contributions.html).
21
+
22
+ ## New features -- proxy support for WinRM
23
+ The `winrm` and `bootstrap windows winrm` subcommands now honor the
24
+ proxy server configured via the `http_proxy` setting in `knife.rb` for
25
+ WinRM traffic.
26
+
27
+ ## Issues fixed in knife-windows 1.1.0
28
+ See the [knife-windows 1.1.0 CHANGELOG](https://github.com/chef/knife-windows/blob/1.1.0/CHANGELOG.md)
29
+ for the list of issues fixed in this release.
30
+
31
+ ## knife-windows on RubyGems and Github
32
+ https://rubygems.org/gems/knife-windows
33
+ https://github.com/chef/knife-windows
34
+
data/Rakefile CHANGED
@@ -1,21 +1,21 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
- begin
5
- require 'rspec/core/rake_task'
6
-
7
- task :default => [:unit_spec, :functional_spec]
8
-
9
- desc "Run all functional specs in spec directory"
10
- RSpec::Core::RakeTask.new(:functional_spec) do |t|
11
- t.pattern = 'spec/functional/**/*_spec.rb'
12
- end
13
-
14
- desc "Run all unit specs in spec directory"
15
- RSpec::Core::RakeTask.new(:unit_spec) do |t|
16
- t.pattern = 'spec/unit/**/*_spec.rb'
17
- end
18
-
19
- rescue LoadError
20
- STDERR.puts "\n*** RSpec not available. (sudo) gem install rspec to run unit tests. ***\n\n"
21
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ begin
5
+ require 'rspec/core/rake_task'
6
+
7
+ task :default => [:unit_spec, :functional_spec]
8
+
9
+ desc "Run all functional specs in spec directory"
10
+ RSpec::Core::RakeTask.new(:functional_spec) do |t|
11
+ t.pattern = 'spec/functional/**/*_spec.rb'
12
+ end
13
+
14
+ desc "Run all unit specs in spec directory"
15
+ RSpec::Core::RakeTask.new(:unit_spec) do |t|
16
+ t.pattern = 'spec/unit/**/*_spec.rb'
17
+ end
18
+
19
+ rescue LoadError
20
+ STDERR.puts "\n*** RSpec not available. (sudo) gem install rspec to run unit tests. ***\n\n"
21
+ end
@@ -8,16 +8,13 @@ environment:
8
8
  bundle_gemfile: ci.gemfile
9
9
 
10
10
  matrix:
11
- - ruby_version: "193"
11
+ - ruby_version: "20"
12
12
  chef_version: "< 12"
13
13
 
14
- - ruby_version: "200"
15
- chef_version: "< 12"
16
-
17
- - ruby_version: "200"
14
+ - ruby_version: "21"
18
15
  chef_version: "~> 12.0"
19
16
 
20
- - ruby_version: "200"
17
+ - ruby_version: "21"
21
18
  chef_version: "master"
22
19
 
23
20
  clone_folder: c:\projects\knife-windows
@@ -32,7 +29,7 @@ install:
32
29
  - echo %PATH%
33
30
  - ruby --version
34
31
  - gem --version
35
- - gem install bundler --quiet --no-ri --no-rdoc
32
+ - gem install bundler -v 1.11.2 --quiet --no-ri --no-rdoc
36
33
  - bundler --version
37
34
 
38
35
  build_script:
data/ci.gemfile CHANGED
@@ -1,15 +1,15 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in knife-windows.gemspec
4
- gemspec
5
-
6
- if ENV['CHEF_VERSION'] == 'master'
7
- gem 'chef', github: 'chef/chef'
8
- else
9
- gem 'chef', ENV['CHEF_VERSION']
10
- end
11
-
12
- gem "rspec", '~> 3.0'
13
- gem "ruby-wmi"
14
- gem "httpclient"
15
- gem 'rake'
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in knife-windows.gemspec
4
+ gemspec
5
+
6
+ if ENV['CHEF_VERSION'] == 'master'
7
+ gem 'chef', github: 'chef/chef'
8
+ else
9
+ gem 'chef', ENV['CHEF_VERSION']
10
+ end
11
+
12
+ gem "rspec", '~> 3.0'
13
+ gem "ruby-wmi"
14
+ gem "httpclient"
15
+ gem 'rake'
@@ -1,20 +1,20 @@
1
- Feature: Ensure that the help works as designed
2
- In order to test the help via CLI
3
- As an Operator
4
- I want to run the CLI with different arguments
5
-
6
- Scenario: Running the windows sub-command shows available commands
7
- When I run `knife windows`
8
- And the output should contain "Available windows subcommands: (for details, knife SUB-COMMAND --help)\n\n** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
9
-
10
- Scenario: Running the windows sub-command shows available commands
11
- When I run `knife windows --help`
12
- And the output should contain "Available windows subcommands: (for details, knife SUB-COMMAND --help)\n\n** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
13
-
14
- Scenario: Running the windows sub-command shows available commands
15
- When I run `knife windows help`
16
- And the output should contain "Available windows subcommands: (for details, knife SUB-COMMAND --help)\n\n** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
17
-
18
- Scenario: Running the knife command shows available windows command"
19
- When I run `knife`
20
- And the output should contain "** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
1
+ Feature: Ensure that the help works as designed
2
+ In order to test the help via CLI
3
+ As an Operator
4
+ I want to run the CLI with different arguments
5
+
6
+ Scenario: Running the windows sub-command shows available commands
7
+ When I run `knife windows`
8
+ And the output should contain "Available windows subcommands: (for details, knife SUB-COMMAND --help)\n\n** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
9
+
10
+ Scenario: Running the windows sub-command shows available commands
11
+ When I run `knife windows --help`
12
+ And the output should contain "Available windows subcommands: (for details, knife SUB-COMMAND --help)\n\n** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
13
+
14
+ Scenario: Running the windows sub-command shows available commands
15
+ When I run `knife windows help`
16
+ And the output should contain "Available windows subcommands: (for details, knife SUB-COMMAND --help)\n\n** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
17
+
18
+ Scenario: Running the knife command shows available windows command"
19
+ When I run `knife`
20
+ And the output should contain "** WINDOWS COMMANDS **\nknife bootstrap windows winrm FQDN (options)\nknife bootstrap windows ssh FQDN (options)\nknife winrm QUERY COMMAND (options)"
@@ -1,5 +1,5 @@
1
- require 'aruba/cucumber'
2
-
3
- Before do
4
- @aruba_timeout_seconds = 5
5
- end
1
+ require 'aruba/cucumber'
2
+
3
+ Before do
4
+ @aruba_timeout_seconds = 5
5
+ end
@@ -1,25 +1,25 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "knife-windows/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "knife-windows"
7
- s.version = Knife::Windows::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Seth Chisamore"]
10
- s.email = ["schisamo@chef.io"]
11
- s.license = "Apache-2.0"
12
- s.homepage = "https://github.com/chef/knife-windows"
13
- s.summary = %q{Plugin that adds functionality to Chef's Knife CLI for configuring/interacting with nodes running Microsoft Windows}
14
- s.description = s.summary
15
-
16
- s.required_ruby_version = ">= 1.9.1"
17
- s.add_dependency "winrm", "~> 1.7"
18
-
19
- s.add_development_dependency 'pry'
20
-
21
- s.files = `git ls-files`.split("\n")
22
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
- s.require_paths = ["lib"]
25
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "knife-windows/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "knife-windows"
7
+ s.version = Knife::Windows::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Seth Chisamore"]
10
+ s.email = ["schisamo@chef.io"]
11
+ s.license = "Apache-2.0"
12
+ s.homepage = "https://github.com/chef/knife-windows"
13
+ s.summary = %q{Plugin that adds functionality to Chef's Knife CLI for configuring/interacting with nodes running Microsoft Windows}
14
+ s.description = s.summary
15
+
16
+ s.required_ruby_version = ">= 1.9.1"
17
+ s.add_dependency "winrm", "~> 1.7"
18
+
19
+ s.add_development_dependency 'pry'
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+ end
@@ -103,7 +103,7 @@ class Chef
103
103
 
104
104
  option :hint,
105
105
  :long => "--hint HINT_NAME[=HINT_FILE]",
106
- :description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
106
+ :description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
107
107
  :proc => Proc.new { |h|
108
108
  Chef::Config[:knife][:hints] ||= Hash.new
109
109
  name, path = h.split("=")
@@ -127,7 +127,7 @@ class Chef
127
127
  option :encrypted_data_bag_secret,
128
128
  :short => "-s SECRET",
129
129
  :long => "--secret ",
130
- :description => "The secret key to use to decrypt data bag item values. Will be rendered on the node at c:/chef/encrypted_data_bag_secret and set in the rendered client config.",
130
+ :description => "The secret key to use to decrypt data bag item values. Will be rendered on the node at c:/chef/encrypted_data_bag_secret and set in the rendered client config.",
131
131
  :default => false
132
132
 
133
133
  # Mismatch between option 'encrypted_data_bag_secret_file' and it's long value '--secret-file' is by design for compatibility
@@ -280,7 +280,7 @@ class Chef
280
280
 
281
281
  bootstrap_architecture = Chef::Config[:knife][:bootstrap_architecture]
282
282
  if bootstrap_architecture && ![:x86_64, :i386].include?(bootstrap_architecture.to_sym)
283
- raise "Valid values for the knife config :bootstrap_architecture are i386 or x86_64. Supplied value is #{bootstrap_architecture}"
283
+ raise "Valid values for the knife config :bootstrap_architecture are i386 or x86_64. Supplied value is #{bootstrap_architecture}"
284
284
  end
285
285
  if Chef::Config[:knife][:architecture]
286
286
  raise "Do not set :architecture in your knife config, use :bootstrap_architecture."
@@ -435,7 +435,7 @@ behavior will be removed and any 'encrypted_data_bag_secret' entries in
435
435
  if bootstrap_architecture.nil?
436
436
  architecture = current_architecture
437
437
  elsif bootstrap_architecture == :x86_64 && current_architecture == :i386
438
- raise "You specified bootstrap_architecture as x86_64 but the target machine is i386. A 64 bit program cannot run on a 32 bit machine."
438
+ raise "You specified bootstrap_architecture as x86_64 but the target machine is i386. A 64 bit program cannot run on a 32 bit machine."
439
439
  else
440
440
  architecture = bootstrap_architecture
441
441
  end
@@ -254,8 +254,14 @@ param(
254
254
  [String] $localPath
255
255
  )
256
256
 
257
+ $ProxyUrl = $env:http_proxy;
257
258
  $webClient = new-object System.Net.WebClient;
258
259
 
260
+ if ($ProxyUrl -ne '') {
261
+ $WebProxy = New-Object System.Net.WebProxy($ProxyUrl,$true)
262
+ $WebClient.Proxy = $WebProxy
263
+ }
264
+
259
265
  $webClient.DownloadFile($remoteUrl, $localPath);
260
266
  WGET_PS
261
267
 
@@ -54,7 +54,7 @@ class Chef
54
54
  option :winrm_transport,
55
55
  :short => "-t TRANSPORT",
56
56
  :long => "--winrm-transport TRANSPORT",
57
- :description => "The WinRM transport type. valid choices are [ssl, plaintext]",
57
+ :description => "The WinRM transport type. Valid choices are [ssl, plaintext]",
58
58
  :default => 'plaintext',
59
59
  :proc => Proc.new { |transport| Chef::Config[:knife][:winrm_port] = '5986' if transport == 'ssl'
60
60
  Chef::Config[:knife][:winrm_transport] = transport }
@@ -42,6 +42,9 @@ class Chef
42
42
  Chef::Log.debug("Transport: #{options[:transport]}")
43
43
 
44
44
  @winrm_session = WinRM::WinRMWebService.new(@endpoint, options[:transport], opts)
45
+ transport = @winrm_session.instance_variable_get(:@xfer)
46
+ http_client = transport.instance_variable_get(:@httpcli)
47
+ Chef::HTTP::DefaultSSLPolicy.new(http_client.ssl_config).set_custom_certs
45
48
  @winrm_session.set_timeout(options[:operation_timeout]) if options[:operation_timeout]
46
49
  end
47
50
 
@@ -62,7 +62,7 @@ class Chef
62
62
  unless output_object.error_message.nil?
63
63
  ui.warn "Failed to connect to #{item.host} at #{item.endpoint}."
64
64
  if err && err.is_a?(OpenSSL::SSL::SSLError)
65
- ui.warn "Failure due to an issue with SSL; likely cause would be unsuccesful certificate verification."
65
+ ui.warn "Failure due to an issue with SSL; likely cause would be unsuccessful certificate verification."
66
66
  ui.warn "Either ensure your certificate is valid or use '--winrm-ssl-verify-mode verify_none' to ignore verification failures."
67
67
  end
68
68
  error_count += 1
@@ -86,6 +86,7 @@ class Chef
86
86
  }
87
87
 
88
88
  client = HTTPClient.new
89
+ Chef::HTTP::DefaultSSLPolicy.new(client.ssl_config).set_custom_certs
89
90
  client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE if resolve_no_ssl_peer_verification
90
91
  client.post(endpoint, xml, header)
91
92
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Windows
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.1"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -104,8 +104,14 @@ echo. [String] $remoteUrl,
104
104
  echo. [String] $localPath
105
105
  echo.^)
106
106
  echo.
107
+ echo.$ProxyUrl = $env:http_proxy;
107
108
  echo.$webClient = new-object System.Net.WebClient;
108
109
  echo.
110
+ echo.if ^($ProxyUrl -ne ''^) {
111
+ echo. $WebProxy = New-Object System.Net.WebProxy^($ProxyUrl,$true^)
112
+ echo. $WebClient.Proxy = $WebProxy
113
+ echo.}
114
+ echo.
109
115
  echo.$webClient.DownloadFile^($remoteUrl, $localPath^);
110
116
 
111
117
  )
@@ -213,5 +219,5 @@ echo.# Using default node name ^(fqdn^)
213
219
 
214
220
  @echo Starting chef to bootstrap the node...
215
221
  SET "PATH=%PATH%;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin"
216
- chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json -E _default
222
+ chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json
217
223
 
@@ -104,8 +104,14 @@ echo. [String] $remoteUrl,
104
104
  echo. [String] $localPath
105
105
  echo.^)
106
106
  echo.
107
+ echo.$ProxyUrl = $env:http_proxy;
107
108
  echo.$webClient = new-object System.Net.WebClient;
108
109
  echo.
110
+ echo.if ^($ProxyUrl -ne ''^) {
111
+ echo. $WebProxy = New-Object System.Net.WebProxy^($ProxyUrl,$true^)
112
+ echo. $WebClient.Proxy = $WebProxy
113
+ echo.}
114
+ echo.
109
115
  echo.$webClient.DownloadFile^($remoteUrl, $localPath^);
110
116
 
111
117
  )
@@ -104,8 +104,14 @@ echo. [String] $remoteUrl,
104
104
  echo. [String] $localPath
105
105
  echo.^)
106
106
  echo.
107
+ echo.$ProxyUrl = $env:http_proxy;
107
108
  echo.$webClient = new-object System.Net.WebClient;
108
109
  echo.
110
+ echo.if ^($ProxyUrl -ne ''^) {
111
+ echo. $WebProxy = New-Object System.Net.WebProxy^($ProxyUrl,$true^)
112
+ echo. $WebClient.Proxy = $WebProxy
113
+ echo.}
114
+ echo.
109
115
  echo.$webClient.DownloadFile^($remoteUrl, $localPath^);
110
116
 
111
117
  )
@@ -325,5 +331,5 @@ echo.# Using default node name ^(fqdn^)
325
331
 
326
332
  @echo Starting chef to bootstrap the node...
327
333
  SET "PATH=%PATH%;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin"
328
- chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json -E _default
334
+ chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json
329
335
 
@@ -104,8 +104,14 @@ echo. [String] $remoteUrl,
104
104
  echo. [String] $localPath
105
105
  echo.^)
106
106
  echo.
107
+ echo.$ProxyUrl = $env:http_proxy;
107
108
  echo.$webClient = new-object System.Net.WebClient;
108
109
  echo.
110
+ echo.if ^($ProxyUrl -ne ''^) {
111
+ echo. $WebProxy = New-Object System.Net.WebProxy^($ProxyUrl,$true^)
112
+ echo. $WebClient.Proxy = $WebProxy
113
+ echo.}
114
+ echo.
109
115
  echo.$webClient.DownloadFile^($remoteUrl, $localPath^);
110
116
 
111
117
  )