(self)
| 614 | return filename |
| 615 | |
| 616 | def find_key(self): |
| 617 | if self.STORAGE == KeyBlobStorage.KEYFILE: |
| 618 | keyfile = self._find_key_file_from_environment() |
| 619 | if keyfile is not None: |
| 620 | return self.sanity_check(keyfile, self.repository.id) |
| 621 | keyfile = self._find_key_in_keys_dir() |
| 622 | if keyfile is not None: |
| 623 | return keyfile |
| 624 | raise KeyfileNotFoundError(self.repository._location.canonical_path(), get_keys_dir()) |
| 625 | elif self.STORAGE == KeyBlobStorage.REPO: |
| 626 | loc = self.repository._location.canonical_path() |
| 627 | key = self.repository.load_key() |
| 628 | if not key: |
| 629 | # if we got an empty key, it means there is no key. |
| 630 | raise RepoKeyNotFoundError(loc) from None |
| 631 | return loc |
| 632 | else: |
| 633 | raise TypeError("Unsupported borg key storage type") |
| 634 | |
| 635 | def get_existing_or_new_target(self, args): |
| 636 | keyfile = self._find_key_file_from_environment() |
no test coverage detected