This commit is contained in:
Philippe Caseiro 2022-06-29 17:00:24 +02:00
parent 6b26722bc7
commit b25127549a
2 changed files with 13 additions and 5 deletions

View File

@ -70,7 +70,6 @@ func (hr *APKRepository) Update() error {
if _, stdErr, err := utils.RunSystemCommand("apk", "update"); err != nil { if _, stdErr, err := utils.RunSystemCommand("apk", "update"); err != nil {
return fmt.Errorf("%s [%s]", stdErr, err) return fmt.Errorf("%s [%s]", stdErr, err)
} }
return nil return nil
} }
@ -88,7 +87,10 @@ func (hr *APKRepository) Delete() error {
func (hr *APKRepository) Manage() error { func (hr *APKRepository) Manage() error {
if hr.Enabled { if hr.Enabled {
return hr.Add() if err := hr.Add(); err != nil {
return err
}
return hr.Update()
} else { } else {
return hr.Delete() return hr.Delete()
} }

View File

@ -19,15 +19,21 @@ func (s *Service) manageRepos(repos map[string]Repository) error {
for _, repo := range s.Repos { for _, repo := range s.Repos {
if repo.Type == "helm" { if repo.Type == "helm" {
rp := HelmRepository{repo} rp := HelmRepository{repo}
return rp.Manage() if err := rp.Manage(); err != nil {
return err
}
} }
if repo.Type == "apk" { if repo.Type == "apk" {
rp := APKRepository{repo} rp := APKRepository{repo}
return rp.Manage() if err := rp.Manage(); err != nil {
return err
}
} }
if repo.Type == "deb" { if repo.Type == "deb" {
rp := DebRepository{} rp := DebRepository{}
return rp.Manage() if err := rp.Manage(); err != nil {
return err
}
} }
} }