7
8
9
10
11
12
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
|
# File 'lib/bosh/cli/commands/share_release.rb', line 7
def share_release(tarball_path)
check_if_release_dir
unless File.exist?(tarball_path)
err("Release tarball file doesn't exist")
end
tarball = Bosh::Cli::ReleaseTarball.new(tarball_path)
say("\nVerifying release...")
tarball.validate(:allow_sparse => true)
nl
unless tarball.valid?
err('Release is invalid, please fix, verify and upload again')
end
upload_name = "boshrelease-#{tarball.release_name}-#{tarball.version}.tgz"
f = ::FileWithProgressBar.open(tarball_path, 'r')
f.out = Bosh::Cli::Config.output
raw_blobstore_client = unwrap_blobstore_client(blobstore)
bucket_name = raw_blobstore_client.instance_variable_get("@bucket_name")
fog = fog_storage(raw_blobstore_client)
unless dir = fog.directories.get(bucket_name)
err("S3 bucket #{bucket_name} is missing")
end
say("\nUploading release...")
if file = dir.files.new(key: upload_name, body: f)
file.public = true
file.save
nl
say(file.public_url)
else
err('Failed to upload file to blobstore')
end
end
|