Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converge panics when encountering an empty conditional #407

Closed
rebeccaskinner opened this issue Oct 21, 2016 · 1 comment
Closed

converge panics when encountering an empty conditional #407

rebeccaskinner opened this issue Oct 21, 2016 · 1 comment
Labels
Milestone

Comments

@rebeccaskinner
Copy link
Contributor

Panic:

switch "foo" {
  default {}
}

No Panic:

switch "foo" {
  default { }
}

Panic Output:
./converge plan --local test.hcl | pp -parse
2016-10-21T14:44:17-05:00 |INFO| serving addr=:47740 component=rpc
2016-10-21T14:44:17-05:00 |WARN| skipping module verification component=client
panic: runtime error: slice bounds out of range

goroutine 11 [running]:
panic(0x625820, 0xc420012110)
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:500 +0x1a1
github.com/asteris-llc/converge/parse/preprocessor/switch.InnerText(0xc4201e3f60, 0xc4201ae6c0, 0x1e, 0x21e, 0x2, 0x3, 0xc4201dd2a7, 0x7, 0x2)
/Users/rebecca/go/src/github.com/asteris-llc/converge/parse/preprocessor/switch/switch.go:136 +0xcd
github.com/asteris-llc/converge/parse/preprocessor/switch.parseDefault(0xc4201e3f60, 0xc4201ae6c0, 0x1e, 0x21e, 0xc4200a9101, 0x3, 0xc41ffec7ed)
/Users/rebecca/go/src/github.com/asteris-llc/converge/parse/preprocessor/switch/case.go:75 +0x56
github.com/asteris-llc/converge/parse/preprocessor/switch.ParseSwitchConditional(0xc4201e3f60, 0xc4201ae6c0, 0x1e, 0x21e, 0xc42020c400, 0x5e8740, 0xbaa000)
/Users/rebecca/go/src/github.com/asteris-llc/converge/parse/preprocessor/switch/switch.go:119 +0x22b
github.com/asteris-llc/converge/parse/preprocessor/switch.Cases(0xc420270240, 0xc4201ae6c0, 0x1e, 0x21e, 0xc4200a9101, 0xc4201dd220, 0xc4200a90e0, 0xc4200f75d0, 0x41e117)
/Users/rebecca/go/src/github.com/asteris-llc/converge/parse/preprocessor/switch/switch.go:102 +0x159
github.com/asteris-llc/converge/parse/preprocessor/switch.NewSwitch(0xc4201e3e40, 0xc4201ae6c0, 0x1e, 0x21e, 0xc4200f76a8, 0xc4201dd500, 0x0)
/Users/rebecca/go/src/github.com/asteris-llc/converge/parse/preprocessor/switch/switch.go:60 +0x270
github.com/asteris-llc/converge/load.expandSwitchMacro(0xc4201ae6c0, 0x1e, 0x21e, 0xc4201e18c0, 0xc4201e3e40, 0xc4201e1f20, 0x0, 0x0, 0x0)
/Users/rebecca/go/src/github.com/asteris-llc/converge/load/nodes.go:128 +0xab
github.com/asteris-llc/converge/load.Nodes(0x9fe280, 0xc4201e1770, 0xc4201dd080, 0x8, 0x5e8700, 0xc4201dd0f0, 0x6e0f61, 0x8)
/Users/rebecca/go/src/github.com/asteris-llc/converge/load/nodes.go:94 +0x5bd
github.com/asteris-llc/converge/load.Load(0x9fe280, 0xc4201e1770, 0xc4201dd080, 0x8, 0xc4201dd000, 0xc42026e0c0, 0x7cef3, 0x6904c0)
/Users/rebecca/go/src/github.com/asteris-llc/converge/load/load.go:26 +0x56
github.com/asteris-llc/converge/rpc/pb.(_LoadRequest).Load(0xc4201e3840, 0x9fe280, 0xc4201e1770, 0x0, 0x0, 0xc42026e080)
/Users/rebecca/go/src/github.com/asteris-llc/converge/rpc/pb/loadrequest.go:32 +0x103
github.com/asteris-llc/converge/rpc.(_executor).Plan(0xc42002e208, 0xc4201e3840, 0xa00700, 0xc4201dd090, 0x0, 0xc42002ccc8)
/Users/rebecca/go/src/github.com/asteris-llc/converge/rpc/executor.go:116 +0x2b7
github.com/asteris-llc/converge/rpc/pb._Executor_Plan_Handler(0x687140, 0xc42002e208, 0x9ff5c0, 0xc4201c8e10, 0x38, 0x30)
/Users/rebecca/go/src/github.com/asteris-llc/converge/rpc/pb/root.pb.go:512 +0x117
github.com/asteris-llc/converge/vendor/google.golang.org/grpc.(_Server).processStreamingRPC(0xc4201db4a0, 0xa011e0, 0xc4201e4090, 0xc42020a0f0, 0xc4201e0c00, 0xa1ddc0, 0xc4201e14a0, 0x0, 0x0)
/Users/rebecca/go/src/github.com/asteris-llc/converge/vendor/google.golang.org/grpc/server.go:689 +0x702
github.com/asteris-llc/converge/vendor/google.golang.org/grpc.(_Server).handleStream(0xc4201db4a0, 0xa011e0, 0xc4201e4090, 0xc42020a0f0, 0xc4201e14a0)
/Users/rebecca/go/src/github.com/asteris-llc/converge/vendor/google.golang.org/grpc/server.go:773 +0xc36
github.com/asteris-llc/converge/vendor/google.golang.org/grpc.(_Server).serveStreams.func1.1(0xc42014a9f0, 0xc4201db4a0, 0xa011e0, 0xc4201e4090, 0xc42020a0f0)
/Users/rebecca/go/src/github.com/asteris-llc/converge/vendor/google.golang.org/grpc/server.go:422 +0xab
created by github.com/asteris-llc/converge/vendor/google.golang.org/grpc.(_Server).serveStreams.func1
/Users/rebecca/go/src/github.com/asteris-llc/converge/vendor/google.golang.org/grpc/server.go:423 +0xa3

@BrianHicks BrianHicks added this to the 0.3.0 milestone Oct 21, 2016
@BrianHicks
Copy link
Contributor

Fixed in #408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants