Include user-data in log collection bundle#1274
Closed
cartermckinnon wants to merge 1 commit intomasterfrom
Closed
Include user-data in log collection bundle#1274cartermckinnon wants to merge 1 commit intomasterfrom
cartermckinnon wants to merge 1 commit intomasterfrom
Conversation
guessi
reviewed
Apr 27, 2023
| else | ||
| warning "Unable to find EC2 user-data, skipping." | ||
| fi | ||
| } |
Member
There was a problem hiding this comment.
I'm not sure if it is safe to echo without handling special case?
I think it would be better with base64 / base64 -d, WDYT?
Test results:
[root@ip-XXX ~]# rm -vf user-data.txt
removed ‘user-data.txt’[root@ip-XXX ~]# cat test.sh
#!/usr/bin/env bash
IMDS_TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 360")
if USER_DATA_BASE64=$(curl -H "X-aws-ec2-metadata-token: $IMDS_TOKEN" -f -s --max-time 10 --retry 5 http://169.254.169.254/latest/user-data | base64); then
echo "${USER_DATA_BASE64}" | base64 -d > user-data.txt
else
# changed "warning" to "echo" for test
echo "Unable to find EC2 user-data, skipping."
fi[root@ip-XXX ~]# ./test.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 56 100 56 0 0 6820 0 --:--:-- --:--:-- --:--:-- 7000[root@ip-XXX ~]# cat user-data.txt
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="//"
... (omit)
guessi
approved these changes
Jun 15, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
Diagnosing issues with node bootstrapping almost always requires the details of the user-data. This eliminates a round-trip email in the support cycle.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.