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(root, 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/lib/actions/katello/repository/update.rb', line 7

def plan(root, repo_params)
  repository = root.library_instance
  action_subject root.library_instance

  repo_params[:url] = nil if repo_params[:url] == ''
  repo_params[:checksum_type] = nil if repo_params[:download_policy] == ::Katello::RootRepository::DOWNLOAD_ON_DEMAND
  update_cv_cert_protected = repo_params.key?(:unprotected) && (repo_params[:unprotected] != repository.unprotected)
  create_acs = create_acs?(repository.url, repo_params[:url])
  delete_acs = delete_acs?(repository.url, repo_params[:url])

  # Keep the old URL for RPM vs ULN remote cleanup
  old_url = root.url
  root.update!(repo_params)

  if update_content?(repository)
    plan_action(::Actions::Candlepin::Product::ContentUpdate,
                owner:           repository.organization.label,
                repository_id:   repository.id,
                name:            root.name,
                type:            root.content_type,
                arches:          root.format_arches,
                label:           repository.content.label,
                content_url:     root.custom_content_path,
                gpg_key_url:     repository.yum_gpg_key_url,
                os_versions:     root.os_versions&.join(','),
                metadata_expire: root.)
  end

  if root.pulp_update_needed?
    sequence do
      plan_action(::Actions::Pulp3::Orchestration::Repository::Update,
                       repository,
                       SmartProxy.pulp_primary)
      plan_self(:repository_id => root.library_instance.id)
      if update_cv_cert_protected
        smart_proxy = ::SmartProxy.pulp_primary
        if smart_proxy.pulp3_support?(repository)
          plan_action(::Actions::Pulp3::Orchestration::Repository::TriggerUpdateRepoCertGuard, repository, smart_proxy)
        end
      end

      handle_alternate_content_sources(repository, create_acs, delete_acs, old_url)
    end
  end
end

#runObject



53
54
55
56
57
# File 'app/lib/actions/katello/repository/update.rb', line 53

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