glassechidna / stackit

Cross-platform CloudFormation CLI tool for easy synchronous and idempotent stack updates
Apache License 2.0
37 stars 7 forks source link

`package` crashes when YAML template has no transforms #32

Closed aidansteele closed 5 years ago

aidansteele commented 5 years ago

https://github.com/glassechidna/stackit/blob/8e239981015bdb6389c580bf411dcaf7ce13eb78/cmd/load_save.go#L16

This code assumes that the processed template will be JSON, which is only true if a) the input template was JSON or b) there are transforms in the input template.

It causes this issue:

invalid character 'A' looking for beginning of value
pretty-printing json of template body
github.com/glassechidna/stackit/cmd.savePreparedOutput
    /github/workspace/cmd/load_save.go:18
github.com/glassechidna/stackit/cmd.packageTemplate
    /github/workspace/cmd/package.go:81
github.com/glassechidna/stackit/cmd.init.2.func1
    /github/workspace/cmd/package.go:144
github.com/spf13/cobra.(*Command).execute
    /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:766
github.com/spf13/cobra.(*Command).ExecuteC
    /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852
github.com/spf13/cobra.(*Command).Execute
    /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800
github.com/glassechidna/stackit/cmd.Execute
    /github/workspace/cmd/root.go:44