Class: Actions::Katello::Repository::UploadFiles
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Repository::UploadFiles
- Defined in:
- app/lib/actions/katello/repository/upload_files.rb
Instance Method Summary collapse
- #finalize ⇒ Object
- #humanized_name ⇒ Object
- #plan(repository, files, content_type = nil, options = {}) ⇒ Object
- #rescue_strategy ⇒ Object
- #run ⇒ Object
Instance Method Details
#finalize ⇒ Object
56 57 58 |
# File 'app/lib/actions/katello/repository/upload_files.rb', line 56 def finalize delete_tmp_files(input[:tmp_files]) end |
#humanized_name ⇒ Object
52 53 54 |
# File 'app/lib/actions/katello/repository/upload_files.rb', line 52 def humanized_name _("Upload into") end |
#plan(repository, files, content_type = nil, 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/lib/actions/katello/repository/upload_files.rb', line 9 def plan(repository, files, content_type = nil, = {}) action_subject(repository) repository.clear_smart_proxy_sync_histories tmp_files = prepare_tmp_files(files) content_type ||= ::Katello::RepositoryTypeManager.find(repository.content_type).default_managed_content_type.label ::Katello::RepositoryTypeManager.check_content_matches_repo_type!(repository, content_type) if ::Katello::RepositoryTypeManager.generic_content_type?(content_type) unit_type_id = content_type else unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE end upload_actions = [] generate_applicability = .fetch(:generate_applicability, repository.yum?) sequence do tmp_files.each do |file| sequence do upload_action = plan_action(Pulp3::Orchestration::Repository::UploadContent, repository, SmartProxy.pulp_primary!, file, unit_type_id) upload_actions << upload_action.output end end plan_action(FinishUpload, repository, content_type: content_type, upload_actions: upload_actions) plan_self(tmp_files: tmp_files) plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repository.id]) if generate_applicability end ensure # Delete tmp files when some exception occurred. Would be # nice to have other ways to do that: https://github.com/Dynflow/dynflow/issues/130 delete_tmp_files(tmp_files) if $ERROR_INFO && tmp_files end |
#rescue_strategy ⇒ Object
60 61 62 |
# File 'app/lib/actions/katello/repository/upload_files.rb', line 60 def rescue_strategy Dynflow::Action::Rescue::Skip end |
#run ⇒ Object
47 48 49 50 |
# File 'app/lib/actions/katello/repository/upload_files.rb', line 47 def run ForemanTasks.async_task(Repository::CapsuleSync, ::Katello::Repository.find(input[:repository][:id])) if Setting[:foreman_proxy_content_auto_sync] rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to end |