Class: Actions::Katello::Repository::Update

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/katello/repository/update.rb

Instance Method Summary collapse

Instance Method Details

#plan(repository, repo_params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/lib/actions/katello/repository/update.rb', line 7

def plan(repository, repo_params)
  action_subject repository
  repository = repository.reload
  repo_params[:url] = nil if repo_params[:url] == ''
  repository.update_attributes!(repo_params)

  if update_content?(repository)
    plan_action(::Actions::Candlepin::Product::ContentUpdate,
                :content_id => repository.content_id,
                :name => repository.content.name,
                :content_url => ::Katello::Glue::Pulp::Repos.custom_content_path(repository.product, repository.label),
                :gpg_key_url => repository.yum_gpg_key_url,
                :label => repository.content.label,
                :type => repository.content_type)
  end

  if SETTINGS[:katello][:use_pulp] && repository.pulp_update_needed?
    plan_action(::Actions::Pulp::Repository::Refresh, repository)
  end

  if SETTINGS[:katello][:use_pulp] && (repository.previous_changes.key?('unprotected') ||
      repository.previous_changes.key?('checksum_type'))
    plan_self(:repository_id => repository.id)
  end
end

#runObject



33
34
35
36
# File 'app/lib/actions/katello/repository/update.rb', line 33

def run
  repository = ::Katello::Repository.find(input[:repository_id])
  ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository)
end