-
Notifications
You must be signed in to change notification settings - Fork 35
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
Provide access to sandbox logs #91
Conversation
using the /task/<task_id>/{stdout,stderr} endpoint it is possible to fetch the output from the run.
a54103c
to
1528cfc
Compare
return | ||
} | ||
defer response.Body.Close() | ||
body, err := ioutil.ReadAll(response.Body) |
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.
This could be buffering several MB of data before starting the response. I think go has some method for writing a stream directly to a http response.
Also clean up the handler a bit.
) | ||
|
||
// getFile handles the actual fetching of file from the agent. | ||
func getFile(file string, task types.EremeticTask) (int, interface{}) { |
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.
interface{}
=> something
io.ReadCloser ?
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.
not sure how that'd work with the string returns, but maybe the string returns are wrong
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.
aha, I see. maybe it should actually be (err, io.whatever) and the "Unable to fetch upstream file" could be the message of the error object?
Looks good to me. GetFile still looks a bit iffy but I have no excellent suggestions at this time. If it gets the job done, eh? |
Yeah, I think it's good for now. |
Add /stdout and /stderr endpoints on a task resource to access logs from the sandbox