13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/bosh/director/compiled_release_downloader.rb', line 13
def download
@download_dir = Dir.mktmpdir
path = File.join(@download_dir, 'compiled_packages')
FileUtils.mkpath(path)
compiled_packages = @compiled_packages_group.compiled_packages
event_log_stage = event_log.begin_stage("copying packages", compiled_packages.count)
compiled_packages.each do |compiled_package|
desc = "#{compiled_package.package.name}/#{compiled_package.package.version}"
event_log_stage.advance_and_track(desc) do
blobstore_id = compiled_package.blobstore_id
File.open(File.join(path, "#{compiled_package.package.name}.tgz"), 'w') do |f|
@blobstore_client.get(blobstore_id, f, sha1: compiled_package.sha1)
end
end
end
path = File.join(@download_dir, 'jobs')
FileUtils.mkpath(path)
event_log_stage = event_log.begin_stage("copying jobs", @templates.count)
@templates.each do |template|
desc = "#{template.name}/#{template.version}"
event_log_stage.advance_and_track(desc) do
blobstore_id = template.blobstore_id
File.open(File.join(path, "#{template.name}.tgz"), 'w') do |f|
@blobstore_client.get(blobstore_id, f, sha1: template.sha1)
end
end
end
@download_dir
end
|