Class: Actions::Katello::Repository::Export
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Repository::Export
- Defined in:
- app/lib/actions/katello/repository/export.rb
Constant Summary collapse
- EXPORT_OUTPUT_BASEDIR =
"/var/lib/pulp/published/yum/master/group_export_distributor/"
Instance Method Summary collapse
- #humanized_name ⇒ Object
- #plan(repos, export_to_iso, since, iso_size, group_id) ⇒ Object
- #rescue_strategy ⇒ Object
- #run ⇒ Object
Instance Method Details
#humanized_name ⇒ Object
63 64 65 |
# File 'app/lib/actions/katello/repository/export.rb', line 63 def humanized_name _("Export") end |
#plan(repos, export_to_iso, since, iso_size, group_id) ⇒ Object
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 46 47 48 49 50 51 52 53 |
# File 'app/lib/actions/katello/repository/export.rb', line 14 def plan(repos, export_to_iso, since, iso_size, group_id) unless File.directory?(Setting['pulp_export_destination']) fail ::Foreman::Exception, N_("Unable to export, 'pulp_export_destination' setting is not set to a valid directory.") end unless File.writable?(Setting['pulp_export_destination']) fail ::Foreman::Exception, N_("Unable to export, 'pulp_export_destination' setting is not a writable directory.") end repo_pulp_ids = repos.collect do |repo| action_subject(repo) repo.pulp_id end start_date = since ? since.iso8601 : nil unless since.nil? group_id += "-incremental" end # create an export path that's the same as the ISO export path. Pulp # only uses this when exporting to a directory, but we want to keep # things as similar as possible. # Additionally, we want Pulp to export to dirs that Pulp owns, and # then Katello can copy it over as needed. This is needed for SELinux # reasons. export_directory = File.join(EXPORT_OUTPUT_BASEDIR, group_id) sequence do plan_action(Pulp::RepositoryGroup::Create, :id => group_id, :pulp_ids => repo_pulp_ids) plan_action(Pulp::RepositoryGroup::Export, :id => group_id, :export_to_iso => export_to_iso, :iso_size => iso_size, :start_date => start_date, :export_directory => export_directory) plan_self(:group_id => group_id, :export_to_iso => export_to_iso) # NB: the delete will also make Pulp delete our exported data under /var/lib/pulp plan_action(Pulp::RepositoryGroup::Delete, :id => group_id) end end |
#rescue_strategy ⇒ Object
67 68 69 |
# File 'app/lib/actions/katello/repository/export.rb', line 67 def rescue_strategy Dynflow::Action::Rescue::Skip end |
#run ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/lib/actions/katello/repository/export.rb', line 55 def run # copy the export to a place we have permission to write to. We let # Pulp do the deletion as part of repo group delete since it's under # /v/l/p. export_location = File.join(EXPORT_OUTPUT_BASEDIR, input[:group_id]) FileUtils.cp_r(export_location, Setting['pulp_export_destination'], :remove_destination => true) end |