katello 3.17.3 → 3.18.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +38 -21
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -1
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +10 -15
- data/app/controllers/katello/api/v2/api_controller.rb +2 -1
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -8
- data/app/controllers/katello/api/v2/content_view_components_controller.rb +31 -14
- data/app/controllers/katello/api/v2/content_view_repositories_controller.rb +1 -0
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +65 -36
- data/app/controllers/katello/api/v2/content_views_controller.rb +27 -25
- data/app/controllers/katello/api/v2/environments_controller.rb +8 -8
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +5 -5
- data/app/controllers/katello/api/v2/host_collections_controller.rb +19 -16
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +17 -0
- data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +8 -5
- data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/sync_plans_controller.rb +8 -9
- data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +9 -2
- data/app/controllers/katello/concerns/api/v2/authorization.rb +9 -5
- data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +21 -0
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
- data/app/controllers/katello/concerns/organizations_controller_extensions.rb +2 -1
- data/app/helpers/katello/katello_urls_helper.rb +5 -2
- data/app/lib/actions/candlepin/product/content_create.rb +2 -0
- data/app/lib/actions/candlepin/product/content_update.rb +2 -0
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +2 -6
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +2 -6
- data/app/lib/actions/katello/content_view/publish.rb +3 -4
- data/app/lib/actions/katello/content_view_version/import.rb +4 -3
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +18 -3
- data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
- data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
- data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
- data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
- data/app/lib/actions/katello/product/content_create.rb +7 -6
- data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
- data/app/lib/actions/katello/repository/import_upload.rb +2 -1
- data/app/lib/actions/katello/repository/update.rb +4 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +0 -1
- data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
- data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
- data/app/lib/actions/pulp3/content_view_version/export.rb +2 -1
- data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
- data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +15 -10
- data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -10
- data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
- data/app/lib/actions/pulp3/repository/delete.rb +1 -1
- data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
- data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
- data/app/lib/katello/resources/candlepin/owner.rb +5 -0
- data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
- data/app/lib/katello/resources/registry.rb +3 -3
- data/app/models/katello/authorization/activation_key.rb +4 -0
- data/app/models/katello/authorization/content_view.rb +13 -0
- data/app/models/katello/authorization/content_view_component.rb +15 -0
- data/app/models/katello/authorization/gpg_key.rb +12 -4
- data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
- data/app/models/katello/authorization/sync_plan.rb +16 -0
- data/app/models/katello/concerns/organization_extensions.rb +4 -5
- data/app/models/katello/concerns/redhat_extensions.rb +2 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -3
- data/app/models/katello/content_view_component.rb +2 -0
- data/app/models/katello/content_view_version_export_history.rb +2 -0
- data/app/models/katello/glue/candlepin/pool.rb +9 -14
- data/app/models/katello/glue/pulp/repo.rb +8 -0
- data/app/models/katello/gpg_key.rb +1 -1
- data/app/models/katello/root_repository.rb +26 -1
- data/app/services/katello/applicability/applicable_content_helper.rb +1 -12
- data/app/services/katello/candlepin/event_handler.rb +2 -0
- data/app/services/katello/candlepin/message_handler.rb +34 -0
- data/app/services/katello/candlepin/upstream_consumer.rb +28 -0
- data/app/services/katello/host_status_manager.rb +9 -0
- data/app/services/katello/pulp3/api/apt.rb +57 -0
- data/app/services/katello/pulp3/api/core.rb +8 -0
- data/app/services/katello/pulp3/content_view_version/export.rb +4 -3
- data/app/services/katello/pulp3/content_view_version/import.rb +5 -15
- data/app/services/katello/pulp3/deb.rb +38 -0
- data/app/services/katello/pulp3/erratum.rb +1 -2
- data/app/services/katello/pulp3/pulp_content_unit.rb +5 -0
- data/app/services/katello/pulp3/repository/ansible_collection.rb +9 -0
- data/app/services/katello/pulp3/repository/apt.rb +63 -0
- data/app/services/katello/pulp3/repository/docker.rb +4 -0
- data/app/services/katello/pulp3/repository/yum.rb +2 -1
- data/app/services/katello/pulp3/repository.rb +11 -9
- data/app/services/katello/pulp3/repository_mirror.rb +9 -4
- data/app/services/katello/pulp3/task.rb +3 -3
- data/app/services/katello/pulp3/task_group.rb +0 -6
- data/app/views/dashboard/_subscription_widget.html.erb +0 -5
- data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
- data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
- data/config/routes/api/v2.rb +2 -0
- data/config/routes/overrides.rb +1 -0
- data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +2 -5
- data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
- data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
- data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
- data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +16 -14
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
- data/lib/katello/engine.rb +1 -0
- data/lib/katello/permission_creator.rb +68 -59
- data/lib/katello/permissions/host_permissions.rb +1 -0
- data/lib/katello/plugin.rb +4 -1
- data/lib/katello/repository_types/deb.rb +9 -1
- data/lib/katello/tasks/pulp3_content_switchover.rake +1 -3
- data/lib/katello/tasks/pulp3_migration_stats.rake +21 -0
- data/lib/katello/tasks/reports.rake +1 -4
- data/lib/katello/tasks/reset.rake +2 -1
- data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
- data/lib/katello/version.rb +1 -1
- data/locale/action_names.rb +54 -47
- data/locale/bn/katello.po +165 -26
- data/locale/cs/katello.po +164 -24
- data/locale/de/katello.po +165 -26
- data/locale/en/katello.po +164 -23
- data/locale/es/katello.po +165 -25
- data/locale/fr/katello.po +165 -25
- data/locale/gu/katello.po +165 -26
- data/locale/hi/katello.po +165 -26
- data/locale/it/katello.po +165 -25
- data/locale/ja/katello.po +165 -26
- data/locale/katello.pot +1036 -802
- data/locale/kn/katello.po +165 -26
- data/locale/ko/katello.po +165 -25
- data/locale/mr/katello.po +165 -26
- data/locale/or/katello.po +165 -26
- data/locale/pa/katello.po +165 -26
- data/locale/pt/katello.po +164 -23
- data/locale/pt_BR/katello.po +165 -25
- data/locale/ru/katello.po +165 -25
- data/locale/ta/katello.po +165 -26
- data/locale/te/katello.po +165 -26
- data/locale/zh_CN/katello.po +165 -25
- data/locale/zh_TW/katello.po +165 -26
- data/webpack/components/ActionableDetail.js +2 -1
- data/webpack/components/Search/Search.js +1 -1
- data/webpack/components/Table/MainTable.js +6 -2
- data/webpack/components/Table/TableWrapper.js +46 -9
- data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
- data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
- data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
- data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
- data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
- data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
- data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
- data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
- data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +16 -8
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
- data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
- data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
- data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
- data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
- data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
- data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
- data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
- metadata +69 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7163fd6dce0ae11188b016225be2effa59131c5bcc4a4b3482a749dfba7ef545
|
4
|
+
data.tar.gz: 202f81621e52adce6d318faa95fa9a527c0e3fc0f25bab3c3cb2ca7133cb12e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29f15645418ab0683328f83b804dc3fdf45d7f93ce4d23578a558310e0f1ad3cb7f2d98fe74ba3d16181505df56f081092aacb2bb028364995ac15413674862a
|
7
|
+
data.tar.gz: 99b0a150d0d689951d63b2acb37a0bbab702bfb5a13739572e764f9b49eeda60bb3451b6cc6a7aae4c20886755b499637213afef91eb565a92e2c887a4dcc376
|
@@ -166,25 +166,27 @@ module Katello
|
|
166
166
|
headers[header[0].split('_')[1..-1].join('-')] = header[1]
|
167
167
|
end
|
168
168
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
169
|
+
if (manifest_response = redirect_client { Resources::Registry::Proxy.get(@_request.fullpath, headers) })
|
170
|
+
#when pulp 2 is removed, this should no longer be needed, and all clients should be redirected
|
171
|
+
logger.debug filter_sensitive_data(manifest_response)
|
172
|
+
results = JSON.parse(manifest_response)
|
173
|
+
|
174
|
+
response.header['Docker-Content-Digest'] = "sha256:#{Digest::SHA256.hexdigest(manifest_response)}"
|
175
|
+
# https://docs.docker.com/registry/spec/manifest-v2-2/
|
176
|
+
# If its v2 schema 2 only the mediaType attribute will be present in the manifest
|
177
|
+
media_type = results['mediaType']
|
178
|
+
if media_type.blank?
|
179
|
+
# so mediaType is not schema2 v2 only set the mediaType based on
|
180
|
+
# https://docs.docker.com/registry/spec/manifest-v2-1/
|
181
|
+
media_type = if results["signatures"].blank?
|
182
|
+
'application/vnd.docker.distribution.manifest.v1+json'
|
183
|
+
else
|
184
|
+
'application/vnd.docker.distribution.manifest.v1+prettyjws'
|
185
|
+
end
|
186
|
+
end
|
186
187
|
|
187
|
-
|
188
|
+
render json: manifest_response, content_type: media_type
|
189
|
+
end
|
188
190
|
end
|
189
191
|
|
190
192
|
def check_blob
|
@@ -199,11 +201,24 @@ module Katello
|
|
199
201
|
render json: {}
|
200
202
|
end
|
201
203
|
|
204
|
+
def redirect_client
|
205
|
+
return yield
|
206
|
+
rescue RestClient::Exception => exception
|
207
|
+
if [301, 302, 307].include?(exception.response.code)
|
208
|
+
redirect_to exception.response.headers[:location]
|
209
|
+
nil
|
210
|
+
else
|
211
|
+
raise exception
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
202
215
|
def pull_blob
|
203
216
|
headers = {}
|
204
217
|
headers['Accept'] = request.headers['Accept'] if request.headers['Accept']
|
205
|
-
|
206
|
-
|
218
|
+
if (blob_response = redirect_client { Resources::Registry::Proxy.get(@_request.fullpath, headers, max_redirects: 0) })
|
219
|
+
#when pulp 2 is removed, this should no longer be needed, and all clients should be redirected
|
220
|
+
render json: blob_response
|
221
|
+
end
|
207
222
|
end
|
208
223
|
|
209
224
|
def push_manifest
|
@@ -478,7 +493,9 @@ module Katello
|
|
478
493
|
end
|
479
494
|
|
480
495
|
def confirm_settings
|
481
|
-
|
496
|
+
if SETTINGS.dig(:katello, :container_image_registry) || SmartProxy.pulp_primary&.pulp3_repository_type_support?(::Katello::Repository::DOCKER_TYPE)
|
497
|
+
return true
|
498
|
+
end
|
482
499
|
render_error('custom_error', :status => :not_found,
|
483
500
|
:locals => { :message => "Registry not configured" })
|
484
501
|
end
|
@@ -119,7 +119,9 @@ module Katello
|
|
119
119
|
# Note that this request comes in as content-type 'text/plain' so that
|
120
120
|
# tomcat won't parse the json. Here we just pass the plain body through to candlepin
|
121
121
|
def async_hypervisors_update
|
122
|
-
task = Katello::Resources::Candlepin::Consumer.async_hypervisors(params[:owner],
|
122
|
+
task = Katello::Resources::Candlepin::Consumer.async_hypervisors(owner: params[:owner],
|
123
|
+
reporter_id: params[:reporter_id],
|
124
|
+
raw_json: request.raw_post)
|
123
125
|
async_task(::Actions::Katello::Host::Hypervisors, nil, :task_id => task['id'])
|
124
126
|
|
125
127
|
render :json => task
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module Katello
|
2
|
-
# rubocop:disable Metrics/ClassLength
|
3
2
|
class Api::V2::ActivationKeysController < Api::V2::ApiController
|
4
3
|
include Katello::Concerns::FilteredAutoCompleteSearch
|
5
4
|
include Katello::Concerns::Api::V2::ContentOverridesController
|
@@ -7,11 +6,10 @@ module Katello
|
|
7
6
|
before_action :find_environment, :only => [:index, :create, :update]
|
8
7
|
before_action :find_optional_organization, :only => [:index, :create, :show]
|
9
8
|
before_action :find_content_view, :only => [:index]
|
10
|
-
before_action :
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
before_action :authorize
|
9
|
+
before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :available_releases, :product_content,
|
10
|
+
:available_host_collections, :add_host_collections, :remove_host_collections,
|
11
|
+
:content_override, :add_subscriptions, :remove_subscriptions,
|
12
|
+
:subscriptions]
|
15
13
|
before_action :verify_simple_content_access_disabled, :only => [:add_subscriptions]
|
16
14
|
|
17
15
|
wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage purpose_addons content_view_environment))
|
@@ -97,6 +95,9 @@ module Katello
|
|
97
95
|
param :id, :number, :desc => N_("ID of the activation key"), :required => true
|
98
96
|
param :organization_id, :number, :desc => N_("organization identifier"), :required => false
|
99
97
|
def copy
|
98
|
+
@activation_key = Katello::ActivationKey.readable.find_by(:id => params[:id])
|
99
|
+
throw_resource_not_found(name: 'activation_key', id: params[:id]) if @activation_key.nil?
|
100
|
+
|
100
101
|
fail HttpErrors::BadRequest, _("New name cannot be blank") unless params[:new_name]
|
101
102
|
@new_activation_key = @activation_key.copy(params[:new_name])
|
102
103
|
@new_activation_key.user = current_user
|
@@ -256,12 +257,6 @@ module Katello
|
|
256
257
|
activation_keys
|
257
258
|
end
|
258
259
|
|
259
|
-
def find_activation_key
|
260
|
-
@activation_key = ActivationKey.find(params[:id])
|
261
|
-
fail HttpErrors::NotFound, _("Couldn't find activation key '%s'") % params[:id] if @activation_key.nil?
|
262
|
-
@activation_key
|
263
|
-
end
|
264
|
-
|
265
260
|
private
|
266
261
|
|
267
262
|
def subscription_index
|
@@ -281,7 +276,7 @@ module Katello
|
|
281
276
|
environment_id = params[:environment][:id] if !environment_id && params[:environment]
|
282
277
|
return unless environment_id
|
283
278
|
|
284
|
-
@environment = KTEnvironment.
|
279
|
+
@environment = KTEnvironment.readable.find_by(id: environment_id)
|
285
280
|
fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % params[:environment_id] if @environment.nil?
|
286
281
|
@organization = @environment.organization
|
287
282
|
@environment
|
@@ -292,7 +287,7 @@ module Katello
|
|
292
287
|
@host_collections = []
|
293
288
|
|
294
289
|
ids&.each do |host_collection_id|
|
295
|
-
host_collection = HostCollection.find(host_collection_id)
|
290
|
+
host_collection = HostCollection.readable.find(host_collection_id)
|
296
291
|
fail HttpErrors::NotFound, _("Couldn't find host collection '%s'") % host_collection_id if host_collection.nil?
|
297
292
|
@host_collections << host_collection
|
298
293
|
end
|
@@ -306,7 +301,7 @@ module Katello
|
|
306
301
|
def find_content_view
|
307
302
|
if params.include?(:content_view_id)
|
308
303
|
cv_id = params[:content_view_id]
|
309
|
-
@content_view = ContentView.find_by(:id => cv_id)
|
304
|
+
@content_view = ContentView.readable.find_by(:id => cv_id)
|
310
305
|
fail HttpErrors::NotFound, _("Couldn't find content view '%s'") % cv_id if @content_view.nil?
|
311
306
|
end
|
312
307
|
end
|
@@ -39,7 +39,8 @@ module Katello
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def deprecate_katello_agent
|
42
|
-
::Foreman::Deprecation.api_deprecation_warning("
|
42
|
+
::Foreman::Deprecation.api_deprecation_warning("Remote actions using katello-agent are deprecated and will be removed in Katello 4.0. " \
|
43
|
+
"You may consider switching to Remote Execution.")
|
43
44
|
end
|
44
45
|
|
45
46
|
def full_result_response(collection)
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module Katello
|
2
2
|
class Api::V2::ContentCredentialsController < Api::V2::ApiController
|
3
3
|
include Katello::Concerns::FilteredAutoCompleteSearch
|
4
|
-
before_action :authorize
|
5
4
|
before_action :find_organization, :only => [:create, :index, :auto_complete_search]
|
6
|
-
before_action :
|
5
|
+
before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :content, :set_content]
|
7
6
|
skip_before_action :check_media_type, :only => [:create, :content, :set_content]
|
8
7
|
|
9
8
|
def resource_class
|
@@ -103,12 +102,6 @@ module Katello
|
|
103
102
|
|
104
103
|
protected
|
105
104
|
|
106
|
-
def find_content_credential
|
107
|
-
@content_credential = GpgKey.find(params[:id])
|
108
|
-
rescue ActiveRecord::RecordNotFound
|
109
|
-
raise HttpErrors::NotFound, _("Couldn't find Content Credential '%s'") % params[:id]
|
110
|
-
end
|
111
|
-
|
112
105
|
def content_credential_params
|
113
106
|
params.permit(:name, :content_type, :content)
|
114
107
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Katello
|
2
2
|
class Api::V2::ContentViewComponentsController < Api::V2::ApiController
|
3
|
-
before_action :find_composite_content_view
|
4
|
-
before_action :
|
3
|
+
before_action :find_composite_content_view, :only => [:show, :index]
|
4
|
+
before_action :find_composite_content_view_for_edit, :only => [:add_components, :remove_components, :update]
|
5
|
+
before_action :find_authorized_katello_resource, :only => [:show, :update]
|
5
6
|
|
6
7
|
wrap_parameters :include => %w(composite_content_view_id content_view_version_id content_view_id latest)
|
7
8
|
|
@@ -13,7 +14,7 @@ module Katello
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def index_response
|
16
|
-
results = @view.content_view_components
|
17
|
+
results = @view.content_view_components.readable
|
17
18
|
{
|
18
19
|
:results => results.uniq,
|
19
20
|
:subtotal => results.count,
|
@@ -31,15 +32,26 @@ module Katello
|
|
31
32
|
param :latest, :bool, :desc => N_("true if the latest version of the component's content view is desired")
|
32
33
|
end
|
33
34
|
def add_components
|
35
|
+
@view.add_components(authorized_components)
|
36
|
+
@view.save!
|
37
|
+
respond_for_index(:collection => index_response, :template => "index")
|
38
|
+
end
|
39
|
+
|
40
|
+
private def authorized_components
|
34
41
|
components = params.require(:components).map do |component|
|
35
42
|
component = component.permit([:latest, :content_view_version_id, :content_view_id])
|
36
43
|
options = {}
|
37
44
|
options[:latest] = ::Foreman::Cast.to_bool(component[:latest]) if component.key?(:latest)
|
38
|
-
options.merge(component.slice(:content_view_version_id, :content_view_id))
|
45
|
+
options.merge(component.slice(:content_view_version_id, :content_view_id)).with_indifferent_access
|
46
|
+
end
|
47
|
+
|
48
|
+
components.each do |component|
|
49
|
+
if component[:content_view_version_id] && Katello::ContentViewVersion.readable.find_by(id: component[:content_view_version_id]).nil?
|
50
|
+
throw_resource_not_found(name: 'content_view_version', id: component[:content_view_version_id])
|
51
|
+
elsif component[:content_view_id] && Katello::ContentView.readable.find_by(id: component[:content_view_id]).nil?
|
52
|
+
throw_resource_not_found(name: 'content_view', id: component[:content_view_id])
|
53
|
+
end
|
39
54
|
end
|
40
|
-
@view.add_components(components)
|
41
|
-
@view.save!
|
42
|
-
respond_for_index(:collection => index_response, :template => "index")
|
43
55
|
end
|
44
56
|
|
45
57
|
api :PUT, "/content_views/:composite_content_view_id/content_view_components/remove",
|
@@ -56,7 +68,7 @@ module Katello
|
|
56
68
|
param :composite_content_view_id, :number, :desc => N_("composite content view numeric identifier"), :required => true
|
57
69
|
param :id, :number, :desc => N_("content view component ID. Identifier of the component association"), :required => true
|
58
70
|
def show
|
59
|
-
respond :resource => @
|
71
|
+
respond :resource => @content_view_component
|
60
72
|
end
|
61
73
|
|
62
74
|
api :PUT, "/content_views/:composite_content_view_id/content_view_components/:id",
|
@@ -67,6 +79,9 @@ module Katello
|
|
67
79
|
param :latest, :bool, :desc => N_("true if the latest version of the components content view is desired")
|
68
80
|
def update
|
69
81
|
cvv_id = component_params[:content_view_version_id]
|
82
|
+
if cvv_id && Katello::ContentViewVersion.readable.find_by(id: cvv_id).nil?
|
83
|
+
throw_resource_not_found(name: 'content view version', id: cvv_id)
|
84
|
+
end
|
70
85
|
if component_params.key?(:latest) && component_params.key?(:content_view_version_id)
|
71
86
|
latest = ::Foreman::Cast.to_bool(component_params[:latest])
|
72
87
|
if latest && cvv_id.present?
|
@@ -75,22 +90,24 @@ module Katello
|
|
75
90
|
end
|
76
91
|
end
|
77
92
|
if cvv_id.present?
|
78
|
-
@
|
93
|
+
@content_view_component.update!(:content_view_version_id => cvv_id, :latest => false)
|
79
94
|
elsif component_params.key?(:latest)
|
80
95
|
latest = ::Foreman::Cast.to_bool(component_params[:latest])
|
81
|
-
@
|
96
|
+
@content_view_component.update!(:content_view_version_id => nil, :latest => latest)
|
82
97
|
end
|
83
|
-
respond :resource => @
|
98
|
+
respond :resource => @content_view_component
|
84
99
|
end
|
85
100
|
|
86
101
|
private
|
87
102
|
|
88
103
|
def find_composite_content_view
|
89
|
-
@view = ContentView.composite.non_default.
|
104
|
+
@view = ContentView.composite.non_default.readable.find_by(id: params[:composite_content_view_id])
|
105
|
+
throw_resource_not_found(name: 'composite content view', id: params[:composite_content_view_id]) if @view.nil?
|
90
106
|
end
|
91
107
|
|
92
|
-
def
|
93
|
-
@
|
108
|
+
def find_composite_content_view_for_edit
|
109
|
+
@view = ContentView.composite.non_default.editable.find_by(id: params[:composite_content_view_id])
|
110
|
+
throw_resource_not_found(name: 'composite content view', id: params[:composite_content_view_id]) if @view.nil?
|
94
111
|
end
|
95
112
|
|
96
113
|
def component_params
|
@@ -25,6 +25,7 @@ module Katello
|
|
25
25
|
SQL
|
26
26
|
|
27
27
|
query = Katello::Repository.readable.in_default_view.in_organization(@organization)
|
28
|
+
query = query.with_type(params[:content_type]) if params[:content_type]
|
28
29
|
# Use custom sort to perform the join and order since we need to order by specific content_view
|
29
30
|
# and the ORDER BY query needs access to the katello_content_view_repositories table
|
30
31
|
custom_sort = ->(sort_query) { sort_query.joins(:root).joins(join_query).order(order_query) }
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Katello
|
2
|
+
# rubocop:disable Metrics/ClassLength
|
2
3
|
class Api::V2::ContentViewVersionsController < Api::V2::ApiController
|
3
4
|
include Concerns::Api::V2::BulkHostsExtensions
|
4
5
|
include Katello::Concerns::FilteredAutoCompleteSearch
|
@@ -99,55 +100,34 @@ module Katello
|
|
99
100
|
:template => '../../../api/v2/content_view_version_export_histories/index')
|
100
101
|
end
|
101
102
|
|
103
|
+
api :GET, "/content_view_versions/export_api_status", N_("true if the export api is pulp3 ready and usable. This API is intended for use by hammer-cli only.")
|
104
|
+
def export_api_status
|
105
|
+
::Foreman::Deprecation.api_deprecation_warning("export_api_status is being deprecated and will be removed in a future version of Katello.")
|
106
|
+
render json: { api_usable: SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE) }, status: :ok
|
107
|
+
end
|
108
|
+
|
102
109
|
api :POST, "/content_view_versions/:id/export", N_("Export a content view version")
|
103
110
|
param :id, :number, :desc => N_("Content view version identifier"), :required => true
|
104
111
|
param :destination_server, String, :desc => N_("Destination Server name, required for Pulp3")
|
112
|
+
param :chunk_size_mb, :number, :desc => N_("Chunk export-tarfile into pieces of chunk_size mega bytes. Relevant only for Pulp 3 repositories"), :required => false
|
105
113
|
param :export_to_iso, :bool, :desc => N_("Export to ISO format. Relevant only for Pulp 2 repositories"), :required => false
|
106
114
|
param :iso_mb_size, :number, :desc => N_("maximum size of each ISO in MB. Relevant only for Pulp 2 repositories"), :required => false
|
107
115
|
param :since, Date, :desc => N_("Optional date of last export (ex: 2010-01-01T12:00:00Z). Relevant only for Pulp 2 repositories"), :required => false
|
108
116
|
def export
|
109
|
-
if SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
if params[:destination_server].blank?
|
116
|
-
fail HttpErrors::BadRequest, _("Destination Server Name required for Pulp3 repositories")
|
117
|
-
end
|
118
|
-
|
119
|
-
task = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export, @version, destination_server: params[:destination_server])
|
120
|
-
else
|
121
|
-
::Foreman::Deprecation.api_deprecation_warning("Export is being deprecated and will be removed in a future version of Katello. Use hammer content-view version export instead.")
|
122
|
-
if params[:export_to_iso].blank? && params[:iso_mb_size].present?
|
123
|
-
fail HttpErrors::BadRequest, _("ISO export must be enabled when specifying ISO size")
|
124
|
-
end
|
125
|
-
|
126
|
-
if (repos = @version.content_view.on_demand_repositories).any?
|
127
|
-
fail HttpErrors::BadRequest, _("This content view has on demand repositories that cannot be exported: %{repos}" % {repos: repos.pluck(:label).join(", ")})
|
128
|
-
end
|
129
|
-
|
130
|
-
if params[:since].present?
|
131
|
-
begin
|
132
|
-
params[:since].to_datetime
|
133
|
-
rescue
|
134
|
-
raise HttpErrors::BadRequest, _("Invalid date provided.")
|
135
|
-
end
|
136
|
-
end
|
137
|
-
task = async_task(::Actions::Katello::ContentViewVersion::Export, @version,
|
138
|
-
::Foreman::Cast.to_bool(params[:export_to_iso]),
|
139
|
-
params[:since].try(:to_datetime),
|
140
|
-
params[:iso_mb_size])
|
141
|
-
end
|
142
|
-
|
117
|
+
task = if SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
|
118
|
+
export_pulp_v3
|
119
|
+
else
|
120
|
+
export_pulp_v2
|
121
|
+
end
|
143
122
|
respond_for_async :resource => task
|
144
123
|
end
|
145
124
|
|
146
125
|
api :POST, "/content_view_versions/import", N_("Import a content view version")
|
147
126
|
param :content_view_id, :number, :desc => N_("Content view identifier"), :required => true
|
148
|
-
param :path, String, :desc => N_("
|
127
|
+
param :path, String, :desc => N_("Directory containing the exported Content View Version"), :required => true
|
128
|
+
param :metadata, Hash, :desc => N_("Metadata taken from the upstream export history for this Content View Version"), :required => true
|
149
129
|
def import
|
150
|
-
task = async_task(::Actions::Katello::ContentViewVersion::Import, @view, path: params[:path])
|
130
|
+
task = async_task(::Actions::Katello::ContentViewVersion::Import, @view, path: params[:path], metadata: metadata_params)
|
151
131
|
respond_for_async :resource => task
|
152
132
|
end
|
153
133
|
|
@@ -341,5 +321,54 @@ module Katello
|
|
341
321
|
return deny_access unless @version.content_view.deletable?
|
342
322
|
true
|
343
323
|
end
|
324
|
+
|
325
|
+
def export_pulp_v2
|
326
|
+
::Foreman::Deprecation.api_deprecation_warning("Export is being deprecated and will be removed in a future version of Katello. Use hammer content-view version export instead.")
|
327
|
+
if params[:export_to_iso].blank? && params[:iso_mb_size].present?
|
328
|
+
fail HttpErrors::BadRequest, _("ISO export must be enabled when specifying ISO size")
|
329
|
+
end
|
330
|
+
|
331
|
+
if (repos = @version.content_view.on_demand_repositories).any?
|
332
|
+
fail HttpErrors::BadRequest, _("This content view has on demand repositories that cannot be exported: %{repos}" % {repos: repos.pluck(:label).join(", ")})
|
333
|
+
end
|
334
|
+
|
335
|
+
if params[:since].present?
|
336
|
+
begin
|
337
|
+
params[:since].to_datetime
|
338
|
+
rescue
|
339
|
+
raise HttpErrors::BadRequest, _("Invalid date provided.")
|
340
|
+
end
|
341
|
+
end
|
342
|
+
async_task(::Actions::Katello::ContentViewVersion::Export, @version,
|
343
|
+
::Foreman::Cast.to_bool(params[:export_to_iso]),
|
344
|
+
params[:since].try(:to_datetime),
|
345
|
+
params[:iso_mb_size])
|
346
|
+
end
|
347
|
+
|
348
|
+
def export_pulp_v3
|
349
|
+
invalid_params = [:export_to_iso, :iso_mb_size, :since].reject { |param| params[param].blank? }
|
350
|
+
unless invalid_params.empty?
|
351
|
+
fail HttpErrors::BadRequest, _("Invalid parameters provided - %{params}. These are only relevant for Pulp 2 repositories" % { params: invalid_params.join(', ')})
|
352
|
+
end
|
353
|
+
|
354
|
+
if params[:destination_server].blank?
|
355
|
+
fail HttpErrors::BadRequest, _("Destination Server Name required for Pulp3 repositories")
|
356
|
+
end
|
357
|
+
|
358
|
+
async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export, @version, destination_server: params[:destination_server],
|
359
|
+
chunk_size: params[:chunk_size_mb])
|
360
|
+
end
|
361
|
+
|
362
|
+
def metadata_params
|
363
|
+
params.require(:metadata).permit(
|
364
|
+
:organization,
|
365
|
+
:content_view,
|
366
|
+
:repository_mapping,
|
367
|
+
:toc,
|
368
|
+
content_view_version: [:major, :minor]
|
369
|
+
).tap do |nested|
|
370
|
+
nested[:repository_mapping] = params[:metadata].require(:repository_mapping).permit!
|
371
|
+
end
|
372
|
+
end
|
344
373
|
end
|
345
374
|
end
|
@@ -3,7 +3,8 @@ module Katello
|
|
3
3
|
include Concerns::Authorization::Api::V2::ContentViewsController
|
4
4
|
include Katello::Concerns::FilteredAutoCompleteSearch
|
5
5
|
|
6
|
-
before_action :
|
6
|
+
before_action :find_authorized_katello_resource, :except => [:index, :create, :copy, :auto_complete_search]
|
7
|
+
before_action :ensure_non_default, :except => [:index, :create, :copy, :auto_complete_search]
|
7
8
|
before_action :find_organization, :only => [:create]
|
8
9
|
before_action :find_optional_organization, :only => [:index, :auto_complete_search]
|
9
10
|
before_action :find_environment, :only => [:index, :remove_from_environment]
|
@@ -66,12 +67,12 @@ module Katello
|
|
66
67
|
param :composite, :bool, :desc => N_("Composite content view")
|
67
68
|
param_group :content_view
|
68
69
|
def create
|
69
|
-
@
|
70
|
+
@content_view = ContentView.create!(view_params) do |view|
|
70
71
|
view.organization = @organization
|
71
72
|
view.label ||= labelize_params(params[:content_view])
|
72
73
|
end
|
73
74
|
|
74
|
-
respond :resource => @
|
75
|
+
respond :resource => @content_view
|
75
76
|
end
|
76
77
|
|
77
78
|
api :PUT, "/content_views/:id", N_("Update a content view")
|
@@ -79,8 +80,8 @@ module Katello
|
|
79
80
|
param :name, String, :desc => N_("New name for the content view")
|
80
81
|
param_group :content_view
|
81
82
|
def update
|
82
|
-
sync_task(::Actions::Katello::ContentView::Update, @
|
83
|
-
respond :resource => @
|
83
|
+
sync_task(::Actions::Katello::ContentView::Update, @content_view, view_params)
|
84
|
+
respond :resource => @content_view.reload
|
84
85
|
end
|
85
86
|
|
86
87
|
api :POST, "/content_views/:id/publish", N_("Publish a content view")
|
@@ -93,7 +94,7 @@ module Katello
|
|
93
94
|
param :rpm_filenames, Array, of: String, :desc => N_("list of rpm filename strings to include in published version"), :required => true
|
94
95
|
end
|
95
96
|
def publish
|
96
|
-
if params[:repos_units].present? && @
|
97
|
+
if params[:repos_units].present? && @content_view.composite?
|
97
98
|
fail HttpErrors::BadRequest, _("Directly setting package lists on composite content views is not allowed. Please " \
|
98
99
|
"update the components, then re-publish the composite.")
|
99
100
|
end
|
@@ -105,7 +106,7 @@ module Katello
|
|
105
106
|
fail HttpErrors::BadRequest, _("Both major and minor parameters have to be used to override a CV version")
|
106
107
|
end
|
107
108
|
|
108
|
-
task = async_task(::Actions::Katello::ContentView::Publish, @
|
109
|
+
task = async_task(::Actions::Katello::ContentView::Publish, @content_view, params[:description],
|
109
110
|
:major => params[:major],
|
110
111
|
:minor => params[:minor],
|
111
112
|
:repos_units => params[:repos_units])
|
@@ -115,7 +116,7 @@ module Katello
|
|
115
116
|
api :GET, "/content_views/:id", N_("Show a content view")
|
116
117
|
param :id, :number, :desc => N_("content view numeric identifier"), :required => true
|
117
118
|
def show
|
118
|
-
respond :resource => @
|
119
|
+
respond :resource => @content_view
|
119
120
|
end
|
120
121
|
|
121
122
|
api :GET, "/content_views/:id/available_puppet_modules",
|
@@ -123,9 +124,9 @@ module Katello
|
|
123
124
|
param :id, :number, :desc => N_("content view numeric identifier"), :required => true
|
124
125
|
param :name, String, :desc => N_("module name to restrict modules for"), :required => false
|
125
126
|
def available_puppet_modules
|
126
|
-
current_cv_puppet_modules = @
|
127
|
+
current_cv_puppet_modules = @content_view.content_view_puppet_modules.where("uuid is NOT NULL")
|
127
128
|
current_uuids = current_cv_puppet_modules.pluck(:uuid)
|
128
|
-
repositories = @
|
129
|
+
repositories = @content_view.organization.library.puppet_repositories
|
129
130
|
query = PuppetModule.in_repositories(repositories)
|
130
131
|
selected_latest_versions = []
|
131
132
|
if params[:name]
|
@@ -154,9 +155,9 @@ module Katello
|
|
154
155
|
N_("Get puppet modules names that are available to be added to the content view")
|
155
156
|
param :id, :number, :desc => N_("content view numeric identifier"), :required => true
|
156
157
|
def available_puppet_module_names
|
157
|
-
current_names = @
|
158
|
+
current_names = @content_view.content_view_puppet_modules.where("name is NOT NULL").pluck(:name)
|
158
159
|
|
159
|
-
repos = @
|
160
|
+
repos = @content_view.organization.library.puppet_repositories
|
160
161
|
|
161
162
|
modules = PuppetModule.in_repositories(repos)
|
162
163
|
modules = modules.where('name NOT in (?)', current_names) if current_names.present?
|
@@ -169,12 +170,12 @@ module Katello
|
|
169
170
|
param :id, :number, :desc => N_("content view numeric identifier"), :required => true
|
170
171
|
param :environment_id, :number, :desc => N_("environment numeric identifier"), :required => true
|
171
172
|
def remove_from_environment
|
172
|
-
unless @
|
173
|
+
unless @content_view.environments.include?(@environment)
|
173
174
|
fail HttpErrors::BadRequest, _("Content view '%{view}' is not in lifecycle environment '%{env}'.") %
|
174
|
-
{view: @
|
175
|
+
{view: @content_view.name, env: @environment.name}
|
175
176
|
end
|
176
177
|
|
177
|
-
task = async_task(::Actions::Katello::ContentView::RemoveFromEnvironment, @
|
178
|
+
task = async_task(::Actions::Katello::ContentView::RemoveFromEnvironment, @content_view, @environment)
|
178
179
|
respond_for_async :resource => task
|
179
180
|
end
|
180
181
|
|
@@ -190,7 +191,7 @@ module Katello
|
|
190
191
|
cv_envs = ContentViewEnvironment.where(:environment_id => params[:environment_ids],
|
191
192
|
:content_view_id => params[:id]
|
192
193
|
)
|
193
|
-
versions = @
|
194
|
+
versions = @content_view.versions.where(:id => params[:content_view_version_ids])
|
194
195
|
|
195
196
|
if cv_envs.empty? && versions.empty?
|
196
197
|
fail _("There either were no environments nor versions specified or there were invalid environments/versions specified. "\
|
@@ -205,14 +206,14 @@ module Katello
|
|
205
206
|
options[:content_view_versions] = versions
|
206
207
|
options[:content_view_environments] = cv_envs
|
207
208
|
|
208
|
-
task = async_task(::Actions::Katello::ContentView::Remove, @
|
209
|
+
task = async_task(::Actions::Katello::ContentView::Remove, @content_view, options)
|
209
210
|
respond_for_async :resource => task
|
210
211
|
end
|
211
212
|
|
212
213
|
api :DELETE, "/content_views/:id", N_("Delete a content view")
|
213
214
|
param :id, :number, :desc => N_("content view numeric identifier"), :required => true
|
214
215
|
def destroy
|
215
|
-
task = async_task(::Actions::Katello::ContentView::Destroy, @
|
216
|
+
task = async_task(::Actions::Katello::ContentView::Destroy, @content_view)
|
216
217
|
respond_for_async :resource => task
|
217
218
|
end
|
218
219
|
|
@@ -220,16 +221,17 @@ module Katello
|
|
220
221
|
param :id, :number, :desc => N_("Content view numeric identifier"), :required => true
|
221
222
|
param :name, String, :required => true, :desc => N_("New content view name")
|
222
223
|
def copy
|
223
|
-
|
224
|
+
@content_view = Katello::ContentView.readable.find_by(:id => params[:id])
|
225
|
+
throw_resource_not_found(name: 'content_view', id: params[:id]) if @content_view.blank?
|
226
|
+
ensure_non_default
|
227
|
+
new_content_view = @content_view.copy(params[:content_view][:name])
|
224
228
|
respond_for_create :resource => new_content_view
|
225
229
|
end
|
226
230
|
|
227
231
|
private
|
228
232
|
|
229
|
-
def
|
230
|
-
@
|
231
|
-
|
232
|
-
if @view.default? && !%w(show history).include?(params[:action])
|
233
|
+
def ensure_non_default
|
234
|
+
if @content_view.default? && !%w(show history).include?(params[:action])
|
233
235
|
fail HttpErrors::BadRequest, _("The default content view cannot be edited, published, or deleted.")
|
234
236
|
end
|
235
237
|
end
|
@@ -238,7 +240,7 @@ module Katello
|
|
238
240
|
attrs = [:name, :description, :force_puppet_environment, :auto_publish, :solve_dependencies,
|
239
241
|
:default, :created_at, :updated_at, :next_version, {:component_ids => []}]
|
240
242
|
attrs.push(:label, :composite) if action_name == "create"
|
241
|
-
if (!@
|
243
|
+
if (!@content_view || !@content_view.composite?)
|
242
244
|
attrs.push({:repository_ids => []}, :repository_ids)
|
243
245
|
end
|
244
246
|
params.require(:content_view).permit(*attrs).to_h
|
@@ -246,7 +248,7 @@ module Katello
|
|
246
248
|
|
247
249
|
def find_environment
|
248
250
|
return if !params.key?(:environment_id) && params[:action] == "index"
|
249
|
-
@environment = KTEnvironment.find(params[:environment_id])
|
251
|
+
@environment = KTEnvironment.readable.find(params[:environment_id])
|
250
252
|
end
|
251
253
|
|
252
254
|
def add_use_latest_records(module_records, selected_latest_versions)
|