Skip to content

Commit

Permalink
fix: delete
Browse files Browse the repository at this point in the history
  • Loading branch information
tvirgl-wish authored and tvi committed Apr 27, 2019
1 parent 4684c7b commit 62c7f7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/kops/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,18 @@ func generateChannel(ctx context.Context, c Channel, file string) error {

return nil
}

func deleteChannel(ctx context.Context, c Channel) error {
dest, err := vfs.Context.BuildVfsPath(c.Path)
if err != nil {
return err
}
if err := dest.Join(c.Name + ".yaml").Remove(); err != nil {
return err
}
if err := dest.Join(c.Name + ".json").Remove(); err != nil {
return err
}

return nil
}
6 changes: 6 additions & 0 deletions pkg/kops/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func Delete(ctx context.Context, file string) (err error) {
if out.Kops == nil {
return fmt.Errorf("kops configuration is missing")
}
for _, c := range out.Kops.Channels {
err := deleteChannel(ctx, c)
if err != nil {
return fmt.Errorf("could not delete channel: %v", err)
}
}

kopsEnv := os.Environ()
for k, v := range out.Kops.Env {
Expand Down

0 comments on commit 62c7f7d

Please sign in to comment.