sshkit 0.0.33 → 0.0.34
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/EXAMPLES.md +14 -0
- data/lib/sshkit/backends/netssh.rb +8 -2
- data/lib/sshkit/host.rb +2 -1
- data/lib/sshkit/version.rb +1 -1
- data/test/unit/backends/test_netssh.rb +10 -0
- data/test/unit/test_host.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8a80737dc30278cecf0c75d8317073b49d1a9ef
|
4
|
+
data.tar.gz: 6cb80d26c524ec7482254a7f1e9ac6bf54cf69b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f169d46717d900f9af2ebccff96665b306613946cf68bc74902a7bbba2ffd961a43fe356294066ffeaaa7754782870710a2e32dc6b9dd93f43ccfcc7e038580
|
7
|
+
data.tar.gz: 48fa41ad79624b95467bcd8b1f7f0699f0cf80c5cf0d1e9c5dc738d6f136e4ad2b509dba9221e27c50185db1ac021703f75e225d332a90aa2c47f378ec7df85f
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
This file is written in reverse chronological order, newer releases will
|
4
4
|
appear at the top.
|
5
5
|
|
6
|
+
## 0.0.34
|
7
|
+
|
8
|
+
* Allow the setting of global SSH options on the `backend.ssh` as a hash,
|
9
|
+
these options are the same as Net::SSH configure expects. Thanks to Rafał
|
10
|
+
@lisukorin Lisowski
|
11
|
+
|
6
12
|
## 0.0.32
|
7
13
|
|
8
14
|
* Lots of small changes since 0.0.27.
|
data/EXAMPLES.md
CHANGED
@@ -105,6 +105,20 @@ etc, this will be improved as the library matures, but we're not there yet.
|
|
105
105
|
In this case the `recursive: true` option mirrors the same options which are
|
106
106
|
available to `Net::{SCP,SFTP}`.
|
107
107
|
|
108
|
+
## Setting global SSH options
|
109
|
+
|
110
|
+
Setting global SSH options, these will be overwritten by options set on the
|
111
|
+
individual hosts:
|
112
|
+
|
113
|
+
Netssh.configure do |ssh|
|
114
|
+
ssh.connection_timeout = 30
|
115
|
+
ssh.ssh_options = {
|
116
|
+
keys: %w(/home/user/.ssh/id_rsa),
|
117
|
+
forward_agent: false,
|
118
|
+
auth_methods: %w(publickey password)
|
119
|
+
}
|
120
|
+
end
|
121
|
+
|
108
122
|
## Run a command with a different effective group ID
|
109
123
|
|
110
124
|
on hosts do |host|
|
@@ -29,6 +29,11 @@ module SSHKit
|
|
29
29
|
|
30
30
|
class Configuration
|
31
31
|
attr_accessor :connection_timeout, :pty
|
32
|
+
attr_writer :ssh_options
|
33
|
+
|
34
|
+
def ssh_options
|
35
|
+
@ssh_options || {}
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
include SSHKit::CommandHelper
|
@@ -64,9 +69,9 @@ module SSHKit
|
|
64
69
|
percentage = (sent.to_f * 100 / total.to_f)
|
65
70
|
unless percentage.nan?
|
66
71
|
if percentage > 0 && percentage % 10 == 0
|
67
|
-
info "Uploading #{name} #{percentage}%"
|
72
|
+
info "Uploading #{name} #{percentage.round(2)}%"
|
68
73
|
else
|
69
|
-
debug "Uploading #{name} #{percentage}%"
|
74
|
+
debug "Uploading #{name} #{percentage.round(2)}%"
|
70
75
|
end
|
71
76
|
else
|
72
77
|
warn "Error calculating percentage #{percentage} is NaN"
|
@@ -147,6 +152,7 @@ module SSHKit
|
|
147
152
|
|
148
153
|
def ssh
|
149
154
|
@ssh ||= begin
|
155
|
+
host.ssh_options ||= Netssh.config.ssh_options
|
150
156
|
Net::SSH.start(
|
151
157
|
String(host.hostname),
|
152
158
|
host.username,
|
data/lib/sshkit/host.rb
CHANGED
@@ -6,7 +6,7 @@ module SSHKit
|
|
6
6
|
|
7
7
|
class Host
|
8
8
|
|
9
|
-
attr_accessor :password, :hostname, :port, :user
|
9
|
+
attr_accessor :password, :hostname, :port, :user, :ssh_options
|
10
10
|
|
11
11
|
def key=(new_key)
|
12
12
|
@keys = [new_key]
|
@@ -78,6 +78,7 @@ module SSHKit
|
|
78
78
|
sho[:password] = password if password
|
79
79
|
sho[:forward_agent] = true
|
80
80
|
end
|
81
|
+
.merge(ssh_options || {})
|
81
82
|
end
|
82
83
|
|
83
84
|
def properties
|
data/lib/sshkit/version.rb
CHANGED
@@ -12,10 +12,20 @@ module SSHKit
|
|
12
12
|
backend.configure do |ssh|
|
13
13
|
ssh.pty = true
|
14
14
|
ssh.connection_timeout = 30
|
15
|
+
ssh.connection_timeout = 30
|
16
|
+
ssh.ssh_options = {
|
17
|
+
keys: %w(/home/user/.ssh/id_rsa),
|
18
|
+
forward_agent: false,
|
19
|
+
auth_methods: %w(publickey password)
|
20
|
+
}
|
15
21
|
end
|
16
22
|
|
17
23
|
assert_equal 30, backend.config.connection_timeout
|
18
24
|
assert_equal true, backend.config.pty
|
25
|
+
|
26
|
+
assert_equal %w(/home/user/.ssh/id_rsa), backend.config.ssh_options[:keys]
|
27
|
+
assert_equal false, backend.config.ssh_options[:forward_agent]
|
28
|
+
assert_equal %w(publickey password), backend.config.ssh_options[:auth_methods]
|
19
29
|
end
|
20
30
|
end
|
21
31
|
end
|
data/test/unit/test_host.rb
CHANGED
@@ -104,6 +104,27 @@ module SSHKit
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
+
def test_turning_a_host_into_ssh_options_when_extra_options_are_set
|
108
|
+
ssh_options = {
|
109
|
+
port: 3232,
|
110
|
+
keys: %w(/home/user/.ssh/id_rsa),
|
111
|
+
forward_agent: false,
|
112
|
+
auth_methods: %w(publickey password)
|
113
|
+
}
|
114
|
+
Host.new('someuser@example.com:2222').tap do |host|
|
115
|
+
host.password = "andthisdoesntevenmakeanysense"
|
116
|
+
host.keys = ["~/.ssh/some_key_here"]
|
117
|
+
host.ssh_options = ssh_options
|
118
|
+
host.netssh_options.tap do |sho|
|
119
|
+
assert_equal 3232, sho.fetch(:port)
|
120
|
+
assert_equal 'andthisdoesntevenmakeanysense', sho.fetch(:password)
|
121
|
+
assert_equal %w(/home/user/.ssh/id_rsa), sho.fetch(:keys)
|
122
|
+
assert_equal false, sho.fetch(:forward_agent)
|
123
|
+
assert_equal %w(publickey password), sho.fetch(:auth_methods)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
107
128
|
end
|
108
129
|
|
109
130
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Hambley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|