knife-windows 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -1
- data/README.md +5 -1
- data/appveyor.yml +2 -2
- data/knife-windows.gemspec +1 -0
- data/lib/chef/knife/winrm_base.rb +5 -0
- data/lib/chef/knife/winrm_knife_base.rb +2 -1
- data/lib/chef/knife/winrm_session.rb +3 -2
- data/lib/knife-windows/version.rb +1 -1
- data/spec/unit/knife/winrm_session_spec.rb +24 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5625bfb426520967ee2d9b753db05b7b6ddda38f
|
4
|
+
data.tar.gz: cef98f088ca495ebcae6933d16cf804301ec6259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76723402071d410413a8df53644db66d177c99490597271769be060eed66df819c591da80c67af08a74c5d755f7d3ff39ae13103259b668c3bc3b380721c653a
|
7
|
+
data.tar.gz: 576edbb29512e8b7d79c592c9af8ecb59b75215df4c18595d54d39c34c77b9828519253d8cc16042fb050cb213bf13128d386de1834a3a7e34f396c51e8705da
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# knife-windows Change Log
|
2
2
|
|
3
|
+
## Release 1.7.0
|
4
|
+
|
5
|
+
* [knife-windows #400](https://github.com/chef/knife-windows/pull/400) Allow a custom codepage to be specified and passed to the cmd shell
|
6
|
+
|
3
7
|
## Release 1.6.0
|
4
8
|
|
5
9
|
* [knife-windows #393](https://github.com/chef/knife-windows/pull/393) Add documentation of the --msi-url option
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -17,7 +17,7 @@ This plugin provides the following Knife subcommands. Specific command options c
|
|
17
17
|
|
18
18
|
### knife winrm
|
19
19
|
|
20
|
-
The `winrm` subcommand allows you to invoke commands in parallel on a subset of the nodes in your infrastructure. The `winrm` subcommand uses the same syntax as the [search subcommand](https://docs.chef.io/knife_search.html); you could
|
20
|
+
The `winrm` subcommand allows you to invoke commands in parallel on a subset of the nodes in your infrastructure. The `winrm` subcommand uses the same syntax as the [search subcommand](https://docs.chef.io/knife_search.html); you could find the uptime of all your web servers using the command:
|
21
21
|
|
22
22
|
knife winrm "role:web" "net stats srv" -x Administrator -P 'super_secret_password'
|
23
23
|
|
@@ -217,6 +217,10 @@ of these authentication transports are outside of the scope of this
|
|
217
217
|
README but details can be found on the
|
218
218
|
[WinRM configuration guide](http://msdn.microsoft.com/en-us/library/aa384372\(v=vs.85\).aspx).
|
219
219
|
|
220
|
+
### Working with legacy Windows versions
|
221
|
+
|
222
|
+
If you are attempting to use `knife winrm` or `knife bootstrap windows winrm` with a version of windows that is older than server 2008 R2 or older than Windows 7 then you may need to alter the default UTF-8 codepage (65001) using the `--winrm-codepage` argument. You can use the codepage native to your locale but `437` is a safe codepage for older Windows versions.
|
223
|
+
|
220
224
|
#### Configure SSL on a Windows node
|
221
225
|
|
222
226
|
WinRM supports use of SSL to provide privacy and integrity of
|
data/appveyor.yml
CHANGED
@@ -11,10 +11,10 @@ environment:
|
|
11
11
|
- ruby_version: "20"
|
12
12
|
chef_version: "< 12"
|
13
13
|
|
14
|
-
- ruby_version: "
|
14
|
+
- ruby_version: "23"
|
15
15
|
chef_version: "~> 12.0"
|
16
16
|
|
17
|
-
- ruby_version: "
|
17
|
+
- ruby_version: "23"
|
18
18
|
chef_version: "master"
|
19
19
|
|
20
20
|
clone_folder: c:\projects\knife-windows
|
data/knife-windows.gemspec
CHANGED
@@ -116,6 +116,11 @@ class Chef
|
|
116
116
|
:long => "--session-timeout Minutes",
|
117
117
|
:description => "The timeout for the client for the maximum length of the WinRM session",
|
118
118
|
:default => 30
|
119
|
+
|
120
|
+
option :winrm_codepage,
|
121
|
+
:long => "--winrm-codepage Codepage",
|
122
|
+
:description => "The codepage to use for the winrm cmd shell",
|
123
|
+
:default => 65001
|
119
124
|
end
|
120
125
|
end
|
121
126
|
end
|
@@ -202,7 +202,8 @@ class Chef
|
|
202
202
|
transport: resolve_winrm_transport,
|
203
203
|
no_ssl_peer_verification: resolve_no_ssl_peer_verification,
|
204
204
|
ssl_peer_fingerprint: resolve_ssl_peer_fingerprint,
|
205
|
-
shell: locate_config_value(:winrm_shell)
|
205
|
+
shell: locate_config_value(:winrm_shell),
|
206
|
+
codepage: locate_config_value(:winrm_codepage)
|
206
207
|
}
|
207
208
|
|
208
209
|
if @session_opts[:user] and (not @session_opts[:password])
|
@@ -31,7 +31,8 @@ class Chef
|
|
31
31
|
@host = options[:host]
|
32
32
|
@port = options[:port]
|
33
33
|
@user = options[:user]
|
34
|
-
@
|
34
|
+
@shell_args = [ options[:shell] ]
|
35
|
+
@shell_args << { codepage: options[:codepage] } if options[:shell] == :cmd
|
35
36
|
url = "#{options[:host]}:#{options[:port]}/wsman"
|
36
37
|
scheme = options[:transport] == :ssl ? 'https' : 'http'
|
37
38
|
@endpoint = "#{scheme}://#{url}"
|
@@ -63,7 +64,7 @@ class Chef
|
|
63
64
|
|
64
65
|
def relay_command(command)
|
65
66
|
session_result = WinRM::Output.new
|
66
|
-
@winrm_session.shell(
|
67
|
+
@winrm_session.shell(*@shell_args) do |shell|
|
67
68
|
shell.username = @user.split("\\").last if shell.respond_to?(:username)
|
68
69
|
session_result = shell.run(command) do |stdout, stderr|
|
69
70
|
print_data(@host, stdout) if stdout
|
@@ -67,5 +67,29 @@ describe Chef::Knife::WinrmSession do
|
|
67
67
|
expect(winrm_connection).to receive(:shell)
|
68
68
|
subject.relay_command("cmd.exe echo 'hi'")
|
69
69
|
end
|
70
|
+
|
71
|
+
context "cmd shell" do
|
72
|
+
before do
|
73
|
+
options[:shell] = :cmd
|
74
|
+
options[:codepage] = 65001
|
75
|
+
end
|
76
|
+
|
77
|
+
it "creates shell and sends codepage" do
|
78
|
+
expect(winrm_connection).to receive(:shell).with(:cmd, hash_including(codepage: 65001))
|
79
|
+
subject.relay_command("cmd.exe echo 'hi'")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "powershell shell" do
|
84
|
+
before do
|
85
|
+
options[:shell] = :powershell
|
86
|
+
options[:codepage] = 65001
|
87
|
+
end
|
88
|
+
|
89
|
+
it "does not send codepage to shell" do
|
90
|
+
expect(winrm_connection).to receive(:shell).with(:powershell)
|
91
|
+
subject.relay_command("cmd.exe echo 'hi'")
|
92
|
+
end
|
93
|
+
end
|
70
94
|
end
|
71
95
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-windows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.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: 2016-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: winrm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: winrm-elevated
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|