diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2023-03-15 16:53:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 16:53:40 +0100 |
commit | 83dcadaf61040a5885fcc5fe31e2ef60d678aa7b (patch) | |
tree | 0e425602ed19ed6be9d1aff284c51528a11220df /nixos/modules/virtualisation | |
parent | 367bf103d0c16c27c2fd09bc030e829854bd61e5 (diff) | |
parent | 7e4e6e8bd7c6d5447d54d0730e59814c6412a73b (diff) |
Merge pull request #218482 from illustris/ec2-metadata
nixos/ec2: don't populate nonexistent metadata files
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/ec2-metadata-fetcher.sh | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/nixos/modules/virtualisation/ec2-metadata-fetcher.sh b/nixos/modules/virtualisation/ec2-metadata-fetcher.sh index 9e204d45dbd83..716aff7c22fba 100644 --- a/nixos/modules/virtualisation/ec2-metadata-fetcher.sh +++ b/nixos/modules/virtualisation/ec2-metadata-fetcher.sh @@ -55,10 +55,9 @@ done echo "getting EC2 instance metadata..." get_imds() { - # Intentionally no --fail here, so that we proceed even if e.g. a - # 404 was returned (but we still fail if we can't reach the IMDS - # server). - curl --silent --show-error --header "X-aws-ec2-metadata-token: $IMDS_TOKEN" "$@" + # --fail to avoid populating missing files with 404 HTML response body + # || true to allow the script to continue even when encountering a 404 + curl --silent --show-error --fail --header "X-aws-ec2-metadata-token: $IMDS_TOKEN" "$@" || true } get_imds -o "$metaDir/ami-manifest-path" http://169.254.169.254/1.0/meta-data/ami-manifest-path |