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

bugfix: fix error message printing error #576

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

dbaldy
Copy link

@dbaldy dbaldy commented Apr 4, 2024

Fixes an exception raised when an error occurs, hiding the real error message:

File "/usr/lib/python3/dist-packages/pylxd/models/instance.py", line 343, in create
    client.operations.wait_for_operation(response.json()["operation"])
  File "/usr/lib/python3/dist-packages/pylxd/models/operation.py", line 57, in wait_for_operation
    operation.wait()
  File "/usr/lib/python3/dist-packages/pylxd/models/operation.py", line 94, in wait
    response = self._client.api.operations[self.id].wait.get()
  File "/usr/lib/python3/dist-packages/pylxd/client.py", line 207, in get
    self._assert_response(
  File "/usr/lib/python3/dist-packages/pylxd/client.py", line 178, in _assert_response
    raise exceptions.LXDAPIException(response)
pylxd.exceptions.LXDAPIException: <unprintable LXDAPIException object>

This for instance happens in some cases when trying to create an instance by pulling the image from a remote server with client.instance.create(config, wait=True) but for some reason the backend doesn't manage to start the instance, e.g. we receive read-only filesystem from our workers from time to time.

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 97.81%. Comparing base (118ef8d) to head (c5702a2).

Files Patch % Lines
pylxd/exceptions.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #576      +/-   ##
==========================================
+ Coverage   97.77%   97.81%   +0.04%     
==========================================
  Files          32       32              
  Lines        3057     3073      +16     
==========================================
+ Hits         2989     3006      +17     
+ Misses         68       67       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbaldy dbaldy force-pushed the main branch 3 times, most recently from 347d3a5 to 26e68da Compare April 4, 2024 08:38
Copy link
Member

@simondeziel simondeziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution!

@simondeziel simondeziel merged commit afb1b84 into canonical:main Apr 4, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants