net-ssh-telnet 0.2.0 → 0.2.1

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: 00bb9ece1f4ba5a748bc3c1c7f6a65f386c76543
4
- data.tar.gz: 9af12f0b2318c4e1123ead13004f7223974bb9ce
3
+ metadata.gz: 29d0a1186cd6ea45319c2afbdab046530200851d
4
+ data.tar.gz: 8e2f7f9c996225aefc02c6bcaf3738c693ebc08f
5
5
  SHA512:
6
- metadata.gz: 1d6d0b0c1a9b38d5f96f0f89d4b556c69621a768629625dc3e70c7709a75819fdd480b218a9db10c2a3f53cac5a33152e4d002494a996431aec0a45edd707baf
7
- data.tar.gz: e148e3bae70620f0413b1cab661a1b35473c8bed1e596ae5f32b92bac142bc30b8735477f49f7dbd1ccc6117e22c30433e76e1f549100f79ac7e4b7a669c6b76
6
+ metadata.gz: ac0df2b1f5d6a5a7e2b64d5d401300aa97e6c5f6b563487ced4a1fdc2b62d04a725020ecce65c91fbe573ae5bd6a7c88e2dda5a355a54a8d5ebef5d2d6521e25
7
+ data.tar.gz: f73a34decc609c1c853a36c6ff322e5d3c055ddfb44386fc882bd8689ad0ddbf10323e89d1d68af6ebd8a3e5d85081c5d0a3b26fe2290f15e6557ad7e32a5eba
@@ -1,15 +1,19 @@
1
- === 0.2.0 / 2017-01-16
1
+ ### 0.2.1 / 2017-10-08
2
+ * Add compatibility for net-ssh v4.2 (patch from haccht)
3
+ * Add PTYOptions option (patch from Ben Miller)
4
+
5
+ ### 0.2.0 / 2017-01-16
2
6
  * Add option to change prompt after initialization
3
7
  * Cleanup requires for gemspec
4
8
 
5
- === 0.1.1 / 2016-05-06
9
+ ### 0.1.1 / 2016-05-06
6
10
  * Apply fix to race condition during initialization from lumean
7
11
 
8
- === 0.1.0 / 2016-02-09
12
+ ### 0.1.0 / 2016-02-09
9
13
  * Fixed 'Timeout' and 'Waittime' options
10
14
  * Fork to net-ssh-telnet2
11
15
 
12
- === 0.0.2 / 2009-03-15
16
+ ### 0.0.2 / 2009-03-15
13
17
 
14
18
  * 4 bugfixes from Brian Candler
15
19
  * Bug in original Net::Telnet EOL translation
@@ -19,7 +23,7 @@
19
23
  * Handle EOF more gracefully.
20
24
  * Allow FailEOF to propagate through cmd() to waitfor().
21
25
 
22
- === 0.0.1 / 2008-06-06
26
+ ### 0.0.1 / 2008-06-06
23
27
 
24
28
  * 1 major enhancement
25
29
  * Birthday!
@@ -1,32 +1,32 @@
1
- = net-ssh-telnet
1
+ # net-ssh-telnet
2
2
 
3
3
  * https://github.com/duke-automation/net-ssh-telnet
4
4
  * mailto:sean@duke.edu
5
5
 
6
- == DESCRIPTION:
6
+ ## DESCRIPTION
7
7
 
8
8
  A ruby module to provide a simple send/expect interface over SSH with an API
9
9
  almost identical to Net::Telnet. Ideally it should be a drop in replacement.
10
10
 
11
11
  Please see Net::Telnet for main documentation (included with ruby stdlib).
12
12
 
13
- == FEATURES/PROBLEMS:
13
+ ## FEATURES/PROBLEMS
14
14
 
15
15
  * FIX (list of features or problems)
16
16
 
17
- == SYNOPSIS:
17
+ ## SYNOPSIS
18
18
 
19
19
  FIX (code sample of usage)
20
20
 
21
- == REQUIREMENTS:
21
+ ## REQUIREMENTS
22
22
 
23
23
  * net-ssh >= 2.0.1
24
24
 
25
- == INSTALL:
25
+ ## INSTALL
26
26
 
27
27
  * sudo gem install net-ssh-telnet
28
28
 
29
- == LICENSE:
29
+ ## LICENSE
30
30
 
31
31
  (The MIT License)
32
32
 
@@ -144,15 +144,16 @@ module SSH
144
144
  # * <tt>"Host"</tt> - a string to define the hostname to connect to(Default: "localhost")
145
145
  # * <tt>"Port"</tt> - port number to connect to(Default: 22)
146
146
  # * <tt>"Prompt"</tt> - a regular expression to define the the prompt to expect(Default: /[$%#>] \z/n )
147
- # * <tt>"Timeout"</tt> - the time out value passed on to Net::Ssh - also the default value for #waitfor(Default: 10)
147
+ # * <tt>"Timeout"</tt> - the time out value passed on to Net::SSH - also the default value for #waitfor(Default: 10)
148
148
  # * <tt>"Waittime"</tt> - Max time to wait after a possible prompt it seen to make sure more data isn't coming(Default: 0)
149
149
  # * <tt>"Terminator"</tt> - This value is appended to all strings that are sent to #print.(Default: LF)
150
150
  # * <tt>"Binmode"</tt> - Enable binary mode.(Default: false)
151
151
  # * <tt>"Output_log"</tt> - A file name to open as an output log.
152
152
  # * <tt>"Dump_log"</tt> - A file name to open to dump the entire session to.
153
- # * <tt>"Session"</tt> - An existing Net::Ssh object for Net::Ssh::Telnet to use as its connection(See example 1)
153
+ # * <tt>"Session"</tt> - An existing Net::SSH object for Net::SSH::Telnet to use as its connection(See example 1)
154
154
  # * <tt>"Proxy"</tt> - An open IO object to use as a Proxy(See example 3)
155
- # * <tt>"Factory"</tt> - A connection factory to use to establish the connection. Net::Ssh::Telnet will call #open(host, post) on this object.(See example 4)
155
+ # * <tt>"Factory"</tt> - A connection factory to use to establish the connection. Net::SSH::Telnet will call #open(host, post) on this object.(See example 4)
156
+ # * <tt>"PTYOptions"</tt> - A hash to be passed to Net::SSH::Connection::Channel#request_pty. See Net::SSH::Connection::Channel::VALID_PTY_OPTIONS for valid options.
156
157
  #
157
158
  def initialize(options, &blk) # :yield: mesg
158
159
  @options = options
@@ -162,6 +163,7 @@ module SSH
162
163
  @options["Timeout"] = 10 unless @options.has_key?("Timeout")
163
164
  @options["Waittime"] = 0 unless @options.has_key?("Waittime")
164
165
  @options["Terminator"] = LF unless @options.has_key?("Terminator")
166
+ @options["PTYOptions"] = {} unless @options.has_key?("PTYOptions")
165
167
 
166
168
  unless @options.has_key?("Binmode")
167
169
  @options["Binmode"] = false
@@ -208,14 +210,15 @@ module SSH
208
210
  @ssh = @options["Session"]
209
211
  @close_all = false
210
212
  elsif @options.has_key?("Proxy")
211
- @ssh = Net::SSH.start(nil, nil,
212
- :host_name => @options["Host"], # ignored
213
- :port => @options["Port"], # ignored
214
- :user => @options["Username"],
215
- :password => @options["Password"],
216
- :timeout => @options["Timeout"],
217
- :proxy => TinyFactory.new(@options["Proxy"])
218
- )
213
+ opts = {
214
+ :host_name => @options["Host"], # ignored
215
+ :port => @options["Port"], # ignored
216
+ :user => @options["Username"],
217
+ :password => @options["Password"],
218
+ :timeout => @options["Timeout"],
219
+ :proxy => TinyFactory.new(@options["Proxy"])
220
+ }.delete_if { |_,v| v.nil? }
221
+ @ssh = Net::SSH.start(nil, nil, opts)
219
222
  @close_all = true
220
223
  else
221
224
  message = "Trying " + @options["Host"] + "...\n"
@@ -224,14 +227,15 @@ module SSH
224
227
  @dumplog.log_dump('#', message) if @options.has_key?("Dump_log")
225
228
 
226
229
  begin
227
- @ssh = Net::SSH.start(nil, nil,
228
- :host_name => @options["Host"],
229
- :port => @options["Port"],
230
- :user => @options["Username"],
231
- :password => @options["Password"],
232
- :timeout => @options["Timeout"],
233
- :proxy => @options["Factory"]
234
- )
230
+ opts = {
231
+ :host_name => @options["Host"],
232
+ :port => @options["Port"],
233
+ :user => @options["Username"],
234
+ :password => @options["Password"],
235
+ :timeout => @options["Timeout"],
236
+ :proxy => @options["Factory"]
237
+ }.delete_if { |_,v| v.nil? }
238
+ @ssh = Net::SSH.start(nil, nil, opts)
235
239
  @close_all = true
236
240
  rescue TimeoutError
237
241
  raise TimeoutError, "timed out while opening a connection to the host"
@@ -254,7 +258,7 @@ module SSH
254
258
  channel.on_data { |ch,data| @buf << data }
255
259
  channel.on_extended_data { |ch,type,data| @buf << data if type == 1 }
256
260
  channel.on_close { @eof = true }
257
- channel.request_pty { |ch,success|
261
+ channel.request_pty(@options["PTYOptions"]) { |ch,success|
258
262
  if success == false
259
263
  raise "Failed to open ssh pty"
260
264
  end
@@ -1,7 +1,7 @@
1
1
  module Net
2
2
  module SSH
3
3
  class Telnet
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
6
6
  end
7
7
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.require_paths = ["lib"]
18
- spec.extra_rdoc_files = ['README.txt', 'History.txt']
18
+ spec.extra_rdoc_files = ['README.md', 'History.md']
19
19
 
20
20
  spec.add_runtime_dependency 'net-ssh', '>= 2.0.1'
21
21
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh-telnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Dilda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -46,14 +46,14 @@ email:
46
46
  executables: []
47
47
  extensions: []
48
48
  extra_rdoc_files:
49
- - README.txt
50
- - History.txt
49
+ - README.md
50
+ - History.md
51
51
  files:
52
52
  - ".gitignore"
53
53
  - ".yardopts"
54
54
  - Gemfile
55
- - History.txt
56
- - README.txt
55
+ - History.md
56
+ - README.md
57
57
  - Rakefile
58
58
  - Todo.txt
59
59
  - examples/detailed_debug.rb
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 2.5.1
87
+ rubygems_version: 2.6.13
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Provides Net::Telnet API for SSH connections