Просмотр исходного кода

case if porter.yaml does not exist (#2997)

Feroze Mohideen 3 лет назад
Родитель
Сommit
d973ebff78
1 измененных файлов с 2 добавлено и 8 удалено
  1. 2 8
      cli/cmd/apply.go

+ 2 - 8
cli/cmd/apply.go

@@ -107,18 +107,12 @@ func init() {
 }
 }
 
 
 func apply(_ *types.GetAuthenticatedUserResponse, client *api.Client, _ []string) error {
 func apply(_ *types.GetAuthenticatedUserResponse, client *api.Client, _ []string) error {
-	var fileBytes []byte
-	var err error
-	if porterYAML == "" {
+	fileBytes, err := ioutil.ReadFile(porterYAML)
+	if err != nil {
 		stackName := os.Getenv("PORTER_STACK_NAME")
 		stackName := os.Getenv("PORTER_STACK_NAME")
 		if stackName == "" {
 		if stackName == "" {
 			return fmt.Errorf("a valid porter.yaml file must be specified. Run porter apply --help for more information")
 			return fmt.Errorf("a valid porter.yaml file must be specified. Run porter apply --help for more information")
 		}
 		}
-	} else {
-		fileBytes, err = ioutil.ReadFile(porterYAML)
-		if err != nil {
-			return fmt.Errorf("error reading porter.yaml: %w", err)
-		}
 	}
 	}
 
 
 	var previewVersion struct {
 	var previewVersion struct {