caterer 0.7.3 → 0.7.4
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.
- data/lib/caterer/communication/rsync.rb +11 -2
- data/lib/caterer/server.rb +5 -1
- data/lib/caterer/version.rb +1 -1
- metadata +1 -1
@@ -4,6 +4,8 @@ module Caterer
|
|
4
4
|
module Communication
|
5
5
|
class Rsync
|
6
6
|
|
7
|
+
attr_reader :server
|
8
|
+
|
7
9
|
class << self
|
8
10
|
|
9
11
|
def available?
|
@@ -26,7 +28,7 @@ module Caterer
|
|
26
28
|
begin
|
27
29
|
out = stdout.readpartial(4096)
|
28
30
|
if out.match /password:/
|
29
|
-
stdin.puts
|
31
|
+
stdin.puts server.password
|
30
32
|
else
|
31
33
|
@logger.debug("stdout: #{out}")
|
32
34
|
end
|
@@ -43,7 +45,14 @@ module Caterer
|
|
43
45
|
protected
|
44
46
|
|
45
47
|
def rsync_cmd(from, to)
|
46
|
-
"rsync -zr -e '
|
48
|
+
"rsync -zr -e '#{ssh_cmd}' --delete #{from} #{server.username}@#{server.host}:#{to}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def ssh_cmd
|
52
|
+
cmd = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
53
|
+
cmd += " -i #{server.key}" unless server.key.nil?
|
54
|
+
cmd += " -p #{server.port}" unless server.port == 22
|
55
|
+
cmd
|
47
56
|
end
|
48
57
|
|
49
58
|
end
|
data/lib/caterer/server.rb
CHANGED
@@ -114,7 +114,7 @@ module Caterer
|
|
114
114
|
opts[:paranoid] = false
|
115
115
|
opts[:port] = port
|
116
116
|
opts[:password] = password if password
|
117
|
-
opts[:keys] = [].tap {|keys| keys <<
|
117
|
+
opts[:keys] = [].tap {|keys| keys << key if key }
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -146,6 +146,10 @@ module Caterer
|
|
146
146
|
@port || 22
|
147
147
|
end
|
148
148
|
|
149
|
+
def key
|
150
|
+
@key
|
151
|
+
end
|
152
|
+
|
149
153
|
def data
|
150
154
|
@data_hash ||= begin
|
151
155
|
(@data.is_a? Hash) ? @data : {}
|
data/lib/caterer/version.rb
CHANGED