added support for docker-compose.yaml besides docker-compose.yml

This commit is contained in:
Abhishek
2017-01-23 13:30:33 +05:30
parent 99c1a79fbd
commit 96a0572f50
12 changed files with 810 additions and 4 deletions
+18
View File
@@ -38,6 +38,7 @@ import (
"github.com/kubernetes-incubator/kompose/pkg/transformer"
"github.com/kubernetes-incubator/kompose/pkg/transformer/kubernetes"
"github.com/kubernetes-incubator/kompose/pkg/transformer/openshift"
"os"
)
const (
@@ -133,6 +134,23 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
}
}
// ValidateComposeFile validated the compose file provided for conversion
func ValidateComposeFile(cmd *cobra.Command, opt *kobject.ConvertOptions) {
if len(opt.InputFiles) == 0 {
// Here docker-compose is the input
opt.InputFiles = []string{"docker-compose.yml"}
_, err := os.Stat("docker-compose.yml")
if err != nil {
logrus.Debugf("'docker-compose.yml' not found: %v", err)
opt.InputFiles = []string{"docker-compose.yaml"}
_, err = os.Stat("docker-compose.yaml")
if err != nil {
logrus.Fatalf("No 'docker-compose' file found: %v", err)
}
}
}
}
func validateControllers(opt *kobject.ConvertOptions) {
singleOutput := len(opt.OutFile) != 0 || opt.OutFile == "-" || opt.ToStdout
-3
View File
@@ -233,9 +233,6 @@ func (c *Compose) LoadFile(files []string) kobject.KomposeObject {
LoadedFrom: "compose",
}
context := &project.Context{}
if len(files) == 0 {
files = append(files, "docker-compose.yml")
}
context.ComposeFiles = files
if context.ResourceLookup == nil {