Class: Actions::Pulp3::Orchestration::ContentViewVersion::SyncableExport

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb

Instance Method Summary collapse

Instance Method Details

#plan(content_view_version:, smart_proxy:, destination_server:, from_content_view_version:) ⇒ 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
62
63
64
65
66
67
68
69
# File 'app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb', line 19

def plan(content_view_version:,
         smart_proxy:,
         destination_server:,
         from_content_view_version:)
  format = ::Katello::Pulp3::ContentViewVersion::Export::SYNCABLE
  sequence do
    export_service = ::Katello::Pulp3::ContentViewVersion::Export.create(
        smart_proxy: smart_proxy,
        content_view_version: content_view_version,
        from_content_view_version: from_content_view_version,
        format: format,
        destination_server: destination_server)
    base_path = export_service.generate_exporter_path
    export_service.repositories.each do |repository|
      action_output = plan_action(::Actions::Pulp3::ContentViewVersion::CreateExporter,
                                  content_view_version_id: content_view_version.id,
                                  smart_proxy_id: smart_proxy.id,
                                  format: format,
                                  base_path: base_path,
                                  repository_id: repository.id,
                                  destination_server: destination_server).output

      plan_action(::Actions::Pulp3::ContentViewVersion::Export,
                  content_view_version_id: content_view_version.id,
                  smart_proxy_id: smart_proxy.id,
                  exporter_data: action_output[:exporter_data],
                  format: format,
                  repository_id: repository.id,
                  from_content_view_version_id:  from_content_view_version&.id)

      plan_action(::Actions::Pulp3::ContentViewVersion::DestroyExporter,
                smart_proxy_id: smart_proxy.id,
                exporter_data: action_output[:exporter_data],
                format: format,
                repository_id: repository.id)
    end

    history_output = plan_action(
        ::Actions::Pulp3::ContentViewVersion::CreateSyncableExportHistory,
        smart_proxy_id: smart_proxy.id,
        content_view_version_id: content_view_version.id,
        from_content_view_version_id:  from_content_view_version&.id,
        destination_server: destination_server,
        format: format,
        base_path: base_path
    ).output

    plan_self(export_history_id: history_output[:export_history_id],
              export_path: base_path)
  end
end

#rescue_strategyObject



78
79
80
# File 'app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb', line 78

def rescue_strategy
  Dynflow::Action::Rescue::Skip
end

#runObject



71
72
73
74
75
76
# File 'app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb', line 71

def run
  output.update(
      export_history_id: input[:export_history_id],
      export_path: input[:export_path]
  )
end