Skip to content

Commit

Permalink
Make the code more readable
Browse files Browse the repository at this point in the history
Signed-off-by: Akendo <akendo@akendo.eu>
  • Loading branch information
Akendo committed Jun 28, 2024
1 parent f7c5722 commit 68692df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion features/base/test/test_metadata_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

def test_metadata_connection(client, non_azure, non_ali, non_chroot, non_kvm):
metadata_host = "169.254.169.254"
# request the IMDSv2 token to allow access to the metadata_host on AWS.
(exit_code, token, error) = client.execute_command(
f"curl -sqX PUT 'http://{metadata_host}/latest/api/token'\
-H 'X-aws-ec2-metadata-token-ttl-seconds:60'"
)
(exit_code, output, error) = client.execute_command(
f"wget --timeout 5 \
--header=\"X-aws-ec2-metadata-token: $(curl -sqX PUT 'http://{metadata_host}/latest/api/token' -H 'X-aws-ec2-metadata-token-ttl-seconds: 21600')\" \
--header='X-aws-ec2-metadata-token: {token}' \
-H 'X-aws-ec2-metadata-token-ttl-seconds:60' \
'http://{metadata_host}/'"
)
assert exit_code == 0, f"no {error=} expected"
Expand Down

0 comments on commit 68692df

Please sign in to comment.