Class: Actions::Katello::CapsuleContent::VerifyChecksum
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::CapsuleContent::VerifyChecksum
- Defined in:
- app/lib/actions/katello/capsule_content/verify_checksum.rb
Instance Method Summary collapse
- #check_cv_capsule_environments!(smart_proxy, content_view, environment) ⇒ Object
- #humanized_name ⇒ Object
- #plan(smart_proxy, options = {}) ⇒ Object
- #repos_to_repair(smart_proxy, environment, content_view, repository) ⇒ Object
- #rescue_strategy ⇒ Object
- #subjects(options = {}) ⇒ Object
Instance Method Details
#check_cv_capsule_environments!(smart_proxy, content_view, environment) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/lib/actions/katello/capsule_content/verify_checksum.rb', line 43 def check_cv_capsule_environments!(smart_proxy, content_view, environment) cv_environments = content_view&.versions&.collect(&:environments)&.flatten if cv_environments.present? if environment.present? && !(cv_environments.pluck(:id).include? environment.id) fail _("Content view '%{content_view}' is not attached to the environment.") % {content_view: content_view.name} end if (smart_proxy.lifecycle_environments.pluck(:id) & cv_environments.pluck(:id)).empty? fail _("Content view '%{content_view}' is not attached to this capsule.") % {content_view: content_view.name} end end end |
#humanized_name ⇒ Object
5 6 7 |
# File 'app/lib/actions/katello/capsule_content/verify_checksum.rb', line 5 def humanized_name _("Verify checksum for content on smart proxy") end |
#plan(smart_proxy, options = {}) ⇒ Object
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/capsule_content/verify_checksum.rb', line 9 def plan(smart_proxy, = {}) input[:options] = action_subject(smart_proxy) fail _("Action not allowed for the default smart proxy.") if smart_proxy.pulp_primary? subjects = subjects() = .merge(subjects) environment = [:environment] content_view = [:content_view] check_cv_capsule_environments!(smart_proxy, content_view, environment) repository = [:repository] repos = repos_to_repair(smart_proxy, environment, content_view, repository) repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch| concurrence do repo_batch.each do |repo| if smart_proxy.pulp3_support?(repo) plan_action(Actions::Pulp3::CapsuleContent::VerifyChecksum, repo, smart_proxy) end end end end end |
#repos_to_repair(smart_proxy, environment, content_view, repository) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/lib/actions/katello/capsule_content/verify_checksum.rb', line 33 def repos_to_repair(smart_proxy, environment, content_view, repository) smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy) smart_proxy_helper.lifecycle_environment_check(environment, repository) if repository [repository] else smart_proxy_helper.repositories_available_to_capsule(environment, content_view).by_rpm_count end end |
#rescue_strategy ⇒ Object
68 69 70 |
# File 'app/lib/actions/katello/capsule_content/verify_checksum.rb', line 68 def rescue_strategy Dynflow::Action::Rescue::Skip end |
#subjects(options = {}) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/lib/actions/katello/capsule_content/verify_checksum.rb', line 55 def subjects( = {}) environment_id = .fetch(:environment_id, nil) environment = ::Katello::KTEnvironment.find(environment_id) if environment_id repository_id = .fetch(:repository_id, nil) repository = ::Katello::Repository.find(repository_id) if repository_id content_view_id = .fetch(:content_view_id, nil) content_view = ::Katello::ContentView.find(content_view_id) if content_view_id {content_view: content_view, environment: environment, repository: repository} end |