Skip to content

Commit

Permalink
tried to fix CDo
Browse files Browse the repository at this point in the history
Signed-off-by: rjtch <[email protected]>
  • Loading branch information
rjtch committed Oct 27, 2023
1 parent 4b945fd commit ac2152e
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions pkg/kapp/cmd/appgroup/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,12 @@ func (o *DeployOptions) Run() error {
return err
}

// Delete apps that no longer are present in directories..
// Delete apps that no longer are present in directories
for _, app := range existingAppsInGroup {
for _, v := range updatedApps {
if app.Name() == v.Name {
err := o.deleteApp(app.Name())
if err != nil {
return err
}
if _, found := updatedApps[app.Name()]; !found {
err := o.deleteApp(app.Name())
if err != nil {
return err
}
}
}
Expand All @@ -119,14 +117,13 @@ type appGroupApp struct {
Path string
}

func (o *DeployOptions) appsToUpdate() ([]appGroupApp, error) {
var applications []appGroupApp

func (o *DeployOptions) appsToUpdate() (map[string]appGroupApp, error) {
result := map[string]appGroupApp{}
dir := o.DeployFlags.Directory

fileInfos, err := os.ReadDir(dir)
if err != nil {
return nil, fmt.Errorf("Reading directories '%s': %w", dir, err)
return nil, fmt.Errorf("Reading directory '%s': %w", dir, err)
}

for _, fi := range fileInfos {
Expand All @@ -137,9 +134,10 @@ func (o *DeployOptions) appsToUpdate() ([]appGroupApp, error) {
Name: fmt.Sprintf("%s-%s", o.AppGroupFlags.Name, fi.Name()),
Path: filepath.Join(dir, fi.Name()),
}
applications = append(applications, app)
result[app.Name] = app
}
return applications, nil

return result, nil
}

func (o *DeployOptions) deployApp(app appGroupApp) error {
Expand Down

0 comments on commit ac2152e

Please sign in to comment.