Sometimes the AWS API responds that it can't find a newly created
instance if you poll it too soon after creation. Retry a few times
to be sure it really hasn't been created.
This adds retry logic to the amazon/chroot builder. The builder
intermittently fails when ec2conn shows the volume in the attached
state but calling Volumes[0].Attachments return an empty array. The
fix adds a retry logic for when Volumes[0].Attachments has len 0 sleep
for 2 seconds and retry up to 30 times.
When the Volumes[0].Attachments is empty I find within 5 seconds the
Volumes[0].Attachments contains the correct value.
The issue is reported in:
https://github.com/mitchellh/packer/issues/1854
This commit moves the Amazon builders of Packer away from the Hashicorp
fork of the goamz library to the official AWS SDK for Go, in order that
third party plugins may depend on the more complete official library
more easily.
Relates to #1539
AWS is eventually consistent and instance can be not visibile for
some time after creation. This fix eliminates describe-instances
call before going to the proper wait loop
Fixes the following vet reports:
builder/amazon/common/step_ami_region_copy.go:81: arg target for printf verb %s of wrong type: github.com/mitchellh/goamz/aws.Region
builder/amazon/common/step_ami_region_copy.go:93: arg target for printf verb %s of wrong type: github.com/mitchellh/goamz/aws.Region
These changes permit the use of pre-created SSH keypairs with AWS. If
so, the configuration for the builder needs to include an
ssh_keypair_name option and a ssh_private_key_file.
If ssh_private_key_file is *not* defined, it'll go through the
rigamarole of creating a temporary keypair. The ssh_keypair_name option
by itself won't make that change, because it doesn't make sense to
specify a keypair but not tell packer where the private key is, but it
does happen that you could have a private key and the public-key is
"baked in", and not part of your EC2 account.
Adds a 'ssh_keypair_name' option to the configuration
for AWS, along with some munging to create the
temporarily keypair if one isn't specific.
NOT YET WORKING.
From a 'make' I get the following errors:
builder/amazon/ebs/builder.go:94: b.config.SSHKeyPairName undefined
(type config has no field or method SSHKeyPairName)
builder/amazon/instance/builder.go:199: b.config.SSHKeyPairName
undefined (type Config has no field or method SSHKeyPairName)
- help resolve https://github.com/mitchellh/packer/issues/1533
(although timeouts are always ultimately useless in a distributed
system!)
- makes packer no more idempotent or janitorial than before
- derive maximum number of ticks from timeout
- default timeout to 300s (5m) to cater for global AMI copying
- allow user to override with AWS_TIMEOUT_SECONDS environment variable
Given that state fetching is an idempotent operation, a transient
network error should not cause the entire build to fail. Instead,
retry when such errors are encountered.
In order that something consuming an artifact can have access to extra
builder specific data add the State method which allows the caller to
ask for arbitary values by name.
mount /dev/xvdf /mnt/point
while for an HVM image that is attached to /dev/sdf, its mount command is
mount /dev/xvdf1 /mnt/point
so this code enabled that
This reduces the number of simultaneous packer runs possible significantly, but unless you are Netflix, who have Aminator anyway, this is probably never going to be an issue
With go tip, the output from Artifact.String will sometimes be output in a
different order than the tests. Sort the AMI strings before outputting.
See https://travis-ci.org/mitchellh/packer/jobs/28748467 for an example of this
failure.
According to be5adb92b5, the UploadDir
method supports two ways of copying depending on whether a trailing
slash is used:
src = "dir" -> dest/dir
src = "dir/" -> dest
On BSD-based systems (such as OSX, FreeBSD, etc.) the `cp -R` command
handles these two cases automatically. However, Linux treats "src/" and
"src" the same.
To support the trailing slash syntax portably, we can use:
src = "dir" -> dest/dir
src = "dir/." -> dest
This works on BSD and Linux. It is better than using wildcards as it
grabs hidden files as well.
This fixes#1196 that prevents the chef-solo provisioner from working
with the chroot builder.
It appears that the desired effect was to support
src = "dir" -> dest/dir
src = "dir/" -> dest
but cp -R already handles this, provided the trailing slash does not
get consumed by the shell.
The wildcard causes problems when multiple files match the
shell glob, e.g.
UploadDir("/tmp", "./salt*", [])
where my working dir contains
- salt
- salt-foo
will error.