Class: Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary
- Defined in:
- app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb
Instance Method Summary collapse
- #humanized_name ⇒ Object
- #plan(organization, opts = {}) ⇒ Object
- #rescue_strategy ⇒ Object
- #run ⇒ Object
- #validate_repositories_immediate!(organization) ⇒ Object
Instance Method Details
#humanized_name ⇒ Object
40 41 42 |
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb', line 40 def humanized_name _("Export Library") end |
#plan(organization, opts = {}) ⇒ Object
6 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 |
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb', line 6 def plan(organization, opts = {}) = { destination_server: nil, chunk_size: nil, from_history: nil, fail_on_missing_content: false, format: ::Katello::Pulp3::ContentViewVersion::Export::IMPORTABLE, }.merge(opts) action_subject(organization) validate_repositories_immediate!(organization) if [:fail_on_missing_content] content_view = ::Katello::Pulp3::ContentViewVersion::Export.find_or_create_library_export_view(destination_server: [:destination_server], organization: organization, format: [:format]) repo_ids_in_library = organization.default_content_view_version.repositories.exportable(format: [:format]).immediate_or_none.pluck(:id) content_view.update!(repository_ids: repo_ids_in_library) sequence do publish_action = plan_action(::Actions::Katello::ContentView::Publish, content_view, '') export_action = plan_action(Actions::Katello::ContentViewVersion::Export, content_view_version: publish_action.version, destination_server: [:destination_server], chunk_size: [:chunk_size], from_history: [:from_history], validate_incremental: false, fail_on_missing_content: [:fail_on_missing_content], format: [:format]) plan_self(export_action_output: export_action.output) end end |
#rescue_strategy ⇒ Object
44 45 46 |
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb', line 44 def rescue_strategy Dynflow::Action::Rescue::Skip end |
#run ⇒ Object
36 37 38 |
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb', line 36 def run output[:export_history_id] = input[:export_action_output][:export_history_id] end |
#validate_repositories_immediate!(organization) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb', line 48 def validate_repositories_immediate!(organization) non_immediate_repos = organization.default_content_view_version.repositories.yum_type.non_immediate if non_immediate_repos.any? fail _("NOTE: Unable to fully export '%{organization}' organization's library because"\ " it contains repositories without the 'immediate' download policy."\ " Update the download policy and sync affected repositories to include them in the export."\ " \n %{repos}" % { organization: organization.name, repos: ::Katello::Pulp3::ContentViewVersion::Export .generate_product_repo_strings(repositories: non_immediate_repos)}) end end |