From 80c4e595b2a1d08ccac23a476d86da7776fcc8de Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Wed, 21 Aug 2024 16:57:23 +0700 Subject: [PATCH] STL-744: Add error relate to synchronize translation to execution log --- VERSION | 2 +- .../lcm/actions/synchronize_clients.rb | 24 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index ad70aa422..1d8ffbdf5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.7.68 +3.7.69 diff --git a/lib/gooddata/lcm/actions/synchronize_clients.rb b/lib/gooddata/lcm/actions/synchronize_clients.rb index 70246f9a8..b757a4e13 100644 --- a/lib/gooddata/lcm/actions/synchronize_clients.rb +++ b/lib/gooddata/lcm/actions/synchronize_clients.rb @@ -170,7 +170,27 @@ def error_handle(segment, error_result, continue_on_error, params) # Synchronize failure for all clients in segment if continue_on_error && success_count.zero? && failed_count.positive? - segment_warning_message = "Failed to synchronize clients for #{segment.segment_id} segment. Details: #{sync_result['links']['details']}" + segment_warning_message = "Failed to synchronize all clients for #{segment.segment_id} segment. Details: #{sync_result['links']['details']}" + if sync_result['links'] && sync_result['links']['details'] # rubocop:disable Style/SafeNavigation + begin + client = params.gdc_gd_client + response = client.get sync_result['links']['details'] + error_detail_result = response['synchronizationResultDetails'] + + if error_detail_result && error_detail_result['items'] # rubocop:disable Style/SafeNavigation + error_count = 1 + error_detail_result['items'].each do |item| + break if error_count > 5 + + GoodData.logger.warn(error_message(item, segment)) + error_count += 1 + end + end + rescue StandardError => ex + GoodData.logger.warn "Failed to fetch result of synchronize clients. Error: #{ex.message}" + end + end + add_failed_segment(segment.segment_id, segment_warning_message, short_name, params) return end @@ -192,7 +212,7 @@ def error_handle(segment, error_result, continue_on_error, params) def error_message(error_item, segment) error_client_id = error_item['id'] - error_message = "Failed to synchronize #{error_client_id} client in #{segment.segment_id} segment." + error_message = "Failed to synchronize #{error_client_id} client in #{segment.segment_id} segment" error_message = "#{error_message}. Detail: #{error_item['error']['message']}" if error_item['error'] && error_item['error']['message'] error_message = "#{error_message}. Error items: #{error_item['error']['parameters']}" if error_item['error'] && error_item['error']['parameters']