Class: Actions::Katello::Repository::Sync
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Repository::Sync
- Extended by:
- ApipieDSL::Class
- Includes:
- Helpers::Presenter, JailConcern::Organization, ObservableAction
- Defined in:
- app/lib/actions/katello/repository/sync.rb
Defined Under Namespace
Classes: Jail
Instance Method Summary collapse
- #contents_changed ⇒ Object
- #finalize ⇒ Object
- #humanized_name ⇒ Object
- #plan(repo, options = {}) ⇒ Object
- #presenter ⇒ Object
- #product_id ⇒ Object
- #product_label ⇒ Object
- #product_name ⇒ Object
- #repository_id ⇒ Object
- #repository_label ⇒ Object
- #repository_name ⇒ Object
- #rescue_strategy ⇒ Object
- #run ⇒ Object
- #sync_result ⇒ Object
- #validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:) ⇒ Object
Methods included from JailConcern::Organization
included, #organization_id, #organization_label, #organization_name
Instance Method Details
#contents_changed ⇒ Object
125 126 127 |
# File 'app/lib/actions/katello/repository/sync.rb', line 125 def contents_changed input['contents_changed'] end |
#finalize ⇒ Object
70 71 72 |
# File 'app/lib/actions/katello/repository/sync.rb', line 70 def finalize ::Katello::Repository.find(input[:id])&.audit_sync end |
#humanized_name ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'app/lib/actions/katello/repository/sync.rb', line 74 def humanized_name if input && input[:validate_contents] _("Synchronize: Validate Content") elsif input && input[:skip_metadata_check] _("Synchronize: Skip Metadata Check") else _("Synchronize") end end |
#plan(repo, options = {}) ⇒ Object
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 52 53 54 55 56 57 58 59 60 61 |
# File 'app/lib/actions/katello/repository/sync.rb', line 19 def plan(repo, = {}) action_subject(repo) source_url = .fetch(:source_url, nil) validate_contents = .fetch(:validate_contents, false) = .fetch(:skip_metadata_check, false) || (validate_contents && (repo.yum? || repo.deb?)) generate_applicability = .fetch(:generate_applicability, repo.yum? || repo.deb?) validate_repo!(repo: repo, source_url: source_url, validate_contents: validate_contents, skip_metadata_check: , skip_candlepin_check: .fetch(:skip_candlepin_check, false)) = {} [:download_policy] = ::Katello::RootRepository::DOWNLOAD_ON_DEMAND if validate_contents && repo.yum? #pulp3 options [:optimize] = false if && (repo.yum? || repo.deb?) sequence do if validate_contents plan_action(Katello::Repository::VerifyChecksum, repo) else sync_action = plan_action(Actions::Pulp3::Orchestration::Repository::Sync, repo, SmartProxy.pulp_primary, ) output = sync_action.output plan_action(Katello::Repository::IndexContent, :id => repo.id, :force_index => ) plan_action(Katello::Foreman::ContentUpdate, repo.environment, repo.content_view, repo) plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id) concurrence do plan_action(Katello::Repository::ErrataMail, repo) plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repo.id]) if generate_applicability end plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => , :validate_contents => validate_contents, :contents_changed => output[:contents_changed]) plan_action(Katello::Repository::SyncHook, :id => repo.id) end end end |
#presenter ⇒ Object
91 92 93 94 95 |
# File 'app/lib/actions/katello/repository/sync.rb', line 91 def presenter found = all_planned_actions(Pulp3::Repository::Sync) if found.empty? found = all_planned_actions(Pulp3::Repository::Repair) if found.empty? Helpers::Presenter::Delegated.new(self, found) end |
#product_id ⇒ Object
113 114 115 |
# File 'app/lib/actions/katello/repository/sync.rb', line 113 def product_id input['product']['id'] end |
#product_label ⇒ Object
121 122 123 |
# File 'app/lib/actions/katello/repository/sync.rb', line 121 def product_label input['product']['label'] end |
#product_name ⇒ Object
117 118 119 |
# File 'app/lib/actions/katello/repository/sync.rb', line 117 def product_name input['product']['name'] end |
#repository_id ⇒ Object
101 102 103 |
# File 'app/lib/actions/katello/repository/sync.rb', line 101 def repository_id input['repository']['id'] end |
#repository_label ⇒ Object
109 110 111 |
# File 'app/lib/actions/katello/repository/sync.rb', line 109 def repository_label input['repository']['label'] end |
#repository_name ⇒ Object
105 106 107 |
# File 'app/lib/actions/katello/repository/sync.rb', line 105 def repository_name input['repository']['name'] end |
#rescue_strategy ⇒ Object
97 98 99 |
# File 'app/lib/actions/katello/repository/sync.rb', line 97 def rescue_strategy Dynflow::Action::Rescue::Skip end |
#run ⇒ Object
63 64 65 66 67 68 |
# File 'app/lib/actions/katello/repository/sync.rb', line 63 def run repo = ::Katello::Repository.find(input[:id]) repo.clear_smart_proxy_sync_histories if input[:contents_changed] ForemanTasks.async_task(Repository::CapsuleSync, repo) if Setting[:foreman_proxy_content_auto_sync] rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to end |
#sync_result ⇒ Object
129 130 131 |
# File 'app/lib/actions/katello/repository/sync.rb', line 129 def sync_result input['sync_result'] end |
#validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:) ⇒ Object
84 85 86 87 88 89 |
# File 'app/lib/actions/katello/repository/sync.rb', line 84 def validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:) fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank? fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb? fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum/deb repositories.") if && !repo.yum? && !repo.deb? ::Katello::Util::CandlepinRepositoryChecker.check_repository_for_sync!(repo) if repo.yum? && !skip_candlepin_check end |