-
Notifications
You must be signed in to change notification settings - Fork 210
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
support HEAD http request on named node endpoint #1218
Conversation
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.
Nice work! Overall this looks good to me. I've left some inline comments for your consideration.
The travis tests are likely failing because this same functionality has not yet been added to chef-zero. To ensure those two code bases stay in sync, we require that functionality be added in both places OR that a specific exception is made in the test config for chef-zero. In this case, I would recommend that we implement the chef-zero functionality.
I'd eventually like to see us support HEAD against all named resources. We should make sure we get something in a backlog to make the rest of the endpoints consistent.
Should we consider doing an RFC for this? My assumption is that the RFC process would land on requiring this for all named endpoints; however, there is nothing that says we have to ship the contents of an RFC "all at once" provided we do it in a sane way.
@@ -87,8 +88,13 @@ auth_info(Req, #base_state{chef_db_context = DbContext, | |||
end. | |||
|
|||
to_json(Req, #base_state{resource_state = NodeState} = State) -> | |||
#node_state{chef_node = Node} = NodeState, | |||
{chef_db_compression:decompress(Node#chef_node.serialized_object), Req, State}. | |||
case wrq:method(Req) of |
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.
I don't think we need to do this now since simply having the HEAD request will improve performance for the intended use case; however, if we extend this to more endpoints, we might consider that this code currently still pulls the entire node object from the database when all we need for the HEAD request (as implemented) is the authz_id.
We could create an alternate fetch method that only pulls the authz_id to avoid transferring the entire object from the database over to erchef for no reason. Alternatively, if we are transferring the data, we could potentially add some useful information to this HEAD response, such as a checksum of the object or something similar.
Thanks @stevendanna for the review. I have an implementation ready for PR to add HEAD support to chef-zero so I can get that in as a place-holder. I'll link here when it's in. I'm in agreement that proposing an RFC for transparency and feedback would be an ideal way to move forward. Assuming there are no objections, I'll go ahead and submit that proposal. |
Chef-RFC: chef-boneyard/chef-rfc#263 |
@jeremymv2 Thanks for getting that RFC through. Where does this stand, I think the remaining TODO is the chef-zero implementation, do you need any assistance there? |
Thanks @stevendanna for reaching out! I had begun the work on chef-zero then put it on ice until the RFC went through. I'll thaw it off an get it wrapped up this week. |
Back to it.. here's the work in progress for the chef-zero implementation. |
@jeremymv2 I think we are good to go now, mind rebasing this? |
6d1a870
to
445a545
Compare
@markan what do you think about us getting this in for the next release? |
445a545
to
fe6596e
Compare
fe6596e
to
45a3b57
Compare
@btm @nsdavidson I've rebased and we have a happy Travis |
@stevendanna @markan Can y'all take another peek at this? |
45a3b57
to
6e0a9fe
Compare
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
Hold on merging for a bit; I'm trying to stabilize the build right now. |
6e0a9fe
to
88b88bd
Compare
Signed-off-by: Jeremy J. Miller <[email protected]>
88b88bd
to
6174f5f
Compare
This PR adds support for the HEAD HTTP verb on the named node endpoint.
Since node objects can be quite large, querying for their existence via GET can be expensive.
The benefits:
Existing node:
Non-existent node:
Logs for a successful query: