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(opts = {}) ⇒ 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
87
88
89
90
91
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export.rb', line 21

def plan(opts = {})
  options = {
    content_view_version: nil, destination_server: nil,
    chunk_size: nil, from_history: nil,
    validate_incremental: true,
    fail_on_missing_content: false,
    format: ::Katello::Pulp3::ContentViewVersion::Export::IMPORTABLE
  }.merge(opts)
  content_view_version = options[:content_view_version]
  format = options[:format]
  smart_proxy = SmartProxy.pulp_primary!
  from_content_view_version = options[:from_history]&.content_view_version
  export_service = ::Katello::Pulp3::ContentViewVersion::Export.create(
      smart_proxy: smart_proxy,
      content_view_version: content_view_version,
      destination_server: options[:destination_server],
      from_content_view_version: from_content_view_version,
      format: format)
  export_service.validate!(fail_on_missing_content: options[:fail_on_missing_content],
                           validate_incremental: options[:validate_incremental],
                           chunk_size: options[: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: options[:from_history]&.content_view_version,
                smart_proxy: smart_proxy,
                destination_server: options[: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: options[: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: options[: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: options[: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



101
102
103
# File 'app/lib/actions/pulp3/orchestration/content_view_version/export.rb', line 101

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

#runObject



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

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