mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 21:25:30 +03:00
nixos/ec2: don't populate nonexistent metadata files
This commit is contained in:
parent
9c466e7c1d
commit
7e4e6e8bd7
1 changed files with 3 additions and 4 deletions
|
@ -55,10 +55,9 @@ done
|
||||||
echo "getting EC2 instance metadata..."
|
echo "getting EC2 instance metadata..."
|
||||||
|
|
||||||
get_imds() {
|
get_imds() {
|
||||||
# Intentionally no --fail here, so that we proceed even if e.g. a
|
# --fail to avoid populating missing files with 404 HTML response body
|
||||||
# 404 was returned (but we still fail if we can't reach the IMDS
|
# || true to allow the script to continue even when encountering a 404
|
||||||
# server).
|
curl --silent --show-error --fail --header "X-aws-ec2-metadata-token: $IMDS_TOKEN" "$@" || true
|
||||||
curl --silent --show-error --header "X-aws-ec2-metadata-token: $IMDS_TOKEN" "$@"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_imds -o "$metaDir/ami-manifest-path" http://169.254.169.254/1.0/meta-data/ami-manifest-path
|
get_imds -o "$metaDir/ami-manifest-path" http://169.254.169.254/1.0/meta-data/ami-manifest-path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue