From b25127549ae079a39bba7c9a3dd9a16548180715 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 29 Jun 2022 17:00:24 +0200 Subject: [PATCH] Try 07 --- pkg/templater/repo-apk.go | 6 ++++-- pkg/templater/services.go | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pkg/templater/repo-apk.go b/pkg/templater/repo-apk.go index 35f3656..8b3b1d8 100644 --- a/pkg/templater/repo-apk.go +++ b/pkg/templater/repo-apk.go @@ -70,7 +70,6 @@ func (hr *APKRepository) Update() error { if _, stdErr, err := utils.RunSystemCommand("apk", "update"); err != nil { return fmt.Errorf("%s [%s]", stdErr, err) } - return nil } @@ -88,7 +87,10 @@ func (hr *APKRepository) Delete() error { func (hr *APKRepository) Manage() error { if hr.Enabled { - return hr.Add() + if err := hr.Add(); err != nil { + return err + } + return hr.Update() } else { return hr.Delete() } diff --git a/pkg/templater/services.go b/pkg/templater/services.go index 7d58597..68f6f18 100644 --- a/pkg/templater/services.go +++ b/pkg/templater/services.go @@ -19,15 +19,21 @@ func (s *Service) manageRepos(repos map[string]Repository) error { for _, repo := range s.Repos { if repo.Type == "helm" { rp := HelmRepository{repo} - return rp.Manage() + if err := rp.Manage(); err != nil { + return err + } } if repo.Type == "apk" { rp := APKRepository{repo} - return rp.Manage() + if err := rp.Manage(); err != nil { + return err + } } if repo.Type == "deb" { rp := DebRepository{} - return rp.Manage() + if err := rp.Manage(); err != nil { + return err + } } }