diff options
author | Thom May <thom@chef.io> | 2017-03-29 09:34:09 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2017-03-29 13:25:00 +0100 |
commit | d6dc0b04c6f3c3d8a1461778c0c2604f879b505b (patch) | |
tree | 129eacaa80dd104f542d60b775fd1b665ebb425c /lib/chef/http/api_versions.rb | |
parent | 50808ca1b1691e45c4017e6e117764ddd617e93f (diff) | |
download | chef-tm/retryable_api.tar.gz |
Retry API requests if using an unsupported versiontm/retryable_api
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/http/api_versions.rb')
-rw-r--r-- | lib/chef/http/api_versions.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/chef/http/api_versions.rb b/lib/chef/http/api_versions.rb index 696c7072bf..674d8f85a7 100644 --- a/lib/chef/http/api_versions.rb +++ b/lib/chef/http/api_versions.rb @@ -32,6 +32,9 @@ class Chef end def handle_response(http_response, rest_request, return_value) + if http_response.code == "406" + ServerAPIVersions.instance.reset! + end if http_response.key?("x-ops-server-api-version") ServerAPIVersions.instance.set_versions(JSONCompat.parse(http_response["x-ops-server-api-version"])) end |