Skip to content

Commit

Permalink
fix(cli): report format unfound error w/ REST API
Browse files Browse the repository at this point in the history
Report error instead of crashing in fatbuildrctl when unable to find
format corresponding to a given distribution with fatbuildrweb REST API.

fix #172
  • Loading branch information
rezib committed Jul 12, 2024
1 parent ec74b33 commit 3cd59c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
definition file (#171).
- Handle JSON decode error in `fatbuildrctl` in case of unexpected failure in
`fatbuildrweb` (#146).
- Report error instead of crashing in `fatbuildrctl` when unable to find format
corresponding to a given distribution with fatbuildrweb REST API (#172).
- docs:
- Add missing path parameter in REST API to retrieve artifact information.
- Add missing optional `architectures` parameter in instances pipelines
Expand Down
5 changes: 5 additions & 0 deletions fatbuildr/protocols/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def pipelines_distribution_format(self, distribution):
url = f"{self.uri}/pipelines/formats.json?distribution={distribution}"
response = self._auth_request(requests.get, url)
formats = response.json()
if len(formats) == 0:
raise FatbuildrServerError(
"Unable to find format corresponding to distribution "
f"{distribution}"
)
return list(formats.keys())[0]

@check_http_errors
Expand Down

0 comments on commit 3cd59c8

Please sign in to comment.