From: Tobias Ulmer Date: Fri, 23 May 2014 15:31:55 +0000 (+0200) Subject: cache: whitespace fixes X-Git-Tag: e2factory-2.3.15rc1~202 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=a0b450902380bea24e08237200117830ab58e351;p=e2factory.git cache: whitespace fixes Signed-off-by: Tobias Ulmer --- diff --git a/generic/cache.lua b/generic/cache.lua index 20b0506..5a8cb0e 100644 --- a/generic/cache.lua +++ b/generic/cache.lua @@ -372,6 +372,7 @@ function cache.push_file(c, sourcefile, server, location, flags) if not rc then return false, e:cat(re) end + rc, re = cache.writeback(c, server, location, flags) if not rc then return false, e:cat(re) @@ -380,8 +381,7 @@ function cache.push_file(c, sourcefile, server, location, flags) -- cache is disabled -- push the file from source to destination immediately rc, re = transport.push_file(sourcefile, ce.remote_url, - location, ce.flags.push_permissions, - flags.try_hardlink) + location, ce.flags.push_permissions, flags.try_hardlink) if not rc then return false, e:cat(re) end @@ -399,18 +399,22 @@ end function cache.writeback(c, server, location, flags) local e = err.new("writeback failed") local rc, re + local ce, re = cache.ce_by_server(c, server) if not ce then return false, e:cat(re) end + local ceurl, re = url.parse(ce.cache_url) if not ceurl then return false, e:cat(re) end + if flags.writeback == false or (ce.flags.writeback == false and flags.writeback ~= true) then return true end + local sourcefile = string.format("/%s/%s", ceurl.path, location) rc, re = transport.push_file(sourcefile, ce.remote_url, location, ce.flags.push_permissions, flags.try_hardlink)