Class: Actions::Pulp3::Repository::RefreshDistribution

Inherits:
AbstractAsyncTask show all
Includes:
Helpers::Presenter
Defined in:
app/lib/actions/pulp3/repository/refresh_distribution.rb

Instance Method Summary collapse

Methods included from Helpers::Presenter

#presenter

Methods inherited from AbstractAsyncTask

#cancel, #cancel!, #combined_tasks, #done?, #external_task, #humanized_state, #new_or_existing_objects, #pulp_tasks, #rescue_external_task, #run, #task_groups

Methods inherited from Abstract

#smart_proxy

Instance Method Details

#invoke_external_taskObject



24
25
26
27
# File 'app/lib/actions/pulp3/repository/refresh_distribution.rb', line 24

def invoke_external_task
  repo = ::Katello::Repository.find(input[:repository_id])
  repo.backend_service(smart_proxy).with_mirror_adapter.refresh_distributions
end

#plan(repository, smart_proxy, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/lib/actions/pulp3/repository/refresh_distribution.rb', line 7

def plan(repository, smart_proxy, options = {})
  smart_proxy = SmartProxy.unscoped.find_by(id: smart_proxy) #support bulk actions
  sequence do
    if !repository.unprotected && !options[:assume_content_guard_exists]
      plan_action(::Actions::Pulp3::ContentGuard::Refresh, smart_proxy)
    end

    refresh_options = {
      :repository_id => repository.id,
      :smart_proxy_id => smart_proxy.id,
    }
    action = plan_self(refresh_options)

    plan_action(SaveDistributionReferences, repository, smart_proxy, action.output)
  end
end