woolen_common 0.0.9 → 0.0.10

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: 799baa9abff2065c04e70662e90a9a1754a165e2
4
- data.tar.gz: 754d6aa29d5474ecb45bff416e28f9d4b89ca7cc
3
+ metadata.gz: 4070f2c35867c4802790bd9bf6baa522b8c527d1
4
+ data.tar.gz: b55fc9b5d9e9db649c4b8bcab4262542f5436e60
5
5
  SHA512:
6
- metadata.gz: fd5dc49d77bf3793409e4b1b6d22fb3f542de6ed8d36e787e3c69526b84063fa25a35ba724188c5f320e0ac495ac059626e1f8f0eac993d26874a6edf38bfd35
7
- data.tar.gz: 7f91800811ca360e4ecf93b3de2a81cf09d6da77e505030854d6908828a9df3063d509ee52c3fd76c47d7a68feb9f101f0f12ddc0503a45ae430b0c4cf833a10
6
+ metadata.gz: 8a52c69f86f8633486443abc869f9da09170321f9beaa09b25ad2693a4fcf0ec7113f2ff5f6de8b72e3f083c339d7a6ddaf2bb60524a4cbf790d402a98fa911a
7
+ data.tar.gz: 6a4ef906ea35ce4d4efa9635d34aee38caee639beb67f5ad9ee7cf7cfae9539425d4f19e4e2346350d0b5b991f5195befb20cff97bf0f6f2ee0f52453964dac2
@@ -10,18 +10,19 @@ begin
10
10
 
11
11
  class << self
12
12
  attr_accessor :the_ssh_instances
13
+
13
14
  def get_ssh_proxy(ip, user, password, port=22, max_ssh=10, time_out=10)
14
15
  @the_ssh_instances ||= {}
15
16
  @the_ssh_instances[ip] ||= {}
16
17
  @the_ssh_instances[ip][port] ||= {}
17
18
  @the_ssh_instances[ip][port][user] ||= {}
18
- @the_ssh_instances[ip][port][user][password] ||= self.new(ip, user, password, port=22, max_ssh=10, time_out=10)
19
+ @the_ssh_instances[ip][port][user][password] ||= self.new(ip, user, password, port, max_ssh, time_out)
19
20
  @the_ssh_instances[ip][port][user][password]
20
21
  end
21
22
  end
22
23
 
23
24
  def initialize(ip, user, password, port=22, max_ssh=10, time_out=10)
24
- debug "ssh setup : [ user::#{user},password::#{password},port:#{port} ]"
25
+ debug "ssh setup : [ user::#{user},password::#{password},port:#{port}, time_out #{time_out} ]"
25
26
  @ip = ip
26
27
  @user = user
27
28
  @password = password
@@ -32,9 +33,9 @@ begin
32
33
  end
33
34
 
34
35
  def get_pool
35
- @ssh_connection_pool ||= ::WoolenCommon::ConnectionPool.new({:size => @max_ssh, :timeout => @time_out}) do
36
+ @ssh_connection_pool ||= ::WoolenCommon::ConnectionPool.new({ :size => @max_ssh, :timeout => @time_out }) do
36
37
  debug "ip:#{@ip},@password:#{@password},@port:#{@port}"
37
- ::WoolenCommon::SshProxy.new(@ip, @user, :password => @password, :port => @port,:proxy_conn_timeout => @time_out)
38
+ ::WoolenCommon::SshProxy.new(@ip, @user, :password => @password, :port => @port, :proxy_conn_timeout => @time_out)
38
39
  end
39
40
  end
40
41
 
@@ -57,8 +58,9 @@ begin
57
58
  class << self
58
59
 
59
60
  attr_accessor :the_ssh_instances
60
- def get_ssh_proxy(ip,port,user,passwd)
61
- options = {:port => port,:password => passwd}
61
+
62
+ def get_ssh_proxy(ip, port, user, passwd)
63
+ options = { :port => port, :password => passwd }
62
64
  @the_ssh_instances ||= {}
63
65
  @the_ssh_instances[ip] ||= {}
64
66
  @the_ssh_instances[ip][port] ||= {}
@@ -73,6 +75,7 @@ begin
73
75
  @user = user
74
76
  @options = options
75
77
  @conn_retry = options[:proxy_conn_retry] || 5
78
+ options[:paranoid] = false # for disable the public key verify
76
79
  options.delete :proxy_conn_retry if options[:proxy_conn_retry]
77
80
  # 超时时间设置30秒太长了,不是很合理,实际上5秒没有回复,那就是出问题了
78
81
  @conn_timeout = options[:proxy_conn_timeout] || 5
@@ -185,7 +188,7 @@ begin
185
188
  proxy_reset_conn
186
189
  end
187
190
  @ssh_conn.sftp.connect! do |sftp_session|
188
- return sftp_session.upload!(local_path,remote_path)
191
+ return sftp_session.upload!(local_path, remote_path)
189
192
  end
190
193
  end
191
194
 
@@ -195,7 +198,7 @@ begin
195
198
  proxy_reset_conn
196
199
  end
197
200
  @ssh_conn.sftp.connect do |sftp_session|
198
- return sftp_session.upload(local_path,remote_path)
201
+ return sftp_session.upload(local_path, remote_path)
199
202
  end
200
203
  end
201
204
  end
@@ -1,3 +1,3 @@
1
1
  module WoolenCommon
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woolen_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - just_woolen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-01 00:00:00.000000000 Z
11
+ date: 2017-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler