katello 3.7.1.1 → 3.8.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/README.md +8 -7
- data/app/assets/javascripts/katello/common/index.js +0 -1
- data/app/assets/javascripts/katello/sync_management/index.js +0 -1
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +477 -0
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +2 -2
- data/app/controllers/katello/api/v2/api_controller.rb +3 -1
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +15 -1
- data/app/controllers/katello/api/v2/environments_controller.rb +5 -2
- data/app/controllers/katello/api/v2/errata_controller.rb +48 -34
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_packages_controller.rb +5 -1
- data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
- data/app/controllers/katello/api/v2/packages_controller.rb +33 -22
- data/app/controllers/katello/api/v2/products_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +6 -5
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -10
- data/app/controllers/katello/api/v2/sync_plans_controller.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +20 -12
- data/app/controllers/katello/remote_execution_controller.rb +6 -6
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +9 -37
- data/app/lib/actions/katello/content_view/promote.rb +6 -2
- data/app/lib/actions/katello/content_view_version/after_promote_hook.rb +11 -0
- data/app/lib/actions/katello/content_view_version/before_promote_hook.rb +11 -0
- data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
- data/app/lib/actions/pulp/consumer/abstract_content_action.rb +0 -12
- data/app/lib/actions/pulp/consumer/content_install.rb +1 -1
- data/app/lib/actions/pulp/consumer/content_uninstall.rb +1 -1
- data/app/lib/actions/pulp/consumer/content_update.rb +1 -1
- data/app/lib/katello/resources/registry.rb +40 -0
- data/app/lib/katello/util/package.rb +9 -4
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -1
- data/app/models/katello/content_view.rb +4 -12
- data/app/models/katello/content_view_version.rb +26 -0
- data/app/models/katello/glue/candlepin/owner.rb +8 -0
- data/app/models/katello/glue/candlepin/pool.rb +11 -11
- data/app/models/katello/glue/candlepin/repository.rb +1 -1
- data/app/models/katello/glue/pulp/repos.rb +1 -0
- data/app/models/katello/host/content_facet.rb +1 -2
- data/app/models/katello/kt_environment.rb +6 -0
- data/app/models/katello/product_content.rb +1 -4
- data/app/models/katello/repository.rb +2 -0
- data/app/models/katello/rpm.rb +118 -14
- data/app/services/katello/puppet_class_importer_extensions.rb +17 -20
- data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -3
- data/app/views/katello/api/v2/common/copy.json.rabl +3 -0
- data/app/views/katello/api/v2/environments/show.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +4 -2
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -2
- data/config/katello.yaml +89 -0
- data/config/routes.rb +0 -1
- data/config/routes/api/registry.rb +29 -0
- data/config/routes/api/v2.rb +1 -1
- data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +0 -3
- data/db/migrate/20180614184822_add_unauthenticated_pull.rb +9 -0
- data/db/migrate/20180618195941_add_description_to_repository.rb +5 -0
- data/db/seeds.d/75-job_templates.rb +2 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +3 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +1 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-installed.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.controller.js +32 -18
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-docker.html +2 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-details.html +32 -23
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +8 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +1 -1
- data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +0 -5
- data/lib/katello/engine.rb +1 -0
- data/lib/katello/permission_creator.rb +2 -0
- data/lib/katello/permissions/registry_permissions.rb +20 -0
- data/lib/katello/plugin.rb +1 -0
- data/lib/katello/tasks/clean_backend_objects.rake +3 -12
- data/lib/katello/version.rb +1 -1
- data/package.json +7 -10
- data/webpack/components/Search/Search.test.js +1 -3
- data/webpack/containers/Application/config.js +2 -9
- data/webpack/containers/Application/index.js +2 -4
- data/webpack/mockRequest.js +3 -3
- data/webpack/move_to_foreman/common/helpers.js +8 -45
- data/webpack/move_to_foreman/components/common/{EmptyState → emptyState}/index.js +3 -16
- data/webpack/move_to_foreman/components/common/table/components/Table.js +1 -1
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +2 -2
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +1 -1
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +1 -1
- data/webpack/move_to_pf/LoadingState/LoadingState.js +14 -27
- data/webpack/move_to_pf/LoadingState/LoadingState.test.js +4 -8
- data/webpack/move_to_pf/react-bootstrap-select/index.js +1 -12
- data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -0
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/redux/actions/RedHatRepositories/sets.js +1 -1
- data/webpack/redux/consts.js +0 -6
- data/webpack/redux/reducers/index.js +0 -2
- data/webpack/scenes/RedHatRepositories/components/EnabledRepository.js +23 -14
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/SearchBar.js +0 -1
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +1 -3
- data/webpack/scenes/RedHatRepositories/index.js +3 -7
- data/webpack/scenes/RedHatRepositories/index.scss +0 -1
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +8 -3
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +1 -30
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +28 -111
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +1 -3
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +1 -6
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +424 -519
- data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +4 -7
- data/webpack/scenes/Subscriptions/Details/index.js +3 -5
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +34 -78
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +24 -5
- data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryReducer.js +1 -9
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +0 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +8 -20
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestHistoryReducer.test.js +1 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +7 -34
- data/webpack/scenes/Subscriptions/Manifest/__tests__/manifest.fixtures.js +16 -9
- data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
- data/webpack/scenes/Subscriptions/SubscriptionActions.js +26 -5
- data/webpack/scenes/Subscriptions/SubscriptionConstants.js +0 -1
- data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +0 -3
- data/webpack/scenes/Subscriptions/SubscriptionReducer.js +4 -11
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +36 -31
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +12 -3
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +27 -57
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js +3 -2
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +5 -10
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsActions.test.js +5 -10
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +4 -49
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsReducer.test.js +3 -8
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +11 -21
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +8 -5
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -2
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +3 -9
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -14
- data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +17 -11
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +5 -8
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +58 -45
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +4 -11
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +3 -16
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +365 -392
- data/webpack/scenes/Subscriptions/index.js +0 -1
- data/webpack/services/api/fixtures.js +353 -0
- data/webpack/services/api/index.js +1 -17
- data/webpack/test_setup.js +0 -2
- metadata +16 -37
- data/config/katello.yml +0 -59
- data/webpack/__mocks__/foremanReact/components/BreadcrumbBar.js +0 -3
- data/webpack/__mocks__/foremanReact/redux.js +0 -3
- data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
- data/webpack/components/SelectOrg/SelectOrg.scss +0 -3
- data/webpack/components/SelectOrg/SelectOrgAction.js +0 -41
- data/webpack/components/SelectOrg/SelectOrgReducer.js +0 -33
- data/webpack/components/SelectOrg/SetOrganization.js +0 -116
- data/webpack/components/WithOrganization/withOrganization.js +0 -28
- data/webpack/global_test_setup.js +0 -6
- data/webpack/helpers/caret.js +0 -6
- data/webpack/move_to_pf/Select/Select.js +0 -40
- data/webpack/scenes/Products/ProductActions.js +0 -24
- data/webpack/scenes/Products/ProductConstants.js +0 -3
- data/webpack/scenes/Products/__tests__/ProductActions.test.js +0 -40
- data/webpack/scenes/Products/__tests__/products.fixtures.js +0 -90
- data/webpack/scenes/RedHatRepositories/components/EnabledRepositoryContent.js +0 -34
- data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepository.test.js +0 -36
- data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepositoryContent.test.js +0 -27
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepository.test.js.snap +0 -25
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepositoryContent.test.js.snap +0 -47
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailEnabledProducts.js +0 -54
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js +0 -29
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.scss +0 -9
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailEnabledProducts.test.js +0 -18
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProduct.test.js +0 -13
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailEnabledProducts.test.js.snap +0 -45
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProduct.test.js.snap +0 -67
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/EntitlementsInlineEditFormatter.test.js +0 -110
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +0 -228
- data/webpack/scenes/Tasks/helpers.js +0 -52
- data/webpack/services/api/testHelpers.js +0 -28
@@ -34,7 +34,7 @@ module Katello
|
|
34
34
|
def yum_gpg_key_url
|
35
35
|
# if the repo has a gpg key return a url to access it
|
36
36
|
if (gpg_key && gpg_key.content.present?)
|
37
|
-
host =
|
37
|
+
host = SETTINGS[:fqdn]
|
38
38
|
gpg_key_content_api_repository_url(self, :host => host + "/katello", :protocol => 'https')
|
39
39
|
end
|
40
40
|
end
|
@@ -211,6 +211,7 @@ module Katello
|
|
211
211
|
:arch => repo_param[:arch],
|
212
212
|
:name => repo_param[:name],
|
213
213
|
:label => repo_param[:label],
|
214
|
+
:description => repo_param[:description],
|
214
215
|
:url => repo_param[:url],
|
215
216
|
:gpg_key => repo_param[:gpg_key],
|
216
217
|
:ssl_ca_cert => repo_param[:ssl_ca_cert],
|
@@ -83,14 +83,13 @@ module Katello
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def update_applicability_counts
|
86
|
-
self.
|
86
|
+
self.update_attributes!(
|
87
87
|
:installable_security_errata_count => self.installable_errata.security.count,
|
88
88
|
:installable_bugfix_errata_count => self.installable_errata.bugfix.count,
|
89
89
|
:installable_enhancement_errata_count => self.installable_errata.enhancement.count,
|
90
90
|
:applicable_rpm_count => self.content_facet_applicable_rpms.count,
|
91
91
|
:upgradable_rpm_count => self.installable_rpms.count
|
92
92
|
)
|
93
|
-
self.save!(:validate => false)
|
94
93
|
end
|
95
94
|
|
96
95
|
def import_rpm_applicability(partial)
|
@@ -221,6 +221,12 @@ module Katello
|
|
221
221
|
self.repositories.readable.where(:content_type => Katello::Repository::PUPPET_TYPE)
|
222
222
|
end
|
223
223
|
|
224
|
+
def update_container_repositories(registry_unauthenticated_pull)
|
225
|
+
self.repositories.readable.where(:content_type => Katello::Repository::DOCKER_TYPE).each do |repository|
|
226
|
+
repository.update_attributes!(registry_unauthenticated_pull: registry_unauthenticated_pull)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
224
230
|
def as_json(_options = {})
|
225
231
|
to_ret = self.attributes
|
226
232
|
to_ret['prior'] = self.prior && self.prior.name
|
@@ -12,6 +12,7 @@ module Katello
|
|
12
12
|
|
13
13
|
scope :displayable, -> {
|
14
14
|
joins(:content).where.not("#{content_table_name}.content_type IN (?)", Katello::Repository.undisplayable_types)
|
15
|
+
.order("LOWER(#{content_table_name}.name) ASC")
|
15
16
|
}
|
16
17
|
|
17
18
|
scope :redhat, -> {
|
@@ -31,10 +32,6 @@ module Katello
|
|
31
32
|
joins(:content).where("#{self.content_table_name}.cp_content_id" => Katello::Repository.in_organization(organization).select(:content_id))
|
32
33
|
end
|
33
34
|
|
34
|
-
def self.with_valid_subscription(organization)
|
35
|
-
where(:product_id => Katello::PoolProduct.where(:pool_id => organization.pools).select(:product_id))
|
36
|
-
end
|
37
|
-
|
38
35
|
# used by Katello::Api::V2::RepositorySetsController#index
|
39
36
|
def repositories
|
40
37
|
product.repositories.in_default_view.has_url.where(:content_id => content.cp_content_id)
|
@@ -175,6 +175,8 @@ module Katello
|
|
175
175
|
scoped_search :on => :distribution_uuid, :complete_value => true
|
176
176
|
scoped_search :on => :ignore_global_proxy, :complete_value => true
|
177
177
|
scoped_search :on => :redhat, :complete_value => { :true => true, :false => false }, :ext_method => :search_by_redhat
|
178
|
+
scoped_search :on => :container_repository_name, :complete_value => true
|
179
|
+
scoped_search :on => :description, :only_explicit => true
|
178
180
|
|
179
181
|
def organization
|
180
182
|
if self.environment
|
data/app/models/katello/rpm.rb
CHANGED
@@ -16,7 +16,7 @@ module Katello
|
|
16
16
|
scoped_search :on => :release, :complete_value => true, :ext_method => :scoped_search_release
|
17
17
|
scoped_search :on => :arch, :complete_value => true
|
18
18
|
scoped_search :on => :epoch, :complete_value => true
|
19
|
-
scoped_search :on => :evr, :ext_method => :scoped_search_evr
|
19
|
+
scoped_search :on => :evr, :ext_method => :scoped_search_evr
|
20
20
|
scoped_search :on => :filename, :complete_value => true
|
21
21
|
scoped_search :on => :sourcerpm, :complete_value => true
|
22
22
|
scoped_search :on => :checksum
|
@@ -222,28 +222,132 @@ module Katello
|
|
222
222
|
end
|
223
223
|
|
224
224
|
def self.installable_for_hosts(hosts = nil)
|
225
|
-
|
226
|
-
|
227
|
-
query = Katello::Rpm.joins(:content_facet_applicable_rpms).
|
225
|
+
query = Katello::Rpm.joins(:content_facet_applicable_rpms).joins(:repository_rpms).
|
228
226
|
joins("INNER JOIN #{Katello::ContentFacetRepository.table_name} on \
|
229
227
|
#{Katello::ContentFacetRepository.table_name}.content_facet_id = #{Katello::ContentFacetApplicableRpm.table_name}.content_facet_id").
|
230
228
|
joins("INNER JOIN #{Katello::RepositoryRpm.table_name} AS host_repo_rpm ON \
|
231
|
-
host_repo_rpm.rpm_id = #{Katello::Rpm.table_name}.id
|
232
|
-
|
229
|
+
host_repo_rpm.rpm_id = #{Katello::Rpm.table_name}.id").
|
230
|
+
where("#{Katello::ContentFacetRepository.table_name}.repository_id = host_repo_rpm.repository_id")
|
233
231
|
|
234
|
-
if hosts
|
235
|
-
|
236
|
-
.select("#{Katello::Host::ContentFacet.table_name}.id"))
|
237
|
-
else
|
238
|
-
query = query.joins(:content_facet_applicable_rpms)
|
239
|
-
end
|
240
|
-
|
241
|
-
query
|
232
|
+
query = query.joins(:content_facets).where("#{Katello::Host::ContentFacet.table_name}.host_id" => hosts.map(&:id)) if hosts
|
233
|
+
query.distinct
|
242
234
|
end
|
243
235
|
|
244
236
|
def self.applicable_to_hosts(hosts)
|
245
237
|
self.joins(:content_facets).
|
246
238
|
where("#{Katello::Host::ContentFacet.table_name}.host_id" => hosts).distinct
|
247
239
|
end
|
240
|
+
|
241
|
+
def self.latest(relation)
|
242
|
+
# There are several different ways to implement this:
|
243
|
+
|
244
|
+
# 1) Use a LEFT OUTER JOIN to join the query with itself on name=name,
|
245
|
+
# arch=arch, evr<evr, then select unmatched rows.
|
246
|
+
# In PostgreSQL 9.2 populated with real data, EXPLAIN shows
|
247
|
+
# cost=339901.07..381834.02 for the SQL generated by this when a
|
248
|
+
# package search is performed with a content_view_version_id filter.
|
249
|
+
# Unfortunately, this requires writing raw SQL for the JOIN and using
|
250
|
+
# to_sql, which may be somewhat brittle. For example, be aware of
|
251
|
+
# quirks like https://github.com/rails/rails/issues/18379
|
252
|
+
return relation.joins(
|
253
|
+
"LEFT OUTER JOIN (#{relation.to_sql}) AS katello_rpms2 ON " \
|
254
|
+
'katello_rpms.name = katello_rpms2.name AND katello_rpms.arch = katello_rpms2.arch AND ' \
|
255
|
+
'(CAST(katello_rpms.epoch AS INT) < CAST(katello_rpms2.epoch AS INT) OR ' \
|
256
|
+
' (CAST(katello_rpms.epoch AS INT) = CAST(katello_rpms2.epoch AS INT) AND ' \
|
257
|
+
' (katello_rpms.version_sortable COLLATE "C" < katello_rpms2.version_sortable COLLATE "C" OR ' \
|
258
|
+
' (katello_rpms.version_sortable = katello_rpms2.version_sortable AND ' \
|
259
|
+
' katello_rpms.release_sortable COLLATE "C" < katello_rpms2.release_sortable COLLATE "C"))))'
|
260
|
+
).where('katello_rpms2.release_sortable IS NULL')
|
261
|
+
|
262
|
+
# 2) Use GROUP BY with MAX() and several INNER JOINs to identify the
|
263
|
+
# latest evr, then INNER JOIN again to get complete rows.
|
264
|
+
# Like #1, this must also be written using raw SQL and to_sql.
|
265
|
+
# cost=677566.03..704889.89
|
266
|
+
#max_epochs = relation.
|
267
|
+
# group(:name, :arch).
|
268
|
+
# select(:name, :arch, 'MAX(CAST(katello_rpms.epoch AS INT)) AS max_epoch')
|
269
|
+
#max_versions = relation.
|
270
|
+
# joins(
|
271
|
+
# "INNER JOIN (#{max_epochs.to_sql}) katello_rpms2 ON " \
|
272
|
+
# 'katello_rpms.name = katello_rpms2.name AND katello_rpms.arch = katello_rpms2.arch AND ' \
|
273
|
+
# 'CAST(katello_rpms.epoch AS INT) = katello_rpms2.max_epoch'
|
274
|
+
# ).
|
275
|
+
# group(:name, :arch, :epoch).
|
276
|
+
# select(:name, :arch, :epoch, 'MAX(katello_rpms.version_sortable COLLATE "C") AS max_version')
|
277
|
+
#max_releases = relation.
|
278
|
+
# joins(
|
279
|
+
# "INNER JOIN (#{max_versions.to_sql}) katello_rpms2 ON " \
|
280
|
+
# 'katello_rpms.name = katello_rpms2.name AND katello_rpms.arch = katello_rpms2.arch AND ' \
|
281
|
+
# 'CAST(katello_rpms.epoch AS INT) = CAST(katello_rpms2.epoch AS INT) AND ' \
|
282
|
+
# 'katello_rpms.version_sortable = katello_rpms2.max_version'
|
283
|
+
# ).
|
284
|
+
# group(:name, :arch, :epoch, :version_sortable).
|
285
|
+
# select(:name, :arch, :epoch, :version_sortable, 'MAX(katello_rpms.release_sortable COLLATE "C") AS max_release')
|
286
|
+
#return relation.
|
287
|
+
# joins(
|
288
|
+
# "INNER JOIN (#{max_releases.to_sql}) katello_rpms2 ON " \
|
289
|
+
# 'katello_rpms.name = katello_rpms2.name AND katello_rpms.arch = katello_rpms2.arch AND ' \
|
290
|
+
# 'CAST(katello_rpms.epoch AS INT) = CAST(katello_rpms2.epoch AS INT) AND ' \
|
291
|
+
# 'katello_rpms.version_sortable = katello_rpms2.version_sortable AND ' \
|
292
|
+
# 'katello_rpms.release_sortable = katello_rpms2.max_release'
|
293
|
+
# )
|
294
|
+
|
295
|
+
# 3) Like #1, but use a Common Table Expression instead of a
|
296
|
+
# LEFT OUTER JOIN to join the query with itself.
|
297
|
+
# This seems to be faster than #1 in some cases and slower in others
|
298
|
+
# depending on optimizer behavior.
|
299
|
+
# For the same test case as used for #1, cost=404240.71..405796.40
|
300
|
+
# However, this is not supported in all versions of all databases
|
301
|
+
# (e.g. it only works in MySQL >=8.0).
|
302
|
+
# This can be written using either raw SQL or Arel.
|
303
|
+
#
|
304
|
+
# 3a) Raw SQL
|
305
|
+
#cte_sql = relation.select('katello_rpms.*, CAST(katello_rpms.epoch AS INT) AS epoch_sortable').to_sql
|
306
|
+
#return Rpm.where('katello_rpms.id IN (' \
|
307
|
+
# "WITH katello_rpms AS (#{cte_sql}) " \
|
308
|
+
# 'SELECT katello_rpms.id from katello_rpms LEFT OUTER JOIN katello_rpms AS katello_rpms2 ON ' \
|
309
|
+
# 'katello_rpms.name = katello_rpms2.name AND katello_rpms.arch = katello_rpms2.arch AND ' \
|
310
|
+
# '(katello_rpms.epoch_sortable < katello_rpms2.epoch_sortable OR ' \
|
311
|
+
# ' (katello_rpms.epoch_sortable = katello_rpms2.epoch_sortable AND ' \
|
312
|
+
# ' (katello_rpms.version_sortable COLLATE "C" < katello_rpms2.version_sortable COLLATE "C" OR ' \
|
313
|
+
# ' (katello_rpms.version_sortable = katello_rpms2.version_sortable AND ' \
|
314
|
+
# ' katello_rpms.release_sortable COLLATE "C" < katello_rpms2.release_sortable COLLATE "C")))) ' \
|
315
|
+
# 'WHERE katello_rpms2.release_sortable IS NULL' \
|
316
|
+
#')')
|
317
|
+
#
|
318
|
+
# 3b) Arel
|
319
|
+
# Unlike #1, #2, and #3a, this does not require raw SQL or to_sql.
|
320
|
+
# Unfortunately this doesn't work reliably in Rails 4.2 because
|
321
|
+
# relation.unscoped.where(relation.arel_table[:id].in(relation.arel))
|
322
|
+
# looses the prepared statement parameter values. See:
|
323
|
+
# https://github.com/rails/rails/issues/13686
|
324
|
+
## Convert current query to Arel for use in a CTE
|
325
|
+
#orig_query = relation.arel
|
326
|
+
## Add another column to the original query: CAST(epoch AS INT) AS epoch_sortable
|
327
|
+
#orig_table = relation.arel_table
|
328
|
+
#orig_query = orig_query.project(Arel::Nodes::NamedFunction.new('CAST', [orig_table[:epoch].as('INT')], 'epoch_sortable'))
|
329
|
+
## Create two names that will both refer to the existing query in the CTE
|
330
|
+
#cte1 = Arel::Table.new(:katello_rpms)
|
331
|
+
#cte2 = Arel::Table.new(:katello_rpms2)
|
332
|
+
## Create a new Arel query and use a CTE to JOIN the original query with
|
333
|
+
## itself and select the latest evr for each name/arch
|
334
|
+
#new_query = cte1.project(cte1[:id]).with(Arel::Nodes::As.new(cte1, orig_query)).
|
335
|
+
# join(Arel::Nodes::As.new(cte1, cte2), Arel::Nodes::OuterJoin).on(
|
336
|
+
# cte1[:name].eq(cte2[:name]).and(cte1[:arch].eq(cte2[:arch])).and(
|
337
|
+
# cte1[:epoch_sortable].lt(cte2[:epoch_sortable]).or(
|
338
|
+
# cte1[:epoch_sortable].eq(cte2[:epoch_sortable]).and(
|
339
|
+
# Arel::Nodes::SqlLiteral.new('katello_rpms.version_sortable COLLATE "C"').lt(Arel::Nodes::SqlLiteral.new('katello_rpms2.version_sortable COLLATE "C"')).or(
|
340
|
+
# cte1[:version_sortable].eq(cte2[:version_sortable]).and(
|
341
|
+
# Arel::Nodes::SqlLiteral.new('katello_rpms.release_sortable COLLATE "C"').lt(Arel::Nodes::SqlLiteral.new('katello_rpms2.release_sortable COLLATE "C"'))
|
342
|
+
# )
|
343
|
+
# )
|
344
|
+
# )
|
345
|
+
# )
|
346
|
+
# )
|
347
|
+
# ).
|
348
|
+
# where(cte2[:release_sortable].eq(nil))
|
349
|
+
## Wrap the new Arel query in a new ActiveRecord::Relation
|
350
|
+
#return relation.unscoped.where(orig_table[:id].in(new_query))
|
351
|
+
end
|
248
352
|
end
|
249
353
|
end
|
@@ -3,32 +3,29 @@ module Katello
|
|
3
3
|
module PuppetClassImporterExtensions
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
changed = self.changes
|
6
|
+
def update_environment
|
7
|
+
change_types = %w(new obsolete updated)
|
8
|
+
changed = self.changes
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
change_types.each do |kind|
|
11
|
+
changed[kind].slice!(@environment) unless changed[kind].empty?
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
14
|
+
#prevent the puppet environment from being deleted, by removing special '_destroy_' String
|
15
|
+
if changed['obsolete'][@environment]
|
16
|
+
changed['obsolete'][@environment] = changed['obsolete'][@environment].select { |klass| klass != '_destroy_' }
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
19
|
+
# PuppetClassImporter expects [kind][env] to be in json format
|
20
|
+
change_types.each do |kind|
|
21
|
+
unless (envs = changed[kind]).empty?
|
22
|
+
envs.keys.sort.each do |env|
|
23
|
+
changed[kind][env] = changed[kind][env].to_json
|
27
24
|
end
|
28
25
|
end
|
29
|
-
|
30
|
-
self.obsolete_and_new(changed)
|
31
26
|
end
|
27
|
+
|
28
|
+
self.obsolete_and_new(changed)
|
32
29
|
end
|
33
30
|
end
|
34
31
|
end
|
@@ -5,9 +5,7 @@ module Katello
|
|
5
5
|
class << self
|
6
6
|
def deliver!
|
7
7
|
SmartProxy.unscoped.with_content.each do |proxy|
|
8
|
-
|
9
|
-
next unless (percentage = status&.storage&.dig('pulp_dir', 'percent'))
|
10
|
-
|
8
|
+
percentage = proxy.statuses[:pulp].storage['pulp_dir']['percent']
|
11
9
|
if percentage[0..2].to_i < 90 && notification_already_exists?(proxy)
|
12
10
|
blueprint.notifications.where(subject: proxy).destroy_all
|
13
11
|
elsif update_notifications(proxy).empty? && percentage[0..2].to_i > 90
|
@@ -6,6 +6,7 @@ attributes :content_type, :url, :relative_path, :arch, :content_id
|
|
6
6
|
attributes :pulp_id => :backend_identifier
|
7
7
|
attributes :cp_label => :content_label
|
8
8
|
attributes :major, :minor
|
9
|
+
attributes :container_repository_name
|
9
10
|
|
10
11
|
child :product do |_product|
|
11
12
|
attributes :id, :cp_id, :name
|
@@ -6,7 +6,8 @@ extends 'katello/api/v2/common/timestamps'
|
|
6
6
|
attributes :content_type
|
7
7
|
attributes :docker_upstream_name
|
8
8
|
attributes :mirror_on_sync, :verify_ssl_on_sync
|
9
|
-
attributes :unprotected, :full_path, :checksum_type
|
9
|
+
attributes :unprotected, :full_path, :checksum_type
|
10
|
+
attributes :container_repository_name
|
10
11
|
attributes :download_policy
|
11
12
|
attributes :url,
|
12
13
|
:relative_path
|
@@ -25,6 +26,7 @@ attributes :ostree_upstream_sync_policy, :ostree_upstream_sync_depth, :compute_o
|
|
25
26
|
attributes :deb_releases, :deb_components, :deb_architectures
|
26
27
|
attributes :ignore_global_proxy
|
27
28
|
attributes :ignorable_content
|
29
|
+
attributes :description
|
28
30
|
|
29
31
|
if @resource.is_a?(Katello::Repository)
|
30
32
|
if @resource.distribution_version || @resource.distribution_arch || @resource.distribution_family || @resource.distribution_variant
|
@@ -71,5 +73,5 @@ if @object && @object.library_instance_id.nil?
|
|
71
73
|
end
|
72
74
|
|
73
75
|
child :environment => :environment do |_repo|
|
74
|
-
attribute :id
|
76
|
+
attribute :id, :registry_unauthenticated_pull
|
75
77
|
end
|
@@ -35,11 +35,12 @@ end %>
|
|
35
35
|
<% cs_select_name = using_hostgroups_page? ? 'hostgroup[content_source_id]' : 'host[content_facet_attributes][content_source_id]' %>
|
36
36
|
<% cs_select_attr = using_hostgroups_page? ? 'content_source' : 'content_facet.content_source' %>
|
37
37
|
|
38
|
+
<% proxies = accessible_content_proxies(@host || @hostgroup) %>
|
38
39
|
<%= field(f, cs_select_attr, {:label => _("Content Source")}) do
|
39
40
|
if using_hostgroups_page?
|
40
|
-
select_tag cs_select_id,
|
41
|
+
select_tag cs_select_id, options_from_collection_for_select(proxies, :id, :name, @hostgroup.content_source_id), :data => {"spinner_path" => spinner_path},
|
41
42
|
:class => 'form-control', :name => cs_select_name, include_blank: true
|
42
43
|
else
|
43
|
-
select_tag cs_select_id,
|
44
|
+
select_tag cs_select_id, options_from_collection_for_select(proxies, :id, :name, (@hostgroup || @host).content_source_id), :data => {"spinner_path" => spinner_path}, :class => 'form-control', :name => cs_select_name, include_blank: true
|
44
45
|
end
|
45
46
|
end %>
|
data/config/katello.yaml
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
:katello:
|
2
|
+
#if this block is not define, all types are enabled
|
3
|
+
#types are defined in lib/katello/repository_types/*.rb
|
4
|
+
:content_types:
|
5
|
+
:yum: true
|
6
|
+
:file: true
|
7
|
+
:deb: true
|
8
|
+
:puppet: true
|
9
|
+
:docker: true
|
10
|
+
:ostree: true
|
11
|
+
|
12
|
+
:use_cp: true # set to true/false if you want to override default
|
13
|
+
:use_pulp: true # set to true/false if you want to override default
|
14
|
+
|
15
|
+
:rest_client_timeout: 30
|
16
|
+
:gpg_strict_validation: false
|
17
|
+
|
18
|
+
:puppet_repo_root: '/etc/puppet/environments/'
|
19
|
+
|
20
|
+
:post_sync_url: "http://localhost:3000/katello/api/v2/repositories/sync_complete?token=katello"
|
21
|
+
|
22
|
+
:redhat_repository_url: https://cdn.redhat.com
|
23
|
+
|
24
|
+
:consumer_cert_rpm: 'katello-ca-consumer-latest.noarch.rpm'
|
25
|
+
:consumer_cert_sh: 'katello-rhsm-consumer'
|
26
|
+
|
27
|
+
# Setup your candlepin environment here
|
28
|
+
:candlepin:
|
29
|
+
# refers to the url of the candlepin
|
30
|
+
# example https://localhost:8443/candlepin
|
31
|
+
:url: https://192.168.42.116:31329/candlepin
|
32
|
+
|
33
|
+
# Specify your oauth key and secret used to authenticate between Katello and Candlepin
|
34
|
+
:oauth_key: katello
|
35
|
+
:oauth_secret: katello
|
36
|
+
|
37
|
+
# refers to the candlepin-ca.crt location that is needed
|
38
|
+
# to connect to candlepin over https.This is not necessary
|
39
|
+
# if the candlepin server is running on the same machine as katello
|
40
|
+
# but required if the server is on a different machine.
|
41
|
+
# In the different machine case the katello host needs to have a
|
42
|
+
# copy of /etc/candlepin/certs/candlepin-ca.crt copied from
|
43
|
+
# the candlepin host and the location of the copied file needs to be
|
44
|
+
# specified here..
|
45
|
+
:ca_cert_file:
|
46
|
+
# :bulk_load_size: 1000
|
47
|
+
# Setup your pulp environment here
|
48
|
+
:pulp:
|
49
|
+
# refers to the url of the pulp
|
50
|
+
# example https://localhost/pulp/api
|
51
|
+
:url: https://192.168.42.116:30133/pulp/api/v2/
|
52
|
+
|
53
|
+
:sync_threads: 4
|
54
|
+
:bulk_load_size: 100
|
55
|
+
# refers to the apache certificate
|
56
|
+
# (typically /etc/pki/tls/certs/localhost.crt) location that is needed
|
57
|
+
# to connect to pulp over https.
|
58
|
+
:ca_cert_file:
|
59
|
+
:default_login: admin
|
60
|
+
:sync_KBlimit:
|
61
|
+
:upload_chunk_size: 1048575 # upload size in bytes to pulp. see SSLRenegBufferSize in apache
|
62
|
+
:skip_checksum_validation: false
|
63
|
+
|
64
|
+
:qpid:
|
65
|
+
:url: amqp:ssl:katello-devel.example.com:5671
|
66
|
+
:subscriptions_queue_address: katello_event_queue
|
67
|
+
|
68
|
+
:cdn_proxy:
|
69
|
+
# :host: localhost
|
70
|
+
# :port: 3128
|
71
|
+
# :user: login
|
72
|
+
# :password: password
|
73
|
+
|
74
|
+
# Logging configuration can be changed by uncommenting the loggers
|
75
|
+
# section and the logger configuration desired.
|
76
|
+
#
|
77
|
+
# :loggers:
|
78
|
+
# :glue:
|
79
|
+
# :enabled: true
|
80
|
+
# :pulp_rest:
|
81
|
+
# :enabled: true
|
82
|
+
# :cp_rest:
|
83
|
+
# :enabled: true
|
84
|
+
# :cp_proxy:
|
85
|
+
# :enabled: true
|
86
|
+
# :action:
|
87
|
+
# :enabled: true
|
88
|
+
# :manifest_import_logger:
|
89
|
+
# :enabled: true
|