summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-02-28 12:55:08 +0000
committerAngelos Evripiotis <angelos.evripiotis@gmail.com>2019-02-28 14:17:38 +0000
commit28a3387fd13f1cea0f7bb55eb3b79d7c50ee74ee (patch)
treed3e13242dae0286d92b89c5c7f3b57602c873a1e
parent60e62439292391817a642ddb5fe6cd7503acfa50 (diff)
downloadbuildstream-28a3387fd13f1cea0f7bb55eb3b79d7c50ee74ee.tar.gz
cascache: don't hardcode 2G warning string
Use _pretty_size to format the 'cache bigger than headroom' error, in case it changes in future.
-rw-r--r--buildstream/_cas/cascache.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/buildstream/_cas/cascache.py b/buildstream/_cas/cascache.py
index 40d7efe78..08860bacc 100644
--- a/buildstream/_cas/cascache.py
+++ b/buildstream/_cas/cascache.py
@@ -1228,9 +1228,11 @@ class CASQuota:
if cache_quota is None: # Infinity, set to max system storage
cache_quota = cache_size + available_space
if cache_quota < self._cache_quota_headroom: # Check minimum
- raise LoadError(LoadErrorReason.INVALID_DATA,
- "Invalid cache quota ({}): ".format(utils._pretty_size(cache_quota)) +
- "BuildStream requires a minimum cache quota of 2G.")
+ raise LoadError(
+ LoadErrorReason.INVALID_DATA,
+ "Invalid cache quota ({}): BuildStream requires a minimum cache quota of {}.".format(
+ utils._pretty_size(cache_quota),
+ utils._pretty_size(self._cache_quota_headroom)))
elif cache_quota > total_size:
# A quota greater than the total disk size is certianly an error
raise CASCacheError("Your system does not have enough available " +