From 685193602e79c4911282003440cb75b1b09e2acc Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 30 Mar 2026 12:05:13 +0200 Subject: [PATCH] cli (profile): fix profile check for `create` and `delete`: When checking existing profiles with `bridge.profiles_list_get`, all profiles have to be retrieved, including components. --- libervia/cli/cmd_profile.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libervia/cli/cmd_profile.py b/libervia/cli/cmd_profile.py index b062fb76..66fb6061 100644 --- a/libervia/cli/cmd_profile.py +++ b/libervia/cli/cmd_profile.py @@ -118,7 +118,7 @@ class ProfileCreate(base.CommandBase): async def start(self): """Create a new profile""" - if self.args.profile in await self.host.bridge.profiles_list_get(): + if self.args.profile in await self.host.bridge.profiles_list_get(True, True): self.disp(f"Profile {self.args.profile} already exists.", error=True) self.host.quit(C.EXIT_BRIDGE_ERROR) try: @@ -189,7 +189,7 @@ class ProfileDelete(base.CommandBase): ) async def start(self): - if self.args.profile not in await self.host.bridge.profiles_list_get(): + if self.args.profile not in await self.host.bridge.profiles_list_get(True, True): log.error(f"Profile {self.args.profile} doesn't exist.") self.host.quit(C.EXIT_NOT_FOUND) if not self.args.force: @@ -197,8 +197,13 @@ class ProfileDelete(base.CommandBase): cancel_message = "Profile deletion cancelled" await self.host.confirm_or_quit(message, cancel_message) - await self.host.bridge.profile_delete_async(self.args.profile) - self.host.quit() + try: + await self.host.bridge.profile_delete_async(self.args.profile) + except Exception as e: + self.disp(f"can't delete profile: {e}", error=True) + self.host.quit(C.EXIT_BRIDGE_ERRBACK) + else: + self.host.quit() class ProfileInfo(base.CommandBase):