Class: Actions::Pulp3::Orchestration::ContentViewVersion::Export

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

Instance Method Summary collapse

Instance Method Details

#plan(content_view_version:, destination_server: nil, chunk_size: nil, from_history: nil, validate_incremental: true, fail_on_missing_content: false, format: ::Katello::Pulp3::ContentViewVersion::Export::IMPORTABLE) ⇒ Object



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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export.rb', line 21

def plan(content_view_version:, destination_server: nil,
         chunk_size: nil, from_history: nil,
         validate_incremental: true,
         fail_on_missing_content: false,
         format: ::Katello::Pulp3::ContentViewVersion::Export::IMPORTABLE)
  smart_proxy = SmartProxy.pulp_primary!
  from_content_view_version = from_history&.content_view_version
  export_service = ::Katello::Pulp3::ContentViewVersion::Export.create(
      smart_proxy: smart_proxy,
      content_view_version: content_view_version,
      destination_server: destination_server,
      from_content_view_version: from_content_view_version,
      format: format)
  export_service.validate!(fail_on_missing_content: fail_on_missing_content,
                           validate_incremental: validate_incremental,
                           chunk_size: chunk_size)

  if format == ::Katello::Pulp3::ContentViewVersion::Export::SYNCABLE
    sequence do
      export_output = plan_action(SyncableExport,
                content_view_version: content_view_version,
                from_content_view_version: from_history&.content_view_version,
                smart_proxy: smart_proxy,
                destination_server: destination_server).output
      plan_self(export_history_id: export_output[:export_history_id],
                export_path: export_output[:export_path])
    end
    return
  end

  sequence do
    action_output = plan_action(::Actions::Pulp3::ContentViewVersion::CreateExporter,
                                content_view_version_id: content_view_version.id,
                                smart_proxy_id: smart_proxy.id,
                                destination_server: destination_server,
                                format: format).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],
                chunk_size: chunk_size,
                from_content_view_version_id: from_content_view_version&.id,
                format: format)

    history_output = plan_action(
        ::Actions::Pulp3::ContentViewVersion::CreateExportHistory,
        smart_proxy_id: smart_proxy.id,
        exporter_data: action_output[:exporter_data],
        pulp_href: action_output[:exporter_data][:pulp_href],
        content_view_version_id: content_view_version.id,
        from_content_view_version_id: from_content_view_version&.id,
        destination_server: destination_server,
        format: format
    ).output

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

    plan_self(export_history_id: history_output[:export_history_id],
              exported_file_checksum: history_output[:exported_file_checksum],
              export_path: history_output[:path])
  end
end

#rescue_strategyObject



96
97
98
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export.rb', line 96

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

#runObject



88
89
90
91
92
93
94
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export.rb', line 88

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