Commit 8acef892 authored by Leo Iannacone's avatar Leo Iannacone

count other files size as "others" fieldn in result

parent af7caacd
...@@ -37,12 +37,13 @@ get_disk_usage = (cb) -> ...@@ -37,12 +37,13 @@ get_disk_usage = (cb) ->
utils.errors_handler "stats:get_disk_usage", err utils.errors_handler "stats:get_disk_usage", err
return return
if stderr? if stderr?
utils.errors_handler "disk usage error: ", stderr utils.errors_handler "disk usage error:", stderr
result = {} result = {}
others = 0
for line in stdout.split('\n') for line in stdout.split('\n')
continue if line == '' continue if line == ''
info = line.replace(/\t+/g,' ').split(' ') info = line.replace(/\t+/g,' ').split(' ')
size = info[0] size = parseInt(info[0])
dirs = info[1].replace("#{config.debomatic.path}", '').split('/') dirs = info[1].replace("#{config.debomatic.path}", '').split('/')
# case total size for debomatic incoming # case total size for debomatic incoming
...@@ -57,6 +58,8 @@ get_disk_usage = (cb) -> ...@@ -57,6 +58,8 @@ get_disk_usage = (cb) ->
# case total size for distribution # case total size for distribution
if dirs.length == 2 if dirs.length == 2
result[distribution]['size'] = size result[distribution]['size'] = size
result[distribution]['others'] = others
others = 0
continue continue
# case size for distribution/subdir # case size for distribution/subdir
...@@ -64,6 +67,8 @@ get_disk_usage = (cb) -> ...@@ -64,6 +67,8 @@ get_disk_usage = (cb) ->
subdir = "chroot" if distribution == subdir subdir = "chroot" if distribution == subdir
if subdir in config.debomatic.disk_usage_subdirs if subdir in config.debomatic.disk_usage_subdirs
result[distribution][subdir] = size result[distribution][subdir] = size
else
others += size
cb(result) cb(result)
......
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