-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
user-data Support #171
user-data Support #171
Conversation
I can also take a stab at local tests too, once I have it in a working state. |
@ihamburglar great start on the PR; appreciate it.
This is happening because of the
It probably would make more sense, but not sure if that makes implementation any easier (without some refactoring). With that said, I'm okay keeping it consistent with |
I am going to take a crack at writing some tests for this tonight. I think the only other thing I thought of in terms of questions was what the default placeholder should be and how the userdata should be formatted in the JSON config. At first I was going to leave it empty, but because userdata is the only thing in the config file that is likely to be multi-line I left something in there that is multi-line to convey to the user how to add multiple lines with something innocuous. Currently I'm using new line characters like below. I think the better thing to do would be to base64 encode the data, and then decode at runtime or to have a JSON array with each item being a line. Let me know if I should do something better than new line characters. |
I have tried to add tests. Don't think I got it right, think I'm missing something. |
+1. This would also align better with the way IMDS works because user data must be base64-encoded. However, this should be addressed in a separate PR-- let's focus on getting this path working+tested with a less complex value (i.e. no new lines). One suggestion is the default value used in the documentation:
Would you mind opening the issue for base-64 encoding user data? I'd like to add some details in that thread such as making this value configurable via flag. |
Let me try it locally with a simpler userdata value |
Made some changes. Let me know if I missed anything. |
Looks like After removing that line from |
I think tests are passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm , thanks!
Issue #170
Description of changes:
This PR is a work in progress. The idea is to be able to have the "/latest/user-data" path supported. As discussed in the issue it is a new content-type. I believe I have taken care of that.
The main issue currently is that I'm not an expert on interfaces. The parsing of the JSON is done with an interface, and the functions assume that there is something served in a file or sub-folder of the first file level, rather than a first level returning a response directly as in the case with user-data. This means that "/latest/user-data/a" is how you can access the contents of the user-data response that is stored in the JSON config, rather than "/latest/user-data". Any tips to help me figure out how to serve it as the path with just "latest" being the only folder in the path, would be appreciated.
The other thing is that the JSON config section for user-data is still formatted with the path/value trees as with the other paths. Would it make more sense for this section to be 'userdata : "/bin/bash aws sts get-caller-identity"' rather than the trees?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.