Skip to content

Commit

Permalink
watch: walk back from using Click.Abort()
Browse files Browse the repository at this point in the history
Abort won't exit immedially, but generate an Click execption
instead. However, we want to exit right away. The suggestion
is to just use sys.exit()

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
  • Loading branch information
padovan committed Feb 1, 2025
1 parent ae97062 commit 6a88f9a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kcidev/libs/maestro_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import errno
import json
import time

Expand Down Expand Up @@ -54,10 +55,10 @@ def maestro_get_node(url, nodeid):
response.raise_for_status()
except requests.exceptions.HTTPError as ex:
kci_err(ex.response.json().get("detail"))
click.Abort()
sys.exit(errno.ENOENT)
except Exception as ex:
kci_err(ex)
click.Abort()
sys.exit(errno.ENOENT)

return response.json()

Expand All @@ -79,10 +80,10 @@ def maestro_get_nodes(url, limit, offset, filter):
response.raise_for_status()
except requests.exceptions.HTTPError as ex:
kci_err(ex.response.json().get("detail"))
click.Abort()
sys.exit(errno.ENOENT)
except Exception as ex:
kci_err(ex)
click.Abort()
sys.exit(errno.ENOENT)

return response.json()

Expand Down

0 comments on commit 6a88f9a

Please sign in to comment.