- Fix image size saving to occur before the return of the response
- Make the image size say ‘Unknown’ if it is not known
This commit is contained in:
parent
0a63690e25
commit
e7904f0a9e
2 changed files with 5 additions and 6 deletions
|
@ -125,9 +125,12 @@ def put_image_layer(namespace, repository, image_id):
|
||||||
sr.add_handler(sum_hndlr)
|
sr.add_handler(sum_hndlr)
|
||||||
store.stream_write(layer_path, sr)
|
store.stream_write(layer_path, sr)
|
||||||
csums.append('sha256:{0}'.format(h.hexdigest()))
|
csums.append('sha256:{0}'.format(h.hexdigest()))
|
||||||
image_size = None
|
|
||||||
try:
|
try:
|
||||||
image_size = tmp.tell()
|
image_size = tmp.tell()
|
||||||
|
|
||||||
|
# Save the size of the image.
|
||||||
|
model.set_image_size(image_id, namespace, repository, image_size)
|
||||||
|
|
||||||
tmp.seek(0)
|
tmp.seek(0)
|
||||||
csums.append(checksums.compute_tarsum(tmp, json_data))
|
csums.append(checksums.compute_tarsum(tmp, json_data))
|
||||||
tmp.close()
|
tmp.close()
|
||||||
|
@ -150,10 +153,6 @@ def put_image_layer(namespace, repository, image_id):
|
||||||
# Checksum is ok, we remove the marker
|
# Checksum is ok, we remove the marker
|
||||||
store.remove(mark_path)
|
store.remove(mark_path)
|
||||||
|
|
||||||
# Save the size of the image if we know it.
|
|
||||||
if image_size is not None:
|
|
||||||
model.set_image_size(image_id, namespace, repository, image_size)
|
|
||||||
|
|
||||||
# The layer is ready for download, send a job to the work queue to
|
# The layer is ready for download, send a job to the work queue to
|
||||||
# process it.
|
# process it.
|
||||||
logger.debug('Queing diffs job for image: %s' % image_id)
|
logger.debug('Queing diffs job for image: %s' % image_id)
|
||||||
|
|
|
@ -1027,7 +1027,7 @@ quayApp.directive('dockerAuthDialog', function () {
|
||||||
|
|
||||||
quayApp.filter('bytes', function() {
|
quayApp.filter('bytes', function() {
|
||||||
return function(bytes, precision) {
|
return function(bytes, precision) {
|
||||||
if (!bytes || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '';
|
if (!bytes || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return 'Unknown';
|
||||||
if (typeof precision === 'undefined') precision = 1;
|
if (typeof precision === 'undefined') precision = 1;
|
||||||
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
|
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
|
||||||
number = Math.floor(Math.log(bytes) / Math.log(1024));
|
number = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||||
|
|
Reference in a new issue