From 28a3387fd13f1cea0f7bb55eb3b79d7c50ee74ee Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Thu, 28 Feb 2019 12:55:08 +0000 Subject: cascache: don't hardcode 2G warning string Use _pretty_size to format the 'cache bigger than headroom' error, in case it changes in future. --- buildstream/_cas/cascache.py | 8 +++++--- 1 file 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 " + -- cgit v1.2.1