-
-
Save daviddavis/00bb51fcbf24cca7b300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/models/pulp_task_status.rb b/app/models/pulp_task_status.rb | |
index aba5cde..2392668 100644 | |
--- a/app/models/pulp_task_status.rb | |
+++ b/app/models/pulp_task_status.rb | |
@@ -28,7 +28,11 @@ class PulpTaskStatus < TaskStatus | |
end | |
def error | |
- self.result[:errors][0] if self.error? && self.result[:errors] | |
+ if result.key?(:details) && result[:details].key?(:errors) | |
+ result[:details][:errors].first | |
+ else | |
+ self.result[:errors][0] if self.error? && self.result[:errors] | |
+ end | |
end | |
def self.wait_for_tasks(async_tasks) | |
diff --git a/app/models/repository.rb b/app/models/repository.rb | |
index da223e0..7a1c722 100644 | |
--- a/app/models/repository.rb | |
+++ b/app/models/repository.rb | |
@@ -237,13 +237,23 @@ class Repository < ActiveRecord::Base | |
wait = options.fetch(:wait, false) | |
reindex = options.fetch(:reindex, true) && Katello.config.use_elasticsearch | |
publish = options.fetch(:publish, true) && Katello.config.use_pulp | |
+ check_result = options.fetch(:check_result, false) | |
tasks = [] | |
tasks += repos.flat_map{|repo| repo.generate_metadata} if publish | |
+ | |
repos.each{|repo| repo.generate_applicability } #don't wait on applicability | |
repos.each{|repo| repo.index_content } if reindex | |
- PulpTaskStatus.wait_for_tasks(tasks) if wait | |
+ tasks = PulpTaskStatus.wait_for_tasks(tasks) if wait | |
+ | |
+ if check_result && tasks.any? | |
+ tasks.each do |task| | |
+ _("Failed to update contents: %s") % task.error if task.error | |
+ end | |
+ end | |
+ | |
+ tasks | |
end | |
# TODO: break up method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment