commhostport isn't present if communicator is null; protect casting in a check

This commit is contained in:
Megan Marsh 2020-10-21 13:33:54 -07:00
parent ee4b3e796e
commit f1f834b8fe
1 changed files with 4 additions and 1 deletions

View File

@ -282,7 +282,10 @@ func (s *stepRun) applyUserOverrides(defaultArgs map[string]interface{}, config
if len(config.QemuArgs) > 0 { if len(config.QemuArgs) > 0 {
s.ui.Say("Overriding default Qemu arguments with qemuargs template option...") s.ui.Say("Overriding default Qemu arguments with qemuargs template option...")
commHostPort := state.Get("commHostPort").(int) commHostPort := 0
if config.CommConfig.Comm.Type != "none" {
commHostPort = state.Get("commHostPort").(int)
}
httpIp := state.Get("http_ip").(string) httpIp := state.Get("http_ip").(string)
httpPort := state.Get("http_port").(int) httpPort := state.Get("http_port").(int)