Fix cloudstack builder (#4139)

* add zone id when associate ip address in cloudstack

* configure keypair

* fix bug firewall port
This commit is contained in:
nyankichi820 2016-11-10 21:21:08 +09:00 committed by Sander van Harmelen
parent 6be3860412
commit d1eadd91bb
2 changed files with 12 additions and 4 deletions

View File

@ -73,6 +73,10 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
p.SetNetworkid(network.Id) p.SetNetworkid(network.Id)
} }
if config.Zone != "" {
p.SetZoneid(config.Zone)
}
// Associate a new public IP address. // Associate a new public IP address.
ipAddr, err := client.Address.AssociateIpAddress(p) ipAddr, err := client.Address.AssociateIpAddress(p)
if err != nil { if err != nil {
@ -125,8 +129,8 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
p.SetAclid(network.Aclid) p.SetAclid(network.Aclid)
p.SetAction("allow") p.SetAction("allow")
p.SetCidrlist(config.CIDRList) p.SetCidrlist(config.CIDRList)
p.SetStartport(s.privatePort) p.SetStartport(s.publicPort)
p.SetEndport(s.privatePort) p.SetEndport(s.publicPort)
p.SetTraffictype("ingress") p.SetTraffictype("ingress")
// Create the network ACL rule. // Create the network ACL rule.
@ -146,8 +150,8 @@ func (s *stepSetupNetworking) Run(state multistep.StateBag) multistep.StepAction
// Configure the firewall rule. // Configure the firewall rule.
p.SetCidrlist(config.CIDRList) p.SetCidrlist(config.CIDRList)
p.SetStartport(s.privatePort) p.SetStartport(s.publicPort)
p.SetEndport(s.privatePort) p.SetEndport(s.publicPort)
fwRule, err := client.Firewall.CreateFirewallRule(p) fwRule, err := client.Firewall.CreateFirewallRule(p)
if err != nil { if err != nil {

View File

@ -60,6 +60,10 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
p.SetProjectid(config.Project) p.SetProjectid(config.Project)
} }
if config.Keypair != "" {
p.SetKeypair(config.Keypair)
}
if config.UserData != "" { if config.UserData != "" {
ud, err := getUserData(config.UserData, config.HTTPGetOnly) ud, err := getUserData(config.UserData, config.HTTPGetOnly)
if err != nil { if err != nil {