From 6a56d5b87b75d017aa93e748b3b0bac051f84632 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 7 Jan 2016 21:06:45 +0100 Subject: [PATCH] Repo: Add more debug --- repository/key.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repository/key.go b/repository/key.go index 40e75f11d..22ed2ca2e 100644 --- a/repository/key.go +++ b/repository/key.go @@ -13,6 +13,7 @@ import ( "github.com/restic/restic/backend" "github.com/restic/restic/crypto" + "github.com/restic/restic/debug" ) var ( @@ -58,6 +59,7 @@ func createMasterKey(s *Repository, password string) (*Key, error) { func OpenKey(s *Repository, name string, password string) (*Key, error) { k, err := LoadKey(s, name) if err != nil { + debug.Log("OpenKey", "LoadKey(%v) returned error %v", name[:12], err) return nil, err } @@ -82,6 +84,7 @@ func OpenKey(s *Repository, name string, password string) (*Key, error) { k.master = &crypto.Key{} err = json.Unmarshal(buf, k.master) if err != nil { + debug.Log("OpenKey", "Unmarshal() returned error %v", err) return nil, err } k.name = name @@ -100,11 +103,14 @@ func SearchKey(s *Repository, password string) (*Key, error) { done := make(chan struct{}) defer close(done) for name := range s.Backend().List(backend.Key, done) { + debug.Log("SearchKey", "trying key %v", name[:12]) key, err := OpenKey(s, name, password) if err != nil { + debug.Log("SearchKey", "key %v returned error %v", name[:12], err) continue } + debug.Log("SearchKey", "successfully opened key %v", name[:12]) return key, nil }