Class: Katello::Api::V2::CapsuleContentController
- Inherits:
-
ApiController
- Object
- Api::V2::BaseController
- ApiController
- Katello::Api::V2::CapsuleContentController
show all
- Defined in:
- app/controllers/katello/api/v2/capsule_content_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
#add_lifecycle_environment ⇒ Object
46
47
48
49
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 46
def add_lifecycle_environment
@capsule.add_lifecycle_environment(@environment)
respond_for_lifecycle_environments_index(@capsule.lifecycle_environments)
end
|
#available_lifecycle_environments ⇒ Object
39
40
41
42
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 39
def available_lifecycle_environments
environments = @capsule.available_lifecycle_environments(params[:organization_id]).readable
respond_for_lifecycle_environments_index(environments)
end
|
#cancel_sync ⇒ Object
109
110
111
112
113
114
115
116
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 109
def cancel_sync
tasks = @capsule.cancel_sync
if tasks.empty?
render_message _('There\'s no running synchronization for this smart proxy.')
else
render_message _('Trying to cancel the synchronization...')
end
end
|
#counts ⇒ Object
25
26
27
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 25
def counts
render json: @capsule.content_counts.to_json
end
|
#lifecycle_environments ⇒ Object
31
32
33
34
35
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 31
def lifecycle_environments
environments = @capsule.lifecycle_environments
environment_org_scope = params[:organization_id] ? environments.where(organization_id: params[:organization_id]) : environments
respond_for_lifecycle_environments_index(environment_org_scope)
end
|
#reclaim_space ⇒ Object
120
121
122
123
124
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 120
def reclaim_space
find_capsule(true)
task = async_task(::Actions::Pulp3::CapsuleContent::ReclaimSpace, @capsule)
respond_for_async :resource => task
end
|
#remove_lifecycle_environment ⇒ Object
53
54
55
56
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 53
def remove_lifecycle_environment
@capsule.remove_lifecycle_environment(@environment)
respond_for_lifecycle_environments_index(@capsule.lifecycle_environments)
end
|
#sync ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 64
def sync
find_environment if params[:environment_id]
find_content_view if params[:content_view_id]
find_repository if params[:repository_id]
skip_metadata_check = ::Foreman::Cast.to_bool(params[:skip_metadata_check])
sync_options = {
:environment_id => @environment.try(:id),
:content_view_id => @content_view.try(:id),
:repository_id => @repository.try(:id),
:skip_metadata_check => skip_metadata_check,
}
sync_options[:environment_ids] = @capsule.lifecycle_environments&.pluck(:id) unless (@environment || @content_view || @repository)
task = async_task(::Actions::Katello::CapsuleContent::Sync,
@capsule,
sync_options)
respond_for_async :resource => task
end
|
#sync_status ⇒ Object
103
104
105
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 103
def sync_status
@lifecycle_environments = @organization ? @capsule.lifecycle_environments.where(organization_id: @organization.id) : @capsule.lifecycle_environments
end
|
#update_counts ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 87
def update_counts
find_environment if params[:environment_id]
find_content_view if params[:content_view_id]
find_repository if params[:repository_id]
count_options = {
:environment_id => @environment.try(:id),
:content_view_id => @content_view.try(:id),
:repository_id => @repository.try(:id),
}
task = async_task(::Actions::Katello::CapsuleContent::UpdateContentCounts, @capsule, count_options)
respond_for_async :resource => task
end
|
#verify_checksum ⇒ Object
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'app/controllers/katello/api/v2/capsule_content_controller.rb', line 131
def verify_checksum
find_capsule(false)
find_environment if params[:environment_id]
find_content_view if params[:content_view_id]
find_repository if params[:repository_id]
repair_options = {
:environment_id => @environment.try(:id),
:content_view_id => @content_view.try(:id),
:repository_id => @repository.try(:id),
}
repair_options[:environment_ids] = @capsule.lifecycle_environments&.pluck(:id) unless (@environment || @content_view || @repository)
task = async_task(::Actions::Katello::CapsuleContent::VerifyChecksum,
@capsule,
repair_options)
respond_for_async :resource => task
end
|