Class: Actions::Pulp::Repository::Sync
Constant Summary
AbstractAsyncTask::FINISHED_STATES
Instance Method Summary
collapse
#cancel, #cancel!, #done?, #external_task, #humanized_state, #rescue_external_task, #run
Methods inherited from Abstract
#pulp_extensions, #pulp_resources
Instance Method Details
#check_error_details ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 49
def check_error_details
output[:pulp_tasks].each do |pulp_task|
error_details = pulp_task.try(:[], "progress_report").try(:[], "yum_importer").try(:[], "content").try(:[], "error_details")
if error_details && error_details[0]
fail _("An error occurred during the sync \n%{error_message}") % {:error_message => error_details[0]}
end
end
end
|
#contents_changed?(tasks) ⇒ Boolean
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 58
def contents_changed?(tasks)
if tasks.is_a?(Hash)
sync_task = tasks
else
sync_task = tasks.find { |task| (task['tags'] || []).include?('pulp:action:sync') }
end
if sync_task && sync_task['state'] == 'finished' && sync_task[:result]
sync_task['result']['added_count'] > 0 || sync_task['result']['removed_count'] > 0 || sync_task['result']['updated_count'] > 0
else
true end
end
|
#external_task=(tasks) ⇒ Object
44
45
46
47
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 44
def external_task=(tasks)
output[:contents_changed] = contents_changed?(tasks)
super
end
|
#finalize ⇒ Object
40
41
42
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 40
def finalize
check_error_details
end
|
104
105
106
107
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 104
def ignored_tags
["pulp:action:download"]
end
|
#invoke_external_task ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 13
def invoke_external_task
if input[:task_id]
task_resource.poll(input[:task_id])
else
sync_options = {}
if SETTINGS[:katello][:pulp][:sync_KBlimit]
sync_options[:max_speed] ||= SETTINGS[:katello][:pulp][:sync_KBlimit]
end
if SETTINGS[:katello][:pulp][:sync_threads]
sync_options[:num_threads] ||= SETTINGS[:katello][:pulp][:sync_threads]
end
sync_options[:feed] = input[:source_url] if input[:source_url]
sync_options[:validate] = !(SETTINGS[:katello][:pulp][:skip_checksum_validation])
output[:pulp_tasks] = pulp_tasks =
[pulp_resources.repository.sync(input[:pulp_id], override_config: sync_options)]
pulp_tasks
end
end
|
#rescue_strategy_for_self ⇒ Object
97
98
99
100
101
102
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 97
def rescue_strategy_for_self
Dynflow::Action::Rescue::Skip
end
|
#run_progress ⇒ Object
73
74
75
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 73
def run_progress
presenter.progress
end
|
#run_progress_weight ⇒ Object
77
78
79
|
# File 'app/lib/actions/pulp/repository/sync.rb', line 77
def run_progress_weight
10
end
|