apache / apache/openwhisk-wskdeploy

Binding a JSON type to a package causes a panic

Open
#1,149 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
75
Forks
73
PR merge metrics
No merged PRs in 30d

Description

In the current master version, binding a JSON type to a package causes a panic

Target manifest
```yaml
packages:
package1:
inputs:
param1:
key1: value1
key2: value2
```

error logs
```sh
./wskdeploy
panic: runtime error: comparing uncomparable type map[string]interface {}

goroutine 1 [running]:
github.com/apache/openwhisk-wskdeploy/parsers.(*YAMLParser).composePackageInputs(0xc000309ea0, 0xc000337410, 0xc0003de750, 0xc000338140, 0x42, 0xc000318d80, 0x56, 0xc0003de8a0, 0x1ff0f50, 0xc000159378, ...)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/parsers/manifest_parser.go:324 +0x679
github.com/apache/openwhisk-wskdeploy/parsers.(*YAMLParser).ComposePackage(0xc000309ea0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/parsers/manifest_parser.go:420 +0x455
github.com/apache/openwhisk-wskdeploy/parsers.(*YAMLParser).ComposeAllPackages(0xc000309ea0, 0xc000337410, 0xc000360fa0, 0xc000338140, 0x42, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/parsers/manifest_parser.go:297 +0x298
github.com/apache/openwhisk-wskdeploy/deployers.(*ManifestReader).InitPackages(0xc0001599f8, 0xc000309ea0, 0xc000360fa0, 0x0, 0x0, 0x0, 0x0, 0x108, 0x108)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/deployers/manifestreader.go:58 +0x96
github.com/apache/openwhisk-wskdeploy/deployers.(*ServiceDeployer).ConstructDeploymentPlan(0xc000364160, 0x25, 0x0)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/deployers/servicedeployer.go:187 +0x3eb
github.com/apache/openwhisk-wskdeploy/cmd.Deploy(0x1880980, 0x0, 0x0)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/cmd/root.go:257 +0x3b7
github.com/apache/openwhisk-wskdeploy/cmd.RootCmdImp(0x1880980, 0x18b79a0, 0x0, 0x0, 0x0, 0x0)
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/cmd/root.go:51 +0x2b
github.com/spf13/cobra.(*Command).execute(0x1880980, 0xc00001e1e0, 0x0, 0x0, 0x1880980, 0xc00001e1e0)
/home/travis/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:852 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x1880980, 0x1, 0x1, 0xc00001e1e0)
/home/travis/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/home/travis/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
github.com/apache/openwhisk-wskdeploy/cmd.Execute()
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/cmd/root.go:65 +0xca
main.main()
/home/travis/gopath/src/github.com/apache/openwhisk-wskdeploy/main.go:26 +0x25
```

Contributor guide

Open the contributing guide

Research direction

Start in parsers/manifest_parser.go at composePackageInputs, line 324, using the package-input manifest shown in the issue and run ./wskdeploy to reproduce the panic. Trace the JSON-valued input through package composition and add coverage for this manifest; done means deployment parsing no longer panics and preserves the nested input.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.