canonical / pebble

Take control of your internal daemons!
https://canonical-pebble.readthedocs-hosted.com/
GNU General Public License v3.0
143 stars 54 forks source link

fix: make Client.Pull properly handle API errors #452

Closed benhoyt closed 1 month ago

benhoyt commented 1 month ago

Currently the Client.Pull method is immediately checking the content type for multipart, but we should also check for a regular API error. This PR fixes that.

Before (in case of permission denied error):

$ pebble pull /etc/hosts hosts
error: expected a multipart response, got "application/json"

After:

$ pebble pull /etc/hosts hosts
error: access denied (try with sudo)

Fixes #413