From adee9ea73f4606e08a4a4cc8b7f6961c7d257d66 Mon Sep 17 00:00:00 2001 From: Vishrut Shah Date: Wed, 18 May 2016 14:58:44 -0700 Subject: [PATCH] Http method get with status code 204 should be success in longrunning operation. (#1056) --- .../lib/ms_rest_azure/azure_service_client.rb | 8 ++++---- .../Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb index 50f2da8a48..afa7016bb7 100644 --- a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb +++ b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb @@ -36,7 +36,7 @@ def get_long_running_operation_result(azure_response, custom_deserialization_blo elsif !polling_state.location_header_link.nil? update_state_from_location_header(polling_state.get_request(headers: request.headers, base_uri: request.base_uri), polling_state, custom_deserialization_block) elsif http_method === :put - get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, 'get', query_params: request.query_params) + get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, query_params: request.query_params) update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block) else task.shutdown @@ -64,7 +64,7 @@ def get_long_running_operation_result(azure_response, custom_deserialization_blo end if (http_method === :put || http_method === :patch) && AsyncOperationStatus.is_successful_status(polling_state.status) && polling_state.resource.nil? - get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, 'get', query_params: request.query_params) + get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, query_params: request.query_params) update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block) end @@ -154,7 +154,7 @@ def update_state_from_location_header(request, polling_state, custom_deserializa if status_code === 202 polling_state.status = AsyncOperationStatus::IN_PROGRESS_STATUS elsif status_code === 200 || (status_code === 201 && http_method === :put) || - (status_code === 204 && (http_method === :delete || http_method === :post)) + (status_code === 204 && (http_method === :delete || http_method === :post || http_method === :get)) polling_state.status = AsyncOperationStatus::SUCCESS_STATUS error_data = CloudErrorData.new @@ -164,7 +164,7 @@ def update_state_from_location_header(request, polling_state, custom_deserializa polling_state.error_data = error_data polling_state.resource = result.body else - fail AzureOperationError, 'The response from long running operation does not have a valid status code' + fail AzureOperationError, "The response from long running operation does not have a valid status code. Method: #{http_method}, Status Code: #{status_code}" end end diff --git a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb index 379243f7c3..a9916ef4ed 100644 --- a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb +++ b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb @@ -94,7 +94,7 @@ def get_operation_error def get_request(options = {}) link = @azure_async_operation_header_link || @location_header_link - MsRest::HttpOperationRequest.new(nil, link, 'get', options) + MsRest::HttpOperationRequest.new(nil, link, :get, options) end private