github.phpd.cn/hashicorp/packer@v1.3.2/builder/cloudstack/ssh.go (about)

     1  package cloudstack
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/packer/helper/multistep"
     7  )
     8  
     9  func commHost(state multistep.StateBag) (string, error) {
    10  	ip, hasIP := state.Get("ipaddress").(string)
    11  	if !hasIP {
    12  		return "", fmt.Errorf("Failed to retrieve IP address")
    13  	}
    14  
    15  	return ip, nil
    16  }
    17  
    18  func commPort(state multistep.StateBag) (int, error) {
    19  	commPort, hasPort := state.Get("commPort").(int)
    20  	if !hasPort {
    21  		return 0, fmt.Errorf("Failed to retrieve communication port")
    22  	}
    23  
    24  	return commPort, nil
    25  }