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):