Commit d2d85c31 authored by Michael Kozono's avatar Michael Kozono

Avoid extra storage bucket perm and query

Specifically, the `ListAllMyBuckets` permission.

This works if you know the directory exists.

See more:

* https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23981
* https://stackoverflow.com/a/12288581/1992201
parent a9049532
...@@ -195,7 +195,7 @@ module Backup ...@@ -195,7 +195,7 @@ module Backup
if connection.service == ::Fog::Storage::Local if connection.service == ::Fog::Storage::Local
connection.directories.create(key: remote_directory) connection.directories.create(key: remote_directory)
else else
connection.directories.get(remote_directory) connection.directories.new(key: remote_directory)
end end
end end
......
...@@ -1320,7 +1320,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -1320,7 +1320,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
end end
before do before do
fog_connection.directories.get('artifacts').files.create( fog_connection.directories.new(key: 'artifacts').files.create(
key: 'tmp/uploads/12312300', key: 'tmp/uploads/12312300',
body: 'content' body: 'content'
) )
......
...@@ -1123,7 +1123,7 @@ describe 'Git LFS API and storage' do ...@@ -1123,7 +1123,7 @@ describe 'Git LFS API and storage' do
context 'with valid remote_id' do context 'with valid remote_id' do
before do before do
fog_connection.directories.get('lfs-objects').files.create( fog_connection.directories.new(key: 'lfs-objects').files.create(
key: 'tmp/uploads/12312300', key: 'tmp/uploads/12312300',
body: 'content' body: 'content'
) )
......
...@@ -201,7 +201,7 @@ describe FileUploader do ...@@ -201,7 +201,7 @@ describe FileUploader do
end end
let!(:fog_file) do let!(:fog_file) do
fog_connection.directories.get('uploads').files.create( fog_connection.directories.new(key: 'uploads').files.create(
key: 'tmp/uploads/test/123123', key: 'tmp/uploads/test/123123',
body: 'content' body: 'content'
) )
......
...@@ -716,7 +716,7 @@ describe ObjectStorage do ...@@ -716,7 +716,7 @@ describe ObjectStorage do
end end
let!(:fog_file) do let!(:fog_file) do
fog_connection.directories.get('uploads').files.create( fog_connection.directories.new(key: 'uploads').files.create(
key: 'tmp/uploads/test/123123', key: 'tmp/uploads/test/123123',
body: 'content' body: 'content'
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment