From 4b941ff389707d1f6a5be1f422f2831ae9cc32c3 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Tue, 11 Jun 2019 10:10:16 +0100 Subject: cascache: refactor, rm some unused exception vars --- src/buildstream/_cas/cascache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 434e71663..ba520851c 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -246,7 +246,7 @@ class CASCache(): raise CASCacheError("Failed to pull ref {}: {}".format(ref, e)) from e else: return False - except BlobNotFound as e: + except BlobNotFound: return False # pull_tree(): @@ -400,7 +400,7 @@ class CASCache(): os.makedirs(os.path.dirname(objpath), exist_ok=True) os.link(tmp.name, objpath) - except FileExistsError as e: + except FileExistsError: # We can ignore the failed link() if the object is already in the repo. pass -- cgit v1.2.1 From a2dcb69cb45bbaf1d63347ebd66ea21c46ee0c44 Mon Sep 17 00:00:00 2001 From: Angelos Evripiotis Date: Tue, 11 Jun 2019 10:12:14 +0100 Subject: cascache: add_object, assert path if link_directly --- src/buildstream/_cas/cascache.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index ba520851c..53f6029db 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -367,6 +367,9 @@ class CASCache(): # Exactly one of the two parameters has to be specified assert (path is None) != (buffer is None) + # If we're linking directly, then path must be specified. + assert (not link_directly) or (link_directly and path) + if digest is None: digest = remote_execution_pb2.Digest() -- cgit v1.2.1