From ca3e9ea4871a1fb594a205ed154a890d2bc6932a Mon Sep 17 00:00:00 2001 From: "Thibault \"bui\" Koechlin" Date: Thu, 1 Jul 2021 18:38:45 +0200 Subject: [PATCH] load hub file properly when restoring config from tmpdir (#847) --- cmd/crowdsec-cli/utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/crowdsec-cli/utils.go b/cmd/crowdsec-cli/utils.go index 98502d667..e248ffc50 100644 --- a/cmd/crowdsec-cli/utils.go +++ b/cmd/crowdsec-cli/utils.go @@ -535,6 +535,13 @@ func silenceInstallItem(name string, obtype string) (string, error) { func RestoreHub(dirPath string) error { var err error + if err := csConfig.LoadHub(); err != nil { + return err + } + if err := setHubBranch(); err != nil { + return fmt.Errorf("error while setting hub branch: %s", err) + } + for _, itype := range cwhub.ItemTypes { itemDirectory := fmt.Sprintf("%s/%s/", dirPath, itype) if _, err = os.Stat(itemDirectory); err != nil {