Class: Katello::Api::V2::ExportsController
- Inherits:
-
ApiController
- Object
- Api::V2::BaseController
- ApiController
- Katello::Api::V2::ExportsController
show all
- Defined in:
- app/controllers/katello/api/v2/exports_controller.rb
Instance Method Summary
collapse
#empty_search_query?, #full_result_response, #resource_class, #scoped_search, #skip_session
Methods included from Rendering
#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template
#api_version
Instance Method Details
#export_content_view_version ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 54
def export_content_view_version
tasks = async_task(Actions::Katello::ContentViewVersion::Export,
content_view_version: @version,
destination_server: params[:destination_server],
chunk_size: params[:chunk_size_gb],
from_history: @history,
format: find_export_format,
fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
respond_for_async :resource => tasks
end
|
#export_library ⇒ Object
66
67
68
69
70
71
72
73
74
75
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 66
def export_library
tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
@organization,
destination_server: params[:destination_server],
chunk_size: params[:chunk_size_gb],
from_history: @history,
format: find_export_format,
fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
respond_for_async :resource => tasks
end
|
#export_repository ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 45
def export_repository
tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportRepository,
@repository,
chunk_size: params[:chunk_size_gb],
from_history: @history,
format: find_export_format)
respond_for_async :resource => tasks
end
|
#find_exportable_content_view_version ⇒ Object
109
110
111
112
113
114
115
116
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 109
def find_exportable_content_view_version
@version = ContentViewVersion.exportable.find_by_id(params[:id])
throw_resource_not_found(name: 'content view version', id: params[:id]) if @version.blank?
@view = @version.content_view
if @view.rolling?
fail HttpErrors::BadRequest, _("It's not possible to export a rolling content view.")
end
end
|
#find_exportable_organization ⇒ Object
102
103
104
105
106
107
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 102
def find_exportable_organization
find_organization
unless @organization.can_export_content?
throw_resource_not_found(name: 'organization', id: params[:organization_id])
end
end
|
#find_exportable_repository ⇒ Object
91
92
93
94
95
96
97
98
99
100
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 91
def find_exportable_repository
@repository = Repository.find_by_id(params[:id])
if @repository.blank?
throw_resource_not_found(name: 'repository', id: params[:id])
end
unless @repository.organization.can_export_content?
throw_resource_not_found(name: 'organization', id: @repository.organization.id)
end
end
|
#find_incremental_history ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 118
def find_incremental_history
if params[:from_history_id].present?
find_incremental_history_from_id
else
@history = ::Katello::ContentViewVersionExportHistory.
latest(@view, destination_server: params[:destination_server])
if @history.blank?
msg = _("No existing export history was found to perform an incremental export. A full export must be performed")
fail HttpErrors::NotFound, msg
end
end
end
|
#find_incremental_history_from_id ⇒ Object
132
133
134
135
136
137
138
|
# File 'app/controllers/katello/api/v2/exports_controller.rb', line 132
def find_incremental_history_from_id
@history = ::Katello::ContentViewVersionExportHistory.find(params[:from_history_id])
if @history.blank?
throw_resource_not_found(name: 'export history',
id: params[:from_history_id])
end
end
|