Skip to content

Commit

Permalink
Fix application install logic when creating cluster (#289)
Browse files Browse the repository at this point in the history
* Update kubernetes_create.go

* Update kubernetes_create.go

Co-authored-by: Haardik Dharma <haardik@civo.com>
  • Loading branch information
haardikdharma10 and haardikdharma10 authored Nov 24, 2022
1 parent 60c613e commit 65c1e61
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions cmd/kubernetes/kubernetes_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,25 @@ var kubernetesCreateCmd = &cobra.Command{

// InstallApps returns the list of applications to install
func InstallApps(defaultApps []string, apps, removeApps string) []string {
var iApps []string
var appsToInstall []string

if apps != "" {
iApps = strings.Split(apps, ",")
appsToInstall = strings.Split(apps, ",")
appsToInstall = append(appsToInstall, defaultApps...)
} else {
appsToInstall = defaultApps
}
iApps = append(defaultApps, iApps...)

if removeApps != "" {
for i, v := range iApps {
for _, v2 := range strings.Split(removeApps, ",") {
if v == v2 {
iApps = append(iApps[:i], iApps[i+1:]...)
appsToRemove := strings.Split(removeApps, ",")
for _, appToRemove := range appsToRemove {
for i, app := range appsToInstall {
if app == appToRemove {
appsToInstall = append(appsToInstall[:i], appsToInstall[i+1:]...)
}
}
}
}
return iApps

return appsToInstall
}

0 comments on commit 65c1e61

Please sign in to comment.