knife-windows 0.8.3 → 0.8.4.rc.0

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: 76abe8c93575af58e3d472671533917f41eff4be
4
- data.tar.gz: f5a2255af0c8c68c36b6a42e370401f496650a76
3
+ metadata.gz: bda9f8a781d7517b19471617994e0a99a645aabe
4
+ data.tar.gz: 7043f0be06bbd01a3ca2b552f0426e2a0d6ba9d2
5
5
  SHA512:
6
- metadata.gz: 7fdeeb529f3aca5e57e56b3f89421547ebe12a1b26e0d529caf23f6d038619136430d62ee8d0782bbb8589010af72b7a0813332e12422d8f53ccc4d87a2050f7
7
- data.tar.gz: 5320a7db65675d48e115c8d21add1e1f82d598b7c1c4e8201775a271cdf9c3c4b605c114ad884209435e3c1b203a8c0143e9fa1b61b38f243c61bc4e46570e70
6
+ metadata.gz: 77a2c6f152d91f98865b8f4a026aba720f8a957aa4126547e78507cb739e40b8daf4d1bfea23d030e5c8d09fabe234505767113f086efe896f315c6ecd0ac88b
7
+ data.tar.gz: f19532056eff8f30562d1cc0b8561bb197c4d6dcacbd2426ccbcfc4c6cb21870259fd834902c431ded1b33e793cd5d2f1cfb19febe032a26e240f6e554674372
data/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # knife-windows Change Log
2
2
 
3
- ## Unreleased changes
4
- None.
3
+ ## Latest release: 0.8.4
4
+ * [knife-windows #133](https://github.com/opscode/knife-windows/issues/133) Bootstrap failure -- unable to validate SSL chef server endpoints
5
5
 
6
- ## Latest release: 0.8.3
6
+ ## Release: 0.8.3
7
7
  * [knife-windows #131](https://github.com/opscode/knife-windows/issues/108): Windows should be bootstrapped using latest Chef Client version compatible with knife's version just like non-Windows systems
8
8
  * [knife-windows #162](https://github.com/chef/knife-windows/issues/162): fixes "uninitialized constant Chef::Knife::Bootstrap (NameError)"
9
9
 
@@ -198,6 +198,11 @@ echo Validation key written.
198
198
  )
199
199
  <% end -%>
200
200
 
201
+ <% unless trusted_certs.empty? -%>
202
+ mkdir -p C:/chef/trusted_certs
203
+ <%= trusted_certs %>
204
+ <% end -%>
205
+
201
206
  <%# Generate Ohai Hints -%>
202
207
  <% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
203
208
  mkdir <%= bootstrap_directory %>\ohai\hints
@@ -44,6 +44,10 @@ class Chef
44
44
  escape_and_echo(@config[:encrypted_data_bag_secret])
45
45
  end
46
46
 
47
+ def trusted_certs
48
+ @trusted_certs ||= trusted_certs_content
49
+ end
50
+
47
51
  def config_content
48
52
  client_rb = <<-CONFIG
49
53
  log_level :info
@@ -65,6 +69,36 @@ CONFIG
65
69
  client_rb << "# Using default node name (fqdn)\n"
66
70
  end
67
71
 
72
+ # We configure :verify_api_cert only when it's overridden on the CLI
73
+ # or when specified in the knife config.
74
+ if !@config[:node_verify_api_cert].nil? || knife_config.has_key?(:verify_api_cert)
75
+ value = @config[:node_verify_api_cert].nil? ? knife_config[:verify_api_cert] : @config[:node_verify_api_cert]
76
+ client_rb << %Q{verify_api_cert #{value}\n}
77
+ end
78
+
79
+ # We configure :ssl_verify_mode only when it's overridden on the CLI
80
+ # or when specified in the knife config.
81
+ if @config[:node_ssl_verify_mode] || knife_config.has_key?(:ssl_verify_mode)
82
+ value = case @config[:node_ssl_verify_mode]
83
+ when "peer"
84
+ :verify_peer
85
+ when "none"
86
+ :verify_none
87
+ when nil
88
+ knife_config[:ssl_verify_mode]
89
+ else
90
+ nil
91
+ end
92
+
93
+ if value
94
+ client_rb << %Q{ssl_verify_mode :#{value}\n}
95
+ end
96
+ end
97
+
98
+ if @config[:ssl_verify_mode]
99
+ client_rb << %Q{ssl_verify_mode :#{knife_config[:ssl_verify_mode]}\n}
100
+ end
101
+
68
102
  if knife_config[:bootstrap_proxy]
69
103
  client_rb << "\n"
70
104
  client_rb << %Q{http_proxy "#{knife_config[:bootstrap_proxy]}"\n}
@@ -72,10 +106,18 @@ CONFIG
72
106
  client_rb << %Q{no_proxy "#{knife_config[:bootstrap_no_proxy]}"\n} if knife_config[:bootstrap_no_proxy]
73
107
  end
74
108
 
109
+ if knife_config[:bootstrap_no_proxy]
110
+ client_rb << %Q{no_proxy "#{knife_config[:bootstrap_no_proxy]}"\n}
111
+ end
112
+
75
113
  if @config[:encrypted_data_bag_secret]
76
114
  client_rb << %Q{encrypted_data_bag_secret "c:/chef/encrypted_data_bag_secret"\n}
77
115
  end
78
116
 
117
+ unless trusted_certs.empty?
118
+ client_rb << %Q{trusted_certs_dir "C:/chef/trusted_certs"\n}
119
+ end
120
+
79
121
  escape_and_echo(client_rb)
80
122
  end
81
123
 
@@ -202,6 +244,17 @@ WGET_PS
202
244
  "msiexec /qn /log #{executor_quote}%CHEF_CLIENT_MSI_LOG_PATH%#{executor_quote} /i #{executor_quote}%LOCAL_DESTINATION_MSI_PATH%#{executor_quote}"
203
245
  end
204
246
 
247
+ def trusted_certs_content
248
+ content = ""
249
+ if @chef_config[:trusted_certs_dir]
250
+ Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(@chef_config[:trusted_certs_dir]), "*.{crt,pem}")).each do |cert|
251
+ content << "cat > /C:/chef/trusted_certs/#{File.basename(cert)} <<'EOP'\n" +
252
+ IO.read(File.expand_path(cert)) + "\nEOP\n"
253
+ end
254
+ end
255
+ content
256
+ end
257
+
205
258
  def fallback_install_task_command
206
259
  # This command will be executed by schtasks.exe in the batch
207
260
  # code below. To handle tasks that contain arguments that
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Windows
3
- VERSION = "0.8.3"
3
+ VERSION = "0.8.4.rc.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -69,7 +69,8 @@ describe Chef::Knife::BootstrapWindowsWinrm do
69
69
  knife.instance_variable_set("@template_file", template_file)
70
70
  knife.parse_options(options)
71
71
  # Avoid referencing a validation keyfile we won't find during #render_template
72
- template_string = knife.read_template.gsub(/^.*[Vv]alidation_key.*$/, '')
72
+ template = IO.read(template_file).chomp
73
+ template_string = template.gsub(/^.*[Vv]alidation_key.*$/, '')
73
74
  knife.render_template(template_string)
74
75
  end
75
76
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-windows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4.rc.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: winrm-s
@@ -103,9 +103,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  version: 1.9.1
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - '>'
107
107
  - !ruby/object:Gem::Version
108
- version: '0'
108
+ version: 1.3.1
109
109
  requirements: []
110
110
  rubyforge_project:
111
111
  rubygems_version: 2.4.1