Skip to content
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

implement rfc090 for named nodes endpoint #264

Merged
merged 5 commits into from
May 25, 2017

Conversation

jeremymv2
Copy link
Contributor

This is a first stab at implementing rfc090 (HTTP HEAD) support.
For right now, it only covers the named nodes endpoint ('/nodes/NAME'). However, it can easily be added to other endpoints as needed.

Signed-off-by: Jeremy J. Miller jm@chef.io

Signed-off-by: Jeremy J. Miller <jm@chef.io>
@jeremymv2
Copy link
Contributor Author

200

~/Devel/ChefProject/chef-zero/playground (jeremymv2/http_head *%)$ knife raw -m HEAD "/nodes/www" -VV
INFO: Using configuration from /Users/jmiller/Devel/ChefProject/chef-zero/playground/.chef/knife.rb
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Signing the request as stickywicket
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
DEBUG: Initiating HEAD to http://127.0.0.1:8889/nodes/www
DEBUG: ---- HTTP Request Header Data: ----
DEBUG: Content-Type: application/json
DEBUG: Accept: application/json
DEBUG: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
DEBUG: X-Ops-Server-API-Version: 1
DEBUG: X-OPS-SIGN: algorithm=sha1;version=1.1;
DEBUG: X-OPS-USERID: stickywicket
DEBUG: X-OPS-TIMESTAMP: 2017-05-18T19:07:57Z
DEBUG: X-OPS-CONTENT-HASH: 2jmj7l5rSw0yVb/vlWAYkK/YBwk=
DEBUG: X-OPS-AUTHORIZATION-1: jgZj0PlzuKzpM/vWHv7H4HogavTLW9vjNE2G/u15EsxBof9ariswEifHp5d7
DEBUG: X-OPS-AUTHORIZATION-2: kl6oxGCJ3TXbmwWQNc0g+U2Kj4pleE9BESGNMyU5NyWQQd/6XflBsgNL7Vkh
DEBUG: X-OPS-AUTHORIZATION-3: sBDWDd96SwUtjpUVpmuZvqoGF8uFpsJLpBgD9DMX3wJrCO/0O0Wsi2dIo9bt
DEBUG: X-OPS-AUTHORIZATION-4: pyvfFXMHG0rBWl293VbzVmHS2MjZ/3mf+fdFzpMZcmimluDdTYq223DtHFfo
DEBUG: X-OPS-AUTHORIZATION-5: O1PS7DqnwV0af/ECd5Psxy0WZIDAYO8eLIcd/hAYH4NK4aiyRGXeGqW/WPDy
DEBUG: X-OPS-AUTHORIZATION-6: 53hwd/KUP7JA1/vGCJhaL7YKkaSatrvto8Lql1eF9A==
DEBUG: HOST: 127.0.0.1:8889
DEBUG: X-REMOTE-REQUEST-ID: bc7eb8de-1882-4cd8-9291-1a2913e3dda5
DEBUG: ---- End HTTP Request Header Data ----
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 200 OK
DEBUG: content-type: application/json
DEBUG: x-ops-server-api-version: {"min_version":"0","max_version":"2","request_version":"0","response_version":"0"}
DEBUG: server: chef-zero
DEBUG: access-control-allow-origin: *
DEBUG: date: Thu, 18 May 2017 19:08:28 GMT
DEBUG: content-length: 5
DEBUG: connection: close
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_response
null
~/Devel/ChefProject/chef-zero/playground (jeremymv2/http_head *%)$

404

~/Devel/ChefProject/chef-zero/playground (jeremymv2/http_head *%)$ knife raw -m HEAD "/nodes/www1" -VV
INFO: Using configuration from /Users/jmiller/Devel/ChefProject/chef-zero/playground/.chef/knife.rb
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Signing the request as stickywicket
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
DEBUG: Initiating HEAD to http://127.0.0.1:8889/nodes/www1
DEBUG: ---- HTTP Request Header Data: ----
DEBUG: Content-Type: application/json
DEBUG: Accept: application/json
DEBUG: Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
DEBUG: X-Ops-Server-API-Version: 1
DEBUG: X-OPS-SIGN: algorithm=sha1;version=1.1;
DEBUG: X-OPS-USERID: stickywicket
DEBUG: X-OPS-TIMESTAMP: 2017-05-18T19:05:10Z
DEBUG: X-OPS-CONTENT-HASH: 2jmj7l5rSw0yVb/vlWAYkK/YBwk=
DEBUG: X-OPS-AUTHORIZATION-1: uulmUjx0TU1/wYXojtcrivdGe6jpteQs9IKHz7cBorXxcCwARRKT91ujpjbH
DEBUG: X-OPS-AUTHORIZATION-2: powIR3ziStv3QGrkkwKELbWFvVWbM9gSMtLwG9crFTweRp25amgfFZ+T1F4n
DEBUG: X-OPS-AUTHORIZATION-3: atakBP/UexfRPecqeHa9jBqxJc2Y5kHhR0/L9qPXKdDa1h3bp0o2mfFKLs3p
DEBUG: X-OPS-AUTHORIZATION-4: /8qD+AUtBk82HVdd/MC+Hau0BI0DO3mQ3DbuR51nnoOXW/OsIXdHhBiiCcLm
DEBUG: X-OPS-AUTHORIZATION-5: rQ85MFdQMwaRhkLbo62urZAFLdq6io6UnjTOlNV+7mBzaKyeRlqp+vMU69ZQ
DEBUG: X-OPS-AUTHORIZATION-6: Mvaon2+h7PzrPOlK0u/4MyqlPuy3SE0cVY1f6eZGeg==
DEBUG: HOST: 127.0.0.1:8889
DEBUG: X-REMOTE-REQUEST-ID: 610a2ed5-39e4-41e5-81d8-0f860e8705b3
DEBUG: ---- End HTTP Request Header Data ----
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 404 Not Found
DEBUG: content-type: application/json
DEBUG: x-ops-server-api-version: {"min_version":"0","max_version":"2","request_version":"0","response_version":"0"}
DEBUG: server: chef-zero
DEBUG: access-control-allow-origin: *
DEBUG: date: Thu, 18 May 2017 19:05:10 GMT
DEBUG: content-length: 78
DEBUG: connection: close
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_response
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_response
INFO: HTTP Request Returned 404 Not Found :
ERROR: Server responded with error 404 "Not Found "
~/Devel/ChefProject/chef-zero/playground (jeremymv2/http_head *%)$

@jeremymv2
Copy link
Contributor Author

Hmm, all the build failures seem non-related to this change and from oc_id

oc_id API
  status endpoint
    GET /id/v1/status
      retuns 200 (FAILED - 1)

Signed-off-by: Jeremy J. Miller <jm@chef.io>
Signed-off-by: Jeremy J. Miller <jm@chef.io>
Signed-off-by: Jeremy J. Miller <jm@chef.io>
.travis.yml Outdated
@@ -15,6 +15,9 @@ cache: bundler
script:
- bundle update
- bundle exec rake pedant
env:
global:
- "PEDANT_OPTS=\"--skip-oc_id\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should just land in https://github.com/chef/chef-zero/blob/master/spec/run_oc_pedant.rb#L149 since it'll always be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - makes sense!

Signed-off-by: Jeremy J. Miller <jm@chef.io>
@jeremymv2
Copy link
Contributor Author

jeremymv2 commented May 24, 2017

I can squash commits if needed.

@thommay thommay merged commit 73ed88e into chef:master May 25, 2017
@thommay
Copy link
Contributor

thommay commented May 25, 2017

Thanks Jeremy!

@jeremymv2 jeremymv2 deleted the jeremymv2/http_head branch May 31, 2017 14:23
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants