Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_remotespec.py: Fix string/enum comparison #1850

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/buildstream/_remotespec.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,12 @@ def new_from_string(cls, string: str, purpose: int = RemoteSpecPurpose.ALL) -> "
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 = cast(str, 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":
Expand Down
Loading