clan-cli: don't try to delete a dir that doesn't exist in the pass vars backend
Do not crash in `delete_store`, if the machine has no vars, or the store has been deleted already.
This commit is contained in:
@@ -77,8 +77,12 @@ class SecretStore(StoreBase):
|
||||
return []
|
||||
|
||||
def delete_store(self) -> Iterable[Path]:
|
||||
machine_pass_dir = Path(self.entry_prefix) / "per-machine" / self.machine.name
|
||||
pass_call = ["rm", "--force", "--recursive", str(machine_pass_dir)]
|
||||
machine_dir = Path(self.entry_prefix) / "per-machine" / self.machine.name
|
||||
if not (self._password_store_dir / machine_dir).exists():
|
||||
# The directory may not exist if the machine
|
||||
# has no vars, or they have been deleted already.
|
||||
return []
|
||||
pass_call = ["rm", "--force", "--recursive", str(machine_dir)]
|
||||
self._run_pass(*pass_call, options=RunOpts(check=True))
|
||||
return []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user