forked from LaconicNetwork/kompose
Remove redundant strings.ToLower()
Removes the redundant strings.ToLower commands for GlobalProvider in up.go, convert.go and down.go
This commit is contained in:
parent
36652f6d81
commit
a930ce266f
@ -17,8 +17,6 @@ limitations under the License.
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/kubernetes/kompose/pkg/app"
|
"github.com/kubernetes/kompose/pkg/app"
|
||||||
"github.com/kubernetes/kompose/pkg/kobject"
|
"github.com/kubernetes/kompose/pkg/kobject"
|
||||||
@ -46,17 +44,13 @@ var (
|
|||||||
ConvertOpt kobject.ConvertOptions
|
ConvertOpt kobject.ConvertOptions
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConvertProvider TODO: comment
|
|
||||||
var ConvertProvider = GlobalProvider
|
|
||||||
|
|
||||||
var convertCmd = &cobra.Command{
|
var convertCmd = &cobra.Command{
|
||||||
Use: "convert [file]",
|
Use: "convert [file]",
|
||||||
Short: "Convert a Docker Compose file",
|
Short: "Convert a Docker Compose file",
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// Check that build-config wasn't passed in with --provider=kubernetes
|
// Check that build-config wasn't passed in with --provider=kubernetes
|
||||||
provider := strings.ToLower(GlobalProvider)
|
if GlobalProvider == "kubernetes" && UpBuild == "build-config" {
|
||||||
if provider == "kubernetes" && UpBuild == "build-config" {
|
|
||||||
log.Fatalf("build-config is not a valid --build parameter with provider Kubernetes")
|
log.Fatalf("build-config is not a valid --build parameter with provider Kubernetes")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +63,7 @@ var convertCmd = &cobra.Command{
|
|||||||
Replicas: ConvertReplicas,
|
Replicas: ConvertReplicas,
|
||||||
InputFiles: GlobalFiles,
|
InputFiles: GlobalFiles,
|
||||||
OutFile: ConvertOut,
|
OutFile: ConvertOut,
|
||||||
Provider: strings.ToLower(GlobalProvider),
|
Provider: GlobalProvider,
|
||||||
CreateD: ConvertDeployment,
|
CreateD: ConvertDeployment,
|
||||||
CreateDS: ConvertDaemonSet,
|
CreateDS: ConvertDaemonSet,
|
||||||
CreateRC: ConvertReplicationController,
|
CreateRC: ConvertReplicationController,
|
||||||
|
|||||||
@ -17,8 +17,6 @@ limitations under the License.
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/kubernetes/kompose/pkg/app"
|
"github.com/kubernetes/kompose/pkg/app"
|
||||||
"github.com/kubernetes/kompose/pkg/kobject"
|
"github.com/kubernetes/kompose/pkg/kobject"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -39,7 +37,7 @@ var downCmd = &cobra.Command{
|
|||||||
// Create the Convert options.
|
// Create the Convert options.
|
||||||
DownOpt = kobject.ConvertOptions{
|
DownOpt = kobject.ConvertOptions{
|
||||||
InputFiles: GlobalFiles,
|
InputFiles: GlobalFiles,
|
||||||
Provider: strings.ToLower(GlobalProvider),
|
Provider: GlobalProvider,
|
||||||
Namespace: DownNamespace,
|
Namespace: DownNamespace,
|
||||||
IsNamespaceFlag: cmd.Flags().Lookup("namespace").Changed,
|
IsNamespaceFlag: cmd.Flags().Lookup("namespace").Changed,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/kubernetes/kompose/pkg/app"
|
"github.com/kubernetes/kompose/pkg/app"
|
||||||
"github.com/kubernetes/kompose/pkg/kobject"
|
"github.com/kubernetes/kompose/pkg/kobject"
|
||||||
@ -42,8 +41,7 @@ var upCmd = &cobra.Command{
|
|||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// Check that build-config wasn't passed in with --provider=kubernetes
|
// Check that build-config wasn't passed in with --provider=kubernetes
|
||||||
provider := strings.ToLower(GlobalProvider)
|
if GlobalProvider == "kubernetes" && UpBuild == "build-config" {
|
||||||
if provider == "kubernetes" && UpBuild == "build-config" {
|
|
||||||
log.Fatalf("build-config is not a valid --build parameter with provider Kubernetes")
|
log.Fatalf("build-config is not a valid --build parameter with provider Kubernetes")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +50,7 @@ var upCmd = &cobra.Command{
|
|||||||
Build: UpBuild,
|
Build: UpBuild,
|
||||||
Replicas: UpReplicas,
|
Replicas: UpReplicas,
|
||||||
InputFiles: GlobalFiles,
|
InputFiles: GlobalFiles,
|
||||||
Provider: strings.ToLower(GlobalProvider),
|
Provider: GlobalProvider,
|
||||||
EmptyVols: UpEmptyVols,
|
EmptyVols: UpEmptyVols,
|
||||||
Namespace: UpNamespace,
|
Namespace: UpNamespace,
|
||||||
InsecureRepository: UpInsecureRepo,
|
InsecureRepository: UpInsecureRepo,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user