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.
This commit is contained in:
parent
d3113ed2d8
commit
685193602e
1 changed files with 9 additions and 4 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue