em-winrm 0.5.5 → 0.6.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile +4 -4
- data/LICENSE +200 -200
- data/README.rdoc +158 -158
- data/Rakefile +2 -2
- data/em-winrm.gemspec +27 -27
- data/lib/em-winrm.rb +38 -38
- data/lib/em-winrm/server.rb +88 -88
- data/lib/em-winrm/session.rb +156 -156
- data/lib/em-winrm/shell.rb +83 -83
- data/lib/em-winrm/version.rb +24 -24
- metadata +10 -19
data/lib/em-winrm/shell.rb
CHANGED
@@ -1,83 +1,83 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011 Seth Chisamore
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
module EventMachine
|
20
|
-
module WinRM
|
21
|
-
class Shell
|
22
|
-
include EM::Deferrable
|
23
|
-
|
24
|
-
attr_accessor :client, :server, :remote_id
|
25
|
-
|
26
|
-
def initialize(client, server)
|
27
|
-
@client = client
|
28
|
-
@server = server
|
29
|
-
@remote_id = client.open_shell
|
30
|
-
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_open")
|
31
|
-
@out_channel = EM::Channel.new
|
32
|
-
@err_channel = EM::Channel.new
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# called whenever the shell has output
|
37
|
-
#
|
38
|
-
def on_output(&block)
|
39
|
-
@out_channel.subscribe block
|
40
|
-
end
|
41
|
-
|
42
|
-
#
|
43
|
-
# called whenever the shell has error output
|
44
|
-
#
|
45
|
-
def on_error(&block)
|
46
|
-
@err_channel.subscribe block
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
# called whenever the shell is closed
|
51
|
-
#
|
52
|
-
def on_close(&block)
|
53
|
-
@on_close = block
|
54
|
-
end
|
55
|
-
|
56
|
-
#
|
57
|
-
# Open a shell and run a comamnd
|
58
|
-
#
|
59
|
-
def run_command(command)
|
60
|
-
command_id = client.run_command(@remote_id, command)
|
61
|
-
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :run_command[#{command}]")
|
62
|
-
output=client.get_command_output(@remote_id, command_id) do |out,error|
|
63
|
-
@out_channel.push(out) if out
|
64
|
-
@err_channel.push(error) if error
|
65
|
-
end
|
66
|
-
client.cleanup_command(@remote_id, command_id)
|
67
|
-
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :command_cleanup[#{command}]")
|
68
|
-
@last_exit_code = output[:exitcode]
|
69
|
-
close
|
70
|
-
output[:exitcode]
|
71
|
-
end
|
72
|
-
|
73
|
-
#
|
74
|
-
# Close and cleanup a shell
|
75
|
-
#
|
76
|
-
def close
|
77
|
-
r = client.close_shell(@remote_id)
|
78
|
-
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_close")
|
79
|
-
@on_close.call(r,@last_exit_code) if @on_close
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
1
|
+
#
|
2
|
+
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011 Seth Chisamore
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
module EventMachine
|
20
|
+
module WinRM
|
21
|
+
class Shell
|
22
|
+
include EM::Deferrable
|
23
|
+
|
24
|
+
attr_accessor :client, :server, :remote_id
|
25
|
+
|
26
|
+
def initialize(client, server)
|
27
|
+
@client = client
|
28
|
+
@server = server
|
29
|
+
@remote_id = client.open_shell
|
30
|
+
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_open")
|
31
|
+
@out_channel = EM::Channel.new
|
32
|
+
@err_channel = EM::Channel.new
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# called whenever the shell has output
|
37
|
+
#
|
38
|
+
def on_output(&block)
|
39
|
+
@out_channel.subscribe block
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# called whenever the shell has error output
|
44
|
+
#
|
45
|
+
def on_error(&block)
|
46
|
+
@err_channel.subscribe block
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# called whenever the shell is closed
|
51
|
+
#
|
52
|
+
def on_close(&block)
|
53
|
+
@on_close = block
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Open a shell and run a comamnd
|
58
|
+
#
|
59
|
+
def run_command(command)
|
60
|
+
command_id = client.run_command(@remote_id, command)
|
61
|
+
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :run_command[#{command}]")
|
62
|
+
output=client.get_command_output(@remote_id, command_id) do |out,error|
|
63
|
+
@out_channel.push(out) if out
|
64
|
+
@err_channel.push(error) if error
|
65
|
+
end
|
66
|
+
client.cleanup_command(@remote_id, command_id)
|
67
|
+
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :command_cleanup[#{command}]")
|
68
|
+
@last_exit_code = output[:exitcode]
|
69
|
+
close
|
70
|
+
output[:exitcode]
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# Close and cleanup a shell
|
75
|
+
#
|
76
|
+
def close
|
77
|
+
r = client.close_shell(@remote_id)
|
78
|
+
WinRM::Log.debug("#{server.host}[#{@remote_id}] => :shell_close")
|
79
|
+
@on_close.call(r,@last_exit_code) if @on_close
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/em-winrm/version.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2011 Seth Chisamore
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
module EventMachine
|
20
|
-
module WinRM
|
21
|
-
VERSION = "0.
|
22
|
-
MAJOR, MINOR, TINY = VERSION.split('.')
|
23
|
-
end
|
24
|
-
end
|
1
|
+
#
|
2
|
+
# Author:: Seth Chisamore (<schisamo@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011 Seth Chisamore
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
module EventMachine
|
20
|
+
module WinRM
|
21
|
+
VERSION = "0.6.0.rc.0"
|
22
|
+
MAJOR, MINOR, TINY = VERSION.split('.')
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-winrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.0.rc.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Seth Chisamore
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: eventmachine
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,23 +27,20 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: winrm
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
40
|
+
version: 1.2.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: mixlib-log
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: uuidtools
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -85,6 +76,7 @@ extra_rdoc_files:
|
|
85
76
|
- LICENSE
|
86
77
|
files:
|
87
78
|
- .gitignore
|
79
|
+
- CHANGELOG.md
|
88
80
|
- Gemfile
|
89
81
|
- LICENSE
|
90
82
|
- README.rdoc
|
@@ -97,27 +89,26 @@ files:
|
|
97
89
|
- lib/em-winrm/version.rb
|
98
90
|
homepage: http://github.com/schisamo/em-winrm
|
99
91
|
licenses: []
|
92
|
+
metadata: {}
|
100
93
|
post_install_message:
|
101
94
|
rdoc_options: []
|
102
95
|
require_paths:
|
103
96
|
- lib
|
104
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
98
|
requirements:
|
107
99
|
- - ! '>='
|
108
100
|
- !ruby/object:Gem::Version
|
109
101
|
version: 1.9.1
|
110
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
103
|
requirements:
|
113
|
-
- - ! '
|
104
|
+
- - ! '>'
|
114
105
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
106
|
+
version: 1.3.1
|
116
107
|
requirements: []
|
117
108
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.
|
109
|
+
rubygems_version: 2.1.11
|
119
110
|
signing_key:
|
120
|
-
specification_version:
|
111
|
+
specification_version: 4
|
121
112
|
summary: EventMachine based, asynchronous parallel WinRM client
|
122
113
|
test_files: []
|
123
114
|
has_rdoc: true
|