You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/18 05:53:20 UTC

[buildstream] 01/01: _artifactcache/cascache.py: Check for permission denied when initializing remote

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/bst-1/check-permission-denied
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 3ec7cda5b2d1db8f3e65395faecf22bb647923b6
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu Aug 18 14:48:58 2022 +0900

    _artifactcache/cascache.py: Check for permission denied when initializing remote
    
    When we check whether the remote supports PushDirectory() requests, we were
    ignoring the possible permission denied.
    
    These checks are made for compatibility with servers, some REAPI requests
    are more efficient but not always supported, if they are not supported we
    fallback to more inefficient codepaths. When checking push related APIs
    we should also ignore errors related to lack of permission.
---
 buildstream/_artifactcache/cascache.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 50b0b9ef4..2e4636d45 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -1154,7 +1154,8 @@ class CASRemote():
                 if e.code() == grpc.StatusCode.INVALID_ARGUMENT:
                     # Expected error as the request doesn't specify any URIs.
                     self.asset_push_supported = True
-                elif e.code() != grpc.StatusCode.UNIMPLEMENTED:
+                if (e.code() != grpc.StatusCode.UNIMPLEMENTED and
+                        e.code() != grpc.StatusCode.PERMISSION_DENIED):
                     raise
 
             self._initialized = True