From 26400c206cd43038baf4e7a03d7c8bd0c85341a7 Mon Sep 17 00:00:00 2001 From: Otavio Jacobi Date: Fri, 25 Oct 2024 10:50:23 -0300 Subject: [PATCH 1/2] Properly surface RequestErrors from balena-api Change-type: patch --- balena/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/balena/exceptions.py b/balena/exceptions.py index c389b7f3..cf570164 100644 --- a/balena/exceptions.py +++ b/balena/exceptions.py @@ -185,7 +185,7 @@ def __init__(self, body, status_code=None): self.message = Message.REQUEST_ERROR.format(body=body) self.body = body self.status_code = status_code - # print(self.message, status_code) + print(self.message, status_code) class NotLoggedIn(BalenaException): From 4c42649e4f9145ded61330c3fbe83dbaadc811ce Mon Sep 17 00:00:00 2001 From: Otavio Jacobi Date: Fri, 25 Oct 2024 10:50:54 -0300 Subject: [PATCH 2/2] Fix docs for `device.config_var.set` Change-type: patch --- DOCUMENTATION.md | 4 ++-- balena/models/device.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index fe2ee97e..bbc592eb 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -2244,7 +2244,7 @@ Remove a device environment variable. ### Function: set(uuid_or_id, env_var_name, value) ⇒ None Set the value of a device config variable. - +Note that config variables must start with BALENA_ and RESIN_ prefixes. #### Args: uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. @@ -2252,7 +2252,7 @@ Set the value of a device config variable. #### Examples: ```python ->>> balena.models.device.config_var.device.set('8deb12','test_env4', 'testing1') +>>> balena.models.device.config_var.set('8deb12','BALENA_test_env4', 'testing1') ``` ## DeviceEnvVariable diff --git a/balena/models/device.py b/balena/models/device.py index 2c58ea63..d94ceb73 100644 --- a/balena/models/device.py +++ b/balena/models/device.py @@ -2145,14 +2145,14 @@ def get(self, uuid_or_id: Union[str, int], env_var_name: str) -> Optional[str]: def set(self, uuid_or_id: Union[str, int], env_var_name: str, value: str) -> None: """ Set the value of a device config variable. - + Note that config variables must start with BALENA_ and RESIN_ prefixes. Args: uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. Examples: - >>> balena.models.device.config_var.device.set('8deb12','test_env4', 'testing1') + >>> balena.models.device.config_var.set('8deb12','BALENA_test_env4', 'testing1') """ super(DeviceConfigVariable, self)._set(uuid_or_id, env_var_name, value)