summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-06-25 19:59:28 +0900
committerShinya Maeda <shinya@gitlab.com>2018-06-25 19:59:28 +0900
commit58a1a0b70c7df0947864d0be933faf0153b537ec (patch)
tree12981201dfc7b9258bdd0bb4bbcdaa035e4475ff /app/models
parent44cc58765242afc2e035c2972447be2afae8d153 (diff)
downloadgitlab-ce-58a1a0b70c7df0947864d0be933faf0153b537ec.tar.gz
Support append/truncate for fog storebuild-chunks-on-object-storage
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build_trace_chunk.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/build_trace_chunk.rb b/app/models/ci/build_trace_chunk.rb
index 8a34db798db..4362570b5ee 100644
--- a/app/models/ci/build_trace_chunk.rb
+++ b/app/models/ci/build_trace_chunk.rb
@@ -63,7 +63,6 @@ module Ci
end
def truncate(offset = 0)
- raise ArgumentError, 'Fog store does not support truncating' if fog? # If data is null, get_data returns Excon::Error::NotFound
raise ArgumentError, 'Offset is out of range' if offset > size || offset < 0
return if offset == size # Skip the following process as it doesn't affect anything
@@ -71,7 +70,6 @@ module Ci
end
def append(new_data, offset)
- raise ArgumentError, 'Fog store does not support appending' if fog? # If data is null, get_data returns Excon::Error::NotFound
raise ArgumentError, 'New data is nil' unless new_data
raise ArgumentError, 'Offset is out of range' if offset > size || offset < 0
raise ArgumentError, 'Chunk size overflow' if CHUNK_SIZE < (offset + new_data.bytesize)
@@ -124,6 +122,8 @@ module Ci
def get_data
self.class.get_store_class(data_store).data(self)&.force_encoding(Encoding::BINARY) # Redis/Database return UTF-8 string as default
+ rescue Excon::Error::NotFound
+ # If the data store is :fog and the file does not exist in the object storage, this method returns nil.
end
def unsafe_set_data!(value)