MCPcopy
hub / github.com/borgbackup/borg / find_key

Method find_key

src/borg/crypto/key.py:616–633  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers 6

detectMethod · 0.80
load_keyblobMethod · 0.80
basic_json_dataFunction · 0.80
do_repo_infoMethod · 0.80

Calls 8

sanity_checkMethod · 0.95
_find_key_in_keys_dirMethod · 0.95
get_keys_dirFunction · 0.85
canonical_pathMethod · 0.45
load_keyMethod · 0.45

Tested by

no test coverage detected