Class: Actions::Katello::ContentView::RefreshRollingRepo

Inherits:
EntryAction
  • Object
show all
Includes:
Helpers::SmartProxySyncHelper
Defined in:
app/lib/actions/katello/content_view/refresh_rolling_repo.rb

Instance Method Summary collapse

Methods included from Helpers::SmartProxySyncHelper

#schedule_async_repository_proxy_sync

Instance Method Details

#finalizeObject



37
38
39
40
41
# File 'app/lib/actions/katello/content_view/refresh_rolling_repo.rb', line 37

def finalize
  repository = ::Katello::Repository.find(input[:repository_id])
  repository.clear_smart_proxy_sync_histories if input[:contents_changed]
  schedule_async_repository_proxy_sync(repository)
end

#humanized_nameObject



17
18
19
# File 'app/lib/actions/katello/content_view/refresh_rolling_repo.rb', line 17

def humanized_name
  _('Refresh RollingCV Repo')
end

#plan(repository, contents_changed) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'app/lib/actions/katello/content_view/refresh_rolling_repo.rb', line 7

def plan(repository, contents_changed)
  action_subject repository
  sequence do
    plan_self(repository_id: repository.id, contents_changed: contents_changed)
    plan_action(Pulp3::Repository::RefreshDistribution, repository, SmartProxy.pulp_primary)
    plan_action(Repository::IndexContent, id: repository.id, source_repository_id: repository.library_instance.id)
    plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repository.id])
  end
end

#runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/lib/actions/katello/content_view/refresh_rolling_repo.rb', line 21

def run
  repository = ::Katello::Repository.find(input[:repository_id])
  library_instance = repository.library_instance
  # ensure IndexContent is not skipped!
  repository.last_contents_changed = DateTime.now if repository.version_href != library_instance.version_href

  repository.version_href = library_instance.version_href
  repository.version_prn = library_instance.version_prn
  repository.publication_href = library_instance.publication_href
  repository.publication_prn = library_instance.publication_prn
  if repository.deb?
    repository.content_id = library_instance.content_id
  end
  repository.save!
end