Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config

This commit is contained in:
Adrien Delorme 2019-08-29 14:22:16 +02:00
commit 9f8e9893b3
4 changed files with 14 additions and 2 deletions

View File

@ -85,19 +85,20 @@ func (s *StepPreValidate) Run(ctx context.Context, state multistep.StateBag) mul
ec2conn := state.Get("ec2").(*ec2.EC2) ec2conn := state.Get("ec2").(*ec2.EC2)
ui.Say(fmt.Sprintf("Prevalidating AMI Name: %s", s.DestAmiName)) ui.Say(fmt.Sprintf("Prevalidating AMI Name: %s", s.DestAmiName))
resp, err := ec2conn.DescribeImages(&ec2.DescribeImagesInput{ req, resp := ec2conn.DescribeImagesRequest(&ec2.DescribeImagesInput{
Filters: []*ec2.Filter{{ Filters: []*ec2.Filter{{
Name: aws.String("name"), Name: aws.String("name"),
Values: []*string{aws.String(s.DestAmiName)}, Values: []*string{aws.String(s.DestAmiName)},
}}}) }}})
req.RetryCount = 11
err := req.Send()
if err != nil { if err != nil {
err := fmt.Errorf("Error querying AMI: %s", err) err := fmt.Errorf("Error querying AMI: %s", err)
state.Put("error", err) state.Put("error", err)
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt
} }
if len(resp.Images) > 0 { if len(resp.Images) > 0 {
err := fmt.Errorf("Error: AMI Name: '%s' is used by an existing AMI: %s", *resp.Images[0].Name, *resp.Images[0].ImageId) err := fmt.Errorf("Error: AMI Name: '%s' is used by an existing AMI: %s", *resp.Images[0].Name, *resp.Images[0].ImageId)
state.Put("error", err) state.Put("error", err)

View File

@ -240,6 +240,10 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C
} }
hostSigner, err := newSigner(p.config.SSHHostKeyFile) hostSigner, err := newSigner(p.config.SSHHostKeyFile)
if err != nil {
return fmt.Errorf("error creating host signer: %s", err)
}
// Remove the private key file // Remove the private key file
if len(k.privKeyFile) > 0 { if len(k.privKeyFile) > 0 {
defer os.Remove(k.privKeyFile) defer os.Remove(k.privKeyFile)

View File

@ -217,6 +217,10 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C
} }
hostSigner, err := newSigner(p.config.SSHHostKeyFile) hostSigner, err := newSigner(p.config.SSHHostKeyFile)
if err != nil {
return fmt.Errorf("error creating host signer: %s", err)
}
// Remove the private key file // Remove the private key file
if len(k.privKeyFile) > 0 { if len(k.privKeyFile) > 0 {
defer os.Remove(k.privKeyFile) defer os.Remove(k.privKeyFile)

View File

@ -182,6 +182,9 @@
<li<%= sidebar_current("docs-builders-profitbricks") %>> <li<%= sidebar_current("docs-builders-profitbricks") %>>
<a href="/docs/builders/profitbricks.html">ProfitBricks</a> <a href="/docs/builders/profitbricks.html">ProfitBricks</a>
</li> </li>
<li<%= sidebar_current("docs-builders-proxmox") %>>
<a href="/docs/builders/proxmox.html">Proxmox</a>
</li>
<li<%= sidebar_current("docs-builders-qemu") %>> <li<%= sidebar_current("docs-builders-qemu") %>>
<a href="/docs/builders/qemu.html">QEMU</a> <a href="/docs/builders/qemu.html">QEMU</a>
</li> </li>