Skip to content

Commit

Permalink
Deployment only out of .json files #222 Bug Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Vallolikalathil Achuthadas <[email protected]>
  • Loading branch information
AnishVallolikalathilAchuthadas committed Jun 5, 2024
1 parent 4b2cd25 commit 9d5905c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions containerm/cli/cli_command_ctrs_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"os"
"time"
"strings"

"github.com/eclipse-kanto/container-management/containerm/containers/types"
"github.com/eclipse-kanto/container-management/containerm/log"
Expand Down Expand Up @@ -114,6 +115,10 @@ func (cc *createCmd) containerFromFile() (*types.Container, error) {
if err != nil {
return nil, err
}
if !strings.HasSuffix(strings.ToLower(cc.config.containerFile), ".json") {
fileName := cc.config.containerFile
return nil, log.NewError(fmt.Sprintf("file %s is not a json file", fileName))
}
byteValue, err := os.ReadFile(cc.config.containerFile)
if err != nil {
return nil, err
Expand Down

0 comments on commit 9d5905c

Please sign in to comment.