rbbt-util 5.26.119 → 5.26.120
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/workflow/remote/ssh/driver.rb +1 -1
- data/lib/rbbt/workflow/util/archive.rb +18 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9ec3c2938773e8fd856054ef528f4003eee1ad8c9861cbf2bfedd191b3b0355
|
4
|
+
data.tar.gz: c5bf8a057f4f121ae3c23ec17e20ea58b2e86ce751f19f5119bf309c476a56de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3aceb75551882dafc2fb165cc35b855a7688052fa222837539633873a40e567b9fabf3513f520162ba13d86ba9af2ecca883cc3fff5b659044fe02cbb26b804
|
7
|
+
data.tar.gz: e22e5015ba5d35b65aa2c73006f75c3a745bf4c15f9f9dcde88545f956041d87c9d576eaebf75db416c7bea4f2a94bbe6db64d680cca03c7d3cab279f54dc04e
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module SSHDriver
|
2
2
|
def self.run(server, script)
|
3
3
|
Log.debug "Run ssh script in #{server}:\n#{script}"
|
4
|
-
CMD.cmd("ssh '#{server}' 'shopt -s expand_aliases; bash -
|
4
|
+
CMD.cmd("ssh '#{server}' 'shopt -s expand_aliases; bash -l -i -c \"ruby\"' ", :in => script, :log => true).read
|
5
5
|
end
|
6
6
|
|
7
7
|
#def self.run_log(server, script)
|
@@ -49,7 +49,7 @@ class Step
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def self.job_files_for_archive(files,
|
52
|
+
def self.job_files_for_archive(files, recursive = false)
|
53
53
|
job_files = Set.new
|
54
54
|
|
55
55
|
jobs = files.collect do |file|
|
@@ -65,8 +65,9 @@ class Step
|
|
65
65
|
next unless File.exists?(step.path)
|
66
66
|
job_files << step.path
|
67
67
|
job_files << step.info_file if File.exists?(step.info_file)
|
68
|
-
job_files << step.files_dir if Dir.glob(step.files_dir + '/*').any?
|
68
|
+
job_files << step.files_dir.glob("**") if Dir.glob(step.files_dir + '/*').any?
|
69
69
|
rec_dependencies = Set.new
|
70
|
+
next unless recursive
|
70
71
|
deps = [step.path]
|
71
72
|
seen = Set.new
|
72
73
|
while deps.any?
|
@@ -75,8 +76,6 @@ class Step
|
|
75
76
|
dep = Workflow.load_step path
|
76
77
|
seen << dep.path
|
77
78
|
|
78
|
-
dep.relocated = !!relocate
|
79
|
-
|
80
79
|
dep.load_dependencies_from_info
|
81
80
|
|
82
81
|
dep.dependencies.each do |dep|
|
@@ -97,11 +96,11 @@ class Step
|
|
97
96
|
job_files.to_a
|
98
97
|
end
|
99
98
|
|
100
|
-
def self.archive(files, target = nil,
|
99
|
+
def self.archive(files, target = nil, recursive = true)
|
101
100
|
target = self.path + '.tar.gz' if target.nil?
|
102
101
|
target = File.expand_path(target) if String === target
|
103
102
|
|
104
|
-
job_files = job_files_for_archive files,
|
103
|
+
job_files = job_files_for_archive files, recursive
|
105
104
|
TmpFile.with_file do |tmpdir|
|
106
105
|
job_files.each do |file|
|
107
106
|
Step.link_job file, tmpdir
|
@@ -119,11 +118,12 @@ class Step
|
|
119
118
|
end
|
120
119
|
|
121
120
|
def self.migrate(path, search_path, options = {})
|
122
|
-
|
123
121
|
resource=Rbbt
|
124
122
|
|
125
123
|
other_rsync_args = options[:rsync]
|
126
|
-
|
124
|
+
|
125
|
+
recursive = options[:recursive]
|
126
|
+
recursive = false if recursive.nil?
|
127
127
|
|
128
128
|
paths = if options[:source]
|
129
129
|
SSHDriver.run(options[:source], <<-EOF).split("\n")
|
@@ -131,18 +131,21 @@ require 'rbbt-util'
|
|
131
131
|
require 'rbbt/workflow'
|
132
132
|
|
133
133
|
path = "#{path}"
|
134
|
-
|
134
|
+
recursive = #{ recursive.to_s }
|
135
|
+
|
135
136
|
if File.exists?(path)
|
136
137
|
path = #{resource.to_s}.identify(path)
|
137
138
|
else
|
138
139
|
path = Path.setup(path)
|
139
140
|
end
|
141
|
+
|
140
142
|
files = path.glob_all
|
141
|
-
|
142
|
-
|
143
|
-
|
143
|
+
|
144
|
+
files = Step.job_files_for_archive(files, recursive)
|
145
|
+
|
144
146
|
puts files * "\n"
|
145
147
|
EOF
|
148
|
+
|
146
149
|
else
|
147
150
|
if File.exists?(path)
|
148
151
|
path = resource.identify(path)
|
@@ -155,6 +158,7 @@ puts files * "\n"
|
|
155
158
|
end
|
156
159
|
files
|
157
160
|
end
|
161
|
+
iii paths
|
158
162
|
|
159
163
|
target = if options[:target]
|
160
164
|
target = SSHDriver.run(options[:target], <<-EOF).split("\n").first
|
@@ -218,9 +222,9 @@ puts resource[path].find(search_path)
|
|
218
222
|
end
|
219
223
|
end
|
220
224
|
|
221
|
-
def self.purge(path,
|
225
|
+
def self.purge(path, recursive = false)
|
222
226
|
path = [path] if String === path
|
223
|
-
job_files = job_files_for_archive path,
|
227
|
+
job_files = job_files_for_archive path, recursive
|
224
228
|
|
225
229
|
job_files.each do |file|
|
226
230
|
begin
|