Merge pull request #218482 from illustris/ec2-metadata

nixos/ec2: don't populate nonexistent metadata files

authored by Sandro and committed by GitHub 83dcadaf 367bf103

+3 -4
+3 -4
nixos/modules/virtualisation/ec2-metadata-fetcher.sh
··· 55 echo "getting EC2 instance metadata..." 56 57 get_imds() { 58 - # Intentionally no --fail here, so that we proceed even if e.g. a 59 - # 404 was returned (but we still fail if we can't reach the IMDS 60 - # server). 61 - curl --silent --show-error --header "X-aws-ec2-metadata-token: $IMDS_TOKEN" "$@" 62 } 63 64 get_imds -o "$metaDir/ami-manifest-path" http://169.254.169.254/1.0/meta-data/ami-manifest-path
··· 55 echo "getting EC2 instance metadata..." 56 57 get_imds() { 58 + # --fail to avoid populating missing files with 404 HTML response body 59 + # || true to allow the script to continue even when encountering a 404 60 + curl --silent --show-error --fail --header "X-aws-ec2-metadata-token: $IMDS_TOKEN" "$@" || true 61 } 62 63 get_imds -o "$metaDir/ami-manifest-path" http://169.254.169.254/1.0/meta-data/ami-manifest-path