Skip to content

Commit

Permalink
fix(list): fix a bug packages in that same aqua.yaml is outputted by …
Browse files Browse the repository at this point in the history
…list --installed
  • Loading branch information
suzuki-shunsuke committed Mar 30, 2024
1 parent defc18e commit dfd2ff9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pkg/controller/list/list_installed.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package list

import (
"fmt"
"path/filepath"

"github.com/aquaproj/aqua/v2/pkg/config"
"github.com/aquaproj/aqua/v2/pkg/config/aqua"
Expand All @@ -10,7 +11,14 @@ import (
)

func (c *Controller) listInstalled(param *config.Param, logE *logrus.Entry) error {
for _, cfgFilePath := range c.configFinder.Finds(param.PWD, param.ConfigFilePath) {
cfgFilePaths := c.configFinder.Finds(param.PWD, param.ConfigFilePath)
cfgFileMap := map[string]struct{}{}
for _, cfgFilePath := range cfgFilePaths {
if _, ok := cfgFileMap[cfgFilePath]; ok {
continue
}
cfgFileMap[cfgFilePath] = struct{}{}

if err := c.listInstalledByConfig(cfgFilePath); err != nil {
return logerr.WithFields(err, logrus.Fields{ //nolint:wrapcheck
"config_file_path": cfgFilePath,
Expand All @@ -24,6 +32,15 @@ func (c *Controller) listInstalled(param *config.Param, logE *logrus.Entry) erro

for _, cfgFilePath := range param.GlobalConfigFilePaths {
logE := logE.WithField("config_file_path", cfgFilePath)
if !filepath.IsAbs(cfgFilePath) {
cfgFilePath = filepath.Join(param.PWD, cfgFilePath)
}

if _, ok := cfgFileMap[cfgFilePath]; ok {
continue
}
cfgFileMap[cfgFilePath] = struct{}{}

logE.Debug("checking a global configuration file")
if _, err := c.fs.Stat(cfgFilePath); err != nil {
continue
Expand Down

0 comments on commit dfd2ff9

Please sign in to comment.