Module: Actions::Katello::CapsuleContent::RefreshRepos
- Included in:
- Pulp3::Orchestration::Repository::RefreshRepos
- Defined in:
- app/lib/actions/katello/capsule_content/refresh_repos.rb
Instance Method Summary collapse
- #act_on_repo?(_repo) ⇒ Boolean
- #fetch_proxy_service(_smart_proxy) ⇒ Object
- #invoke_external_task ⇒ Object
- #plan(smart_proxy, options = {}) ⇒ Object
- #rescue_strategy ⇒ Object
Instance Method Details
#act_on_repo?(_repo) ⇒ Boolean
9 10 11 |
# File 'app/lib/actions/katello/capsule_content/refresh_repos.rb', line 9 def act_on_repo?(_repo) fail NotImplementedError end |
#fetch_proxy_service(_smart_proxy) ⇒ Object
5 6 7 |
# File 'app/lib/actions/katello/capsule_content/refresh_repos.rb', line 5 def fetch_proxy_service(_smart_proxy) fail NotImplementedError end |
#invoke_external_task ⇒ Object
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 |
# File 'app/lib/actions/katello/capsule_content/refresh_repos.rb', line 25 def invoke_external_task tasks = [] environment = ::Katello::KTEnvironment.find_by(:id => input[:environment_id]) if input[:environment_id] repository = ::Katello::Repository.find_by(:id => input[:repository_id]) if input[:repository_id] content_view = ::Katello::ContentView.find_by(:id => input[:content_view_id]) if input[:content_view_id] smart_proxy = SmartProxy.unscoped.find(input[:smart_proxy_id]) smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy) smart_proxy_service = fetch_proxy_service(smart_proxy) current_repos_on_capsule = smart_proxy_service.current_repositories(environment, content_view) current_repos_on_capsule_ids = current_repos_on_capsule.pluck(:id) if input[:repository_ids_list].nil? list_of_repos_to_sync = smart_proxy_helper.combined_repos_available_to_capsule(environment, content_view, repository) else list_of_repos_to_sync = ::Katello::Repository.where(:id => input[:repository_ids_list]) end list_of_repos_to_sync.each do |repo| next unless act_on_repo?(repo, smart_proxy) pulp_repo = repo.backend_service(smart_proxy) if !current_repos_on_capsule_ids.include?(repo.id) # create_mirror_entities does not apply to the primary smart proxy pulp_repo.create_mirror_entities else if smart_proxy.pulp_primary? # The primary smart proxy has extra remote options, like proxy_url tasks += pulp_repo.refresh_entities else tasks += pulp_repo.refresh_mirror_entities end end end tasks end |
#plan(smart_proxy, options = {}) ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/lib/actions/katello/capsule_content/refresh_repos.rb', line 17 def plan(smart_proxy, = {}) plan_self(:smart_proxy_id => smart_proxy.id, :environment_id => [:environment]&.id, :content_view_id => [:content_view]&.id, :repository_id => [:repository]&.id, :repository_ids_list => [:repository_ids_list]) end |
#rescue_strategy ⇒ Object
13 14 15 |
# File 'app/lib/actions/katello/capsule_content/refresh_repos.rb', line 13 def rescue_strategy Dynflow::Action::Rescue::Skip if self.state == 'error' end |