Skip to content

Commit

Permalink
Merge pull request #36 from amazonlinux/pr/33
Browse files Browse the repository at this point in the history
Print ec2-metadata error to stderr and add missing changelog entry
  • Loading branch information
vigh-m committed Mar 7, 2024
2 parents 37726e7 + e798318 commit 09b53f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions amazon-ec2-utils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Source26: 53-ec2-read-ahead-kb.rules
URL: https://github.com/aws/amazon-ec2-utils
BuildArch: noarch
Provides: ec2-utils = %{version}-%{release}
Obsoletes: ec2-utils < 2.1
Obsoletes: ec2-utils < 2.2
Provides: ec2-metadata = %{version}-%{release}
Obsoletes: ec2-metadata <= 0.1
Obsoletes: ec2-metadata <= 0.1.3
Requires: curl
Requires: python3
BuildRequires: python3-devel
Expand Down Expand Up @@ -76,9 +76,14 @@ rm -rf $RPM_BUILD_ROOT

%changelog
* Thu Jan 18 2024 Keith Gable <gablk@amazon.com> - 2.2.0-1
- Corrected issue where an ec2-metadata error was written to stdout
- Change ec2nvme-nsid to use Bash string manipulation to improve
performance and reliability

* Mon Jun 5 2023 Guillaume Delacour <delacoug@amazon.com> - 2.2.0-1
- Add `--quiet` option to `ec2-metadata --help` output
- Add `-R`/`--region` option to `ec2-metadata` to discover the EC2 instance's region

* Thu Apr 6 2023 Noah Meyerhans <nmeyerha@amazon.com> - 2.1.0-1
- Add --quiet option to ec2-metadata
- Add --partition support to ec2-metadata
Expand Down
4 changes: 2 additions & 2 deletions ec2-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

function print_help()
{
echo "ec2-metadata v0.1.3
echo "ec2-metadata v0.1.4
Use to retrieve EC2 instance metadata from within a running EC2 instance.
e.g. to retrieve instance id: ec2-metadata -i
to retrieve ami id: ec2-metadata -a
Expand Down Expand Up @@ -53,7 +53,7 @@ function set_imds_token()
if [ -z "${IMDS_TOKEN}" ];then
IMDS_TOKEN=$(curl -s -f -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 900" ${METADATA_BASEURL}/${METADATA_TOKEN_PATH})
if [ "${?}" -gt 0 ] || [ -z "${IMDS_TOKEN}" ]; then
echo '[ERROR] Could not get IMDSv2 token. Instance Metadata might have been disabled or this is not an EC2 instance.'
echo '[ERROR] Could not get IMDSv2 token. Instance Metadata might have been disabled or this is not an EC2 instance.' >&2
exit 1
fi
fi
Expand Down

0 comments on commit 09b53f2

Please sign in to comment.