Skip to content

Commit

Permalink
chore: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
karlderkaefer committed Dec 14, 2024
1 parent 3e7cfa5 commit 685c440
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (d *DefaultStrategy) Logout() error {

// NewRegistryHelper creates a new RegistryHelper
// secretNames is a comma separated list of registry secrets
func NewRegistryHelper(secretNames string, namespace string, config *HelmUpdateConfig) *RegistryHelper {
func NewRegistryHelper(secretNames string, namespace string, config *HelmUpdateConfig) (*RegistryHelper, error) {
registryMap := make(map[string]*RegistryInfo)
for _, registry := range strings.Split(secretNames, ",") {
if registry != "" {
Expand All @@ -95,9 +95,12 @@ func NewRegistryHelper(secretNames string, namespace string, config *HelmUpdateC
config: config,
}
if config.UseRandomHelmCacheDir {
r.SetRandomHelmCacheDir()
err := r.SetRandomHelmCacheDir()
if err != nil {
return r, err
}
}
return r
return r, nil
}

func (r *RegistryHelper) SetRandomHelmCacheDir() error {
Expand Down Expand Up @@ -153,7 +156,7 @@ func (r *RegistryHelper) LoginIfExists(registry *RegistryInfo) error {
return action.Login()
}
if !registry.EnableOCI {
log.Printf("Registry %s ", registry.SecretName)
log.Printf("Registry %s not found in secrets, adding it as a repo", registry.SecretName)
action := GetRegistryAction(registry)
return action.Login()
}
Expand Down
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ func main() {
}
// just for backward compatibility
comnbinedSecretNames := strings.Join([]string{*secretNames, *addRegistries}, ",")
registryHelper := NewRegistryHelper(comnbinedSecretNames, *secretNamespace, config)

err := registryHelper.UpdateRegistryInfo()
registryHelper, err := NewRegistryHelper(comnbinedSecretNames, *secretNamespace, config)
if err != nil {
log.Fatal("Unable to create random helm chart cache dir: ", err)
}
err = registryHelper.UpdateRegistryInfo()
if err != nil {
log.Fatal("Unable to update registry info: ", err)
}
Expand Down

0 comments on commit 685c440

Please sign in to comment.