knife-windows 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/knife-windows.gemspec +1 -1
- data/lib/chef/knife/winrm.rb +18 -13
- data/lib/knife-windows/version.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -32,7 +32,7 @@ Or force a chef run:
|
|
32
32
|
ec2-50-xx-xx-124.compute-1.amazonaws.com [Fri, 04 Mar 2011 22:00:53 +0000] INFO: Running report handlers
|
33
33
|
ec2-50-xx-xx-124.compute-1.amazonaws.com [Fri, 04 Mar 2011 22:00:53 +0000] INFO: Report handlers complete
|
34
34
|
|
35
|
-
This subcommand operates in a very similar manner as {knife ssh}[http://wiki.opscode.com/display/chef/Knife#Knife-SSHSubcommand]...just leveraging the WinRM protocol for communication.
|
35
|
+
This subcommand operates in a very similar manner as {knife ssh}[http://wiki.opscode.com/display/chef/Knife#Knife-SSHSubcommand]...just leveraging the WinRM protocol for communication. It also include's +knife+ +ssh+'s "{interactive session mode}[http://wiki.opscode.com/display/chef/Knife#Knife-InteractiveMode]"
|
36
36
|
|
37
37
|
== knife winrm bootstrap
|
38
38
|
|
data/knife-windows.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.required_ruby_version = '>= 1.9.1'
|
18
18
|
s.add_dependency "chef", ">= 0.9.12"
|
19
|
-
s.add_dependency "em-winrm", ">= 0.0.
|
19
|
+
s.add_dependency "em-winrm", ">= 0.0.3"
|
20
20
|
|
21
21
|
s.files = `git ls-files`.split("\n")
|
22
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/chef/knife/winrm.rb
CHANGED
@@ -102,7 +102,21 @@ class Chef
|
|
102
102
|
def session
|
103
103
|
session_opts = {}
|
104
104
|
session_opts[:logger] = Chef::Log.logger if Chef::Log.level == :debug
|
105
|
-
@session ||=
|
105
|
+
@session ||= begin
|
106
|
+
s = EventMachine::WinRM::Session.new(session_opts)
|
107
|
+
s.on_output do |host, data|
|
108
|
+
print_data(host, data)
|
109
|
+
end
|
110
|
+
s.on_error do |host, err|
|
111
|
+
print_data(host, err, :red)
|
112
|
+
end
|
113
|
+
s.on_command_complete do |host|
|
114
|
+
host = host == :all ? 'All Servers' : host
|
115
|
+
Chef::Log.debug("command complete on #{host}")
|
116
|
+
end
|
117
|
+
s
|
118
|
+
end
|
119
|
+
|
106
120
|
end
|
107
121
|
|
108
122
|
def h
|
@@ -166,17 +180,6 @@ class Chef
|
|
166
180
|
|
167
181
|
def winrm_command(command, subsession=nil)
|
168
182
|
subsession ||= session
|
169
|
-
|
170
|
-
subsession.on_output do |host, data|
|
171
|
-
print_data(host, data)
|
172
|
-
end
|
173
|
-
subsession.on_error do |host, err|
|
174
|
-
print_data(host, err, :red)
|
175
|
-
end
|
176
|
-
subsession.on_finish do |host|
|
177
|
-
host = host == :done ? 'All Servers' : host
|
178
|
-
Chef::Log.debug("command complete on #{host}")
|
179
|
-
end
|
180
183
|
subsession.relay_command(command)
|
181
184
|
end
|
182
185
|
|
@@ -210,7 +213,7 @@ class Chef
|
|
210
213
|
end
|
211
214
|
|
212
215
|
def interactive
|
213
|
-
puts "Connected to #{h.list(session.
|
216
|
+
puts "Connected to #{h.list(session.servers.collect { |s| h.color(s.host, :cyan) }, :inline, " and ")}"
|
214
217
|
puts
|
215
218
|
puts "To run a command on a list of servers, do:"
|
216
219
|
puts " on SERVER1 SERVER2 SERVER3; COMMAND"
|
@@ -223,6 +226,7 @@ class Chef
|
|
223
226
|
case command
|
224
227
|
when 'quit!'
|
225
228
|
puts 'Bye!'
|
229
|
+
session.close
|
226
230
|
break
|
227
231
|
when /^on (.+?); (.+)$/
|
228
232
|
raw_list = $1.split(" ")
|
@@ -249,6 +253,7 @@ class Chef
|
|
249
253
|
interactive
|
250
254
|
else
|
251
255
|
winrm_command(@name_args[1..-1].join(" "))
|
256
|
+
session.close
|
252
257
|
end
|
253
258
|
end
|
254
259
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: knife-windows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Seth Chisamore
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.0.
|
35
|
+
version: 0.0.3
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
38
|
description: Plugin that adds functionality to Chef's Knife CLI for configuring/interacting with nodes running Microsoft Windows
|