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

chandan pushed a commit to branch chandan/fix-enum-comparison
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 03bce556318813c91266cf0018ba4745c1b0d9bf
Author: Chandan Singh <[email protected]>
AuthorDate: Wed Jul 26 22:37:56 2023 +0100

    _remotespec.py: Fix string/enum comparison
    
    Fixes: #1843.
---
 src/buildstream/_remotespec.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/buildstream/_remotespec.py b/src/buildstream/_remotespec.py
index c31a10bca..214706d09 100644
--- a/src/buildstream/_remotespec.py
+++ b/src/buildstream/_remotespec.py
@@ -312,11 +312,12 @@ class RemoteSpec:
                 elif key == "instance-name":
                     instance_name = val
                 elif key == "type":
-                    remote_type = val
-                    if remote_type not in [RemoteType.INDEX, 
RemoteType.STORAGE, RemoteType.ALL]:
+                    remote_type = RemoteType(val)
+                    allowed_types = [RemoteType.INDEX, RemoteType.STORAGE, 
RemoteType.ALL]
+                    if remote_type not in allowed_types:
                         raise RemoteError(
                             "Value for remote 'type' must be one of: 
{}".format(
-                                ", ".join([RemoteType.INDEX, 
RemoteType.STORAGE, RemoteType.ALL])
+                                ", ".join([str(_type) for _type in 
allowed_types])
                             )
                         )
                 elif key == "push":

Reply via email to