kitchen-sync 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/kitchen-sync/core_ext.rb +11 -2
- data/lib/kitchen-sync/version.rb +1 -1
- data/lib/kitchen/transport/rsync.rb +4 -3
- data/lib/kitchen/transport/sftp.rb +7 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c22375c770510ba072de49ad78a4840c70bbcc8
|
4
|
+
data.tar.gz: e127ccc22c91a8265d35640121e1e74377ba176f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e7cc419bddef287adbadd38d37c53c943592be3805e51255fe9fb29d3a5e5afe594327a9ad5617481626158f388a5a10900ff932234d7ecf3b001cfa0665f9
|
7
|
+
data.tar.gz: 311b93a549dd26bb3f2ec6008831dfd01cd61389f6bc25c4cb8a907d7500f35330feecb0ccc4c7e8316df9044fcb51c0aabdd20173a07ccdfd881a9a881787a3
|
data/CHANGELOG.md
CHANGED
@@ -19,9 +19,18 @@ module Kitchen
|
|
19
19
|
# Monkey patch to prevent the deletion of everything
|
20
20
|
module Provisioner
|
21
21
|
class ChefBase < Base
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
old_init_command = instance_method(:init_command)
|
24
|
+
|
25
|
+
define_method(:init_command) do
|
26
|
+
if (defined?(Kitchen::Transport::Sftp) && instance.transport.is_a?(Kitchen::Transport::Sftp)) || \
|
27
|
+
(defined?(Kitchen::Transport::Rsync) && instance.transport.is_a?(Kitchen::Transport::Rsync))
|
28
|
+
"mkdir -p #{config[:root_path]}"
|
29
|
+
else
|
30
|
+
old_init_command.bind(self).()
|
31
|
+
end
|
24
32
|
end
|
33
|
+
|
25
34
|
end
|
26
35
|
end
|
27
36
|
end
|
data/lib/kitchen-sync/version.rb
CHANGED
@@ -45,11 +45,12 @@ module Kitchen
|
|
45
45
|
end
|
46
46
|
|
47
47
|
locals = Array(locals)
|
48
|
-
# We only try to sync folders for now
|
49
|
-
|
48
|
+
# We only try to sync folders for now and ignore the cache folder
|
49
|
+
# because we don't want to --delete that.
|
50
|
+
rsync_candidates = locals.select {|path| File.directory?(path) && File.basename(path) != 'cache' }
|
50
51
|
ssh_command = "ssh #{ssh_args.join(' ')}"
|
51
52
|
copy_identity
|
52
|
-
rsync_cmd = "/usr/bin/rsync -e '#{ssh_command}' -az#{logger.level == :debug ? 'vv' : ''} #{rsync_candidates.join(' ')} #{@session.options[:user]}@#{@session.host}:#{remote}"
|
53
|
+
rsync_cmd = "/usr/bin/rsync -e '#{ssh_command}' -az#{logger.level == :debug ? 'vv' : ''} --delete #{rsync_candidates.join(' ')} #{@session.options[:user]}@#{@session.host}:#{remote}"
|
53
54
|
logger.debug("[rsync] Running rsync command: #{rsync_cmd}")
|
54
55
|
ret = []
|
55
56
|
time = Benchmark.realtime do
|
@@ -72,9 +72,13 @@ module Kitchen
|
|
72
72
|
def upload(locals, remote)
|
73
73
|
Array(locals).each do |local|
|
74
74
|
full_remote = File.join(remote, File.basename(local))
|
75
|
+
options = {
|
76
|
+
recursive: File.directory?(local),
|
77
|
+
purge: File.basename(local) != 'cache',
|
78
|
+
}
|
75
79
|
recursive = File.directory?(local)
|
76
80
|
time = Benchmark.realtime do
|
77
|
-
sftp_upload!(local, full_remote,
|
81
|
+
sftp_upload!(local, full_remote, options)
|
78
82
|
end
|
79
83
|
logger.info("[SFTP] Time taken to upload #{local} to #{self}:#{full_remote}: %.2f sec" % time)
|
80
84
|
end
|
@@ -82,7 +86,7 @@ module Kitchen
|
|
82
86
|
|
83
87
|
private
|
84
88
|
|
85
|
-
def sftp_upload!(local, remote, recursive)
|
89
|
+
def sftp_upload!(local, remote, recursive: true, purge: true)
|
86
90
|
# Fast path check, if the remote path doesn't exist at all we just run a direct transfer
|
87
91
|
unless safe_stat(remote)
|
88
92
|
logger.debug("[SFTP] Fast path upload from #{local} to #{remote}")
|
@@ -100,7 +104,7 @@ module Kitchen
|
|
100
104
|
files_to_upload(checksums, local, recursive).each do |rel_path|
|
101
105
|
upload_file(checksums, local, remote, rel_path)
|
102
106
|
end
|
103
|
-
purge_files(checksums, remote)
|
107
|
+
purge_files(checksums, remote) if purge
|
104
108
|
# Wait until all xfers are complete.
|
105
109
|
sftp_loop(0)
|
106
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Kantrowitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.6.2
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Improved file transfers for for test-kitchen
|