katello 3.14.1 → 3.15.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/rhsm/candlepin_proxies_controller.rb +1 -1
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +3 -3
- data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +2 -0
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +1 -0
- data/app/lib/actions/katello/host/reassign.rb +1 -2
- data/app/lib/actions/katello/host/update_content_view.rb +1 -1
- data/app/lib/actions/katello/host/update_release_version.rb +1 -1
- data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -1
- data/app/lib/actions/katello/product/update_http_proxy.rb +1 -1
- data/app/lib/actions/katello/repository/clone_contents.rb +1 -1
- data/app/lib/actions/katello/repository/clone_to_environment.rb +2 -1
- data/app/lib/actions/katello/repository/create.rb +1 -1
- data/app/lib/actions/katello/repository/metadata_generate.rb +2 -8
- data/app/lib/actions/katello/repository/refresh_repository.rb +5 -1
- data/app/lib/actions/katello/repository/sync.rb +6 -1
- data/app/lib/actions/middleware/execute_if_contents_changed.rb +1 -1
- data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +1 -1
- data/app/lib/actions/pulp/repository/clear.rb +1 -1
- data/app/lib/actions/pulp/repository/remove_units.rb +1 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +1 -2
- data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +1 -1
- data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +2 -2
- data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -1
- data/app/lib/actions/pulp3/content_migration.rb +17 -0
- data/app/lib/actions/pulp3/import_migration.rb +14 -0
- data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +4 -1
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +3 -3
- data/app/lib/actions/pulp3/orchestration/repository/create.rb +3 -1
- data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +0 -2
- data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/refresh_if_needed.rb +18 -0
- data/app/lib/actions/pulp3/orchestration/repository/refresh_repos.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/remove_units.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/sync.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/upload_content.rb +1 -1
- data/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_distributions.rb +16 -0
- data/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_remotes.rb +16 -0
- data/app/lib/actions/pulp3/orphan_cleanup/delete_orphan_repository_versions.rb +1 -6
- data/app/lib/actions/pulp3/orphan_cleanup/remove_orphans.rb +15 -0
- data/app/lib/actions/pulp3/orphan_cleanup/remove_unneeded_repos.rb +2 -2
- data/app/lib/actions/pulp3/repository/create.rb +1 -1
- data/app/lib/actions/pulp3/repository/create_publication.rb +1 -1
- data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -0
- data/app/lib/actions/pulp3/repository/refresh_distribution.rb +4 -2
- data/app/lib/actions/pulp3/repository/save_version.rb +12 -8
- data/app/lib/actions/pulp3/repository/upload_file.rb +2 -2
- data/app/lib/katello/api/v2/rendering.rb +1 -0
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +5 -1
- data/app/lib/katello/http_resource.rb +4 -1
- data/app/lib/katello/resources/registry.rb +9 -2
- data/app/models/katello/concerns/content_facet_host_extensions.rb +1 -0
- data/app/models/katello/concerns/organization_extensions.rb +4 -4
- data/app/models/katello/concerns/smart_proxy_extensions.rb +33 -7
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +34 -12
- data/app/models/katello/content_view_docker_filter.rb +1 -1
- data/app/models/katello/content_view_version.rb +20 -47
- data/app/models/katello/glue/candlepin/owner.rb +4 -0
- data/app/models/katello/glue/candlepin/product.rb +12 -6
- data/app/models/katello/glue/pulp/repos.rb +6 -3
- data/app/models/katello/host/subscription_facet.rb +4 -5
- data/app/models/katello/ping.rb +3 -4
- data/app/models/katello/pool.rb +1 -1
- data/app/models/katello/pulp3/distribution_reference.rb +1 -1
- data/app/models/katello/repository.rb +14 -0
- data/app/models/katello/root_repository.rb +0 -2
- data/app/models/katello/subscription_status.rb +7 -0
- data/app/models/setting/content.rb +10 -3
- data/app/services/katello/candlepin/consumer.rb +1 -0
- data/app/services/katello/pulp/repository.rb +1 -1
- data/app/services/katello/pulp/repository/deb.rb +2 -0
- data/app/services/katello/pulp/repository/docker.rb +2 -0
- data/app/services/katello/pulp/repository/file.rb +2 -0
- data/app/services/katello/pulp/repository/yum.rb +9 -5
- data/app/services/katello/pulp3/ansible_collection.rb +1 -1
- data/app/services/katello/pulp3/api/ansible_collection.rb +46 -0
- data/app/services/katello/pulp3/api/core.rb +159 -0
- data/app/services/katello/pulp3/api/docker.rb +62 -0
- data/app/services/katello/pulp3/api/file.rb +54 -0
- data/app/services/katello/pulp3/api/yum.rb +54 -0
- data/app/services/katello/pulp3/distribution.rb +17 -0
- data/app/services/katello/pulp3/docker_blob.rb +1 -1
- data/app/services/katello/pulp3/docker_manifest.rb +1 -1
- data/app/services/katello/pulp3/docker_manifest_list.rb +1 -1
- data/app/services/katello/pulp3/docker_tag.rb +1 -1
- data/app/services/katello/pulp3/erratum.rb +109 -0
- data/app/services/katello/pulp3/file_unit.rb +1 -1
- data/app/services/katello/pulp3/migration.rb +71 -0
- data/app/services/katello/pulp3/migration_plan.rb +27 -0
- data/app/services/katello/pulp3/module_stream.rb +47 -0
- data/app/services/katello/pulp3/package_group.rb +66 -0
- data/app/services/katello/pulp3/pulp_content_unit.rb +9 -1
- data/app/services/katello/pulp3/repository.rb +118 -348
- data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -29
- data/app/services/katello/pulp3/repository/docker.rb +23 -43
- data/app/services/katello/pulp3/repository/file.rb +1 -37
- data/app/services/katello/pulp3/repository/yum.rb +36 -37
- data/app/services/katello/pulp3/repository_mirror.rb +171 -0
- data/app/services/katello/pulp3/rpm.rb +143 -0
- data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +92 -0
- data/app/services/katello/pulp3/smart_proxy_repository.rb +38 -9
- data/app/services/katello/pulp3/srpm.rb +74 -0
- data/app/services/katello/pulp3/yum_metadata_file.rb +20 -0
- data/app/services/katello/registration_manager.rb +12 -11
- data/app/services/katello/repository_type.rb +11 -3
- data/app/services/katello/repository_type_manager.rb +11 -0
- data/app/views/dashboard/_subscription_widget.html.erb +6 -1
- data/app/views/katello/api/v2/content_view_versions/base.json.rabl +4 -11
- data/app/views/katello/api/v2/docker_manifest_lists/show.json.rabl +2 -1
- data/app/views/katello/api/v2/docker_manifests/show.json.rabl +2 -1
- data/app/views/katello/api/v2/package_groups/show.json.rabl +1 -1
- data/app/views/katello/api/v2/packages/show.json.rabl +2 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +2 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +2 -1
- data/app/views/katello/api/v2/smart_proxies/pulp_info.json.rabl +2 -0
- data/app/views/katello/api/v2/subscription_facet/show.json.rabl +1 -1
- data/app/views/smart_proxies/plugins/_pulp3.html.erb +19 -0
- data/app/views/smart_proxies/pulp_status.html.erb +10 -0
- data/db/migrate/20190930192813_add_pulp3_hrefs_to_content_types.rb +10 -0
- data/db/migrate/20191204020703_migrate_distribution_reference_to_use_repo_id.rb +22 -0
- data/db/migrate/20191204214919_add_content_view_version_counts.rb +7 -0
- data/db/migrate/20191213161248_add_dmi_uuid_to_katello_subscription_facets.rb +6 -0
- data/db/migrate/20200109162354_drop_host_update_lock_setting.rb +5 -0
- data/db/seeds.d/104-proxy.rb +1 -1
- data/db/seeds.d/111-upgrade_tasks.rb +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +3 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +8 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-available-content-views.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-content-views-list.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-http-proxy-modal.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +4 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
- data/lib/katello/engine.rb +25 -25
- data/lib/katello/plugin.rb +1 -1
- data/lib/katello/repository_types/ansible_collection.rb +1 -0
- data/lib/katello/repository_types/docker.rb +2 -1
- data/lib/katello/repository_types/file.rb +1 -1
- data/lib/katello/repository_types/yum.rb +29 -7
- data/lib/katello/tasks/pulp3_content_switchover.rake +21 -0
- data/lib/katello/tasks/pulp3_migration.rake +21 -0
- data/lib/katello/tasks/reset.rake +43 -16
- data/lib/katello/tasks/update_content_default_http_proxy.rake +3 -3
- data/lib/katello/tasks/upgrades/3.15/reindex_rpm_modular.rake +23 -0
- data/lib/katello/tasks/upgrades/3.15/set_sub_facet_dmi_uuid.rake +16 -0
- data/lib/katello/version.rb +1 -1
- data/package.json +9 -10
- data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +0 -63
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/redux/reducers/RedHatRepositories/repositorySetRepositories.js +17 -2
- data/webpack/scenes/RedHatRepositories/components/RepositorySet.js +1 -0
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +2 -3
- data/webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js +44 -28
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RepositorySetRepositories.test.js.snap +77 -45
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +2 -6
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionTypeFormatter.test.js.snap +0 -1
- data/webpack/test_setup.js +3 -1
- metadata +62 -24
- data/app/lib/actions/katello/host/update.rb +0 -84
- data/app/lib/actions/pulp3/repository/create_version.rb +0 -19
- data/app/views/katello/api/v2/smart_proxies/download_policy.json.rabl +0 -1
@@ -62,6 +62,7 @@ module Katello
|
|
62
62
|
|
63
63
|
scoped_search :on => :content_view_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
|
64
64
|
scoped_search :on => :major, :rename => :version, :complete_value => true, :ext_method => :find_by_version
|
65
|
+
serialize :content_counts
|
65
66
|
|
66
67
|
def self.find_by_version(_key, operator, value)
|
67
68
|
conditions = ""
|
@@ -160,7 +161,7 @@ module Katello
|
|
160
161
|
end
|
161
162
|
|
162
163
|
def promote_puppet_environment?
|
163
|
-
|
164
|
+
(!content_counts.blank? && content_counts.dig(PuppetModule::CONTENT_TYPE) > 0) || self.content_view.force_puppet_environment?
|
164
165
|
end
|
165
166
|
|
166
167
|
def archived_repos
|
@@ -257,50 +258,10 @@ module Katello
|
|
257
258
|
Katello::Srpm.in_repositories(self.repositories)
|
258
259
|
end
|
259
260
|
|
260
|
-
def srpm_count
|
261
|
-
Katello::Srpm.in_repositories(self.repositories.archived).count
|
262
|
-
end
|
263
|
-
|
264
|
-
def puppet_module_count
|
265
|
-
puppet_modules.count
|
266
|
-
end
|
267
|
-
|
268
|
-
def package_count
|
269
|
-
Katello::Rpm.in_repositories(self.repositories.archived).count
|
270
|
-
end
|
271
|
-
|
272
261
|
def module_streams
|
273
262
|
ModuleStream.in_repositories(archived_repos)
|
274
263
|
end
|
275
264
|
|
276
|
-
def module_stream_count
|
277
|
-
Katello::ModuleStream.in_repositories(self.repositories.archived).count
|
278
|
-
end
|
279
|
-
|
280
|
-
def file_count
|
281
|
-
Katello::FileUnit.in_repositories(self.repositories.archived).count
|
282
|
-
end
|
283
|
-
|
284
|
-
def ostree_branch_count
|
285
|
-
ostree_branches.count
|
286
|
-
end
|
287
|
-
|
288
|
-
def docker_manifest_list_count
|
289
|
-
repositories.archived.docker_type.inject(0) do |sum, repo|
|
290
|
-
sum + repo.docker_manifest_lists.count
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
def docker_manifest_count
|
295
|
-
repositories.archived.docker_type.inject(0) do |sum, repo|
|
296
|
-
sum + repo.docker_manifests.count
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
def docker_tag_count
|
301
|
-
docker_tags.count
|
302
|
-
end
|
303
|
-
|
304
265
|
def docker_tags
|
305
266
|
# Don't count tags from non-archived repos; this causes count errors
|
306
267
|
::Katello::DockerMetaTag.where(:id => RepositoryDockerMetaTag.where(:repository_id => repositories.archived.docker_type).select(:docker_meta_tag_id))
|
@@ -310,10 +271,6 @@ module Katello
|
|
310
271
|
Katello::Deb.in_repositories(self.repositories.archived)
|
311
272
|
end
|
312
273
|
|
313
|
-
def deb_count
|
314
|
-
debs.count
|
315
|
-
end
|
316
|
-
|
317
274
|
def errata(errata_type = nil)
|
318
275
|
errata = Erratum.in_repositories(archived_repos)
|
319
276
|
errata = errata.of_type(errata_type) if errata_type
|
@@ -348,8 +305,24 @@ module Katello
|
|
348
305
|
PackageGroup.in_repositories(archived_repos)
|
349
306
|
end
|
350
307
|
|
351
|
-
def
|
352
|
-
|
308
|
+
def update_content_counts!
|
309
|
+
self.content_counts = {}
|
310
|
+
RepositoryTypeManager.indexable_content_types.map(&:model_class).each do |content_type|
|
311
|
+
if content_type::CONTENT_TYPE == DockerTag::CONTENT_TYPE
|
312
|
+
content_counts[DockerTag::CONTENT_TYPE] = docker_tags.count
|
313
|
+
else
|
314
|
+
content_counts[content_type::CONTENT_TYPE] = content_type.in_repositories(self.repositories.archived).count
|
315
|
+
end
|
316
|
+
end
|
317
|
+
save!
|
318
|
+
end
|
319
|
+
|
320
|
+
def content_counts_map
|
321
|
+
return {} if content_counts.blank?
|
322
|
+
counts = Hash[content_counts.map { |key, value| ["#{key}_count", value] }]
|
323
|
+
counts.merge("module_stream_count" => counts["modulemd_count"],
|
324
|
+
"package_count" => counts["rpm_count"],
|
325
|
+
"ostree_branch_count" => counts["ostree_count"])
|
353
326
|
end
|
354
327
|
|
355
328
|
def check_ready_to_promote!(to_env)
|
@@ -101,13 +101,19 @@ module Katello
|
|
101
101
|
|
102
102
|
def import_custom_subscription
|
103
103
|
fail _("Cannot import a custom subscription from a redhat product.") if self.redhat?
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
User.as_anonymous_admin do
|
105
|
+
sub = nil
|
106
|
+
::Katello::Util::Support.active_record_retry do
|
107
|
+
sub = ::Katello::Subscription.where(:cp_id => self.cp_id, :organization_id => self.organization.id).first_or_create
|
108
|
+
end
|
109
|
+
unless sub.persisted?
|
110
|
+
message = _("Subscription was not persisted - %{error_message}") % {:error_message => sub.errors.full_messages.join("; ")}
|
111
|
+
fail HttpErrors::UnprocessableEntity, message
|
112
|
+
end
|
113
|
+
sub.import_data
|
114
|
+
pools = ::Katello::Resources::Candlepin::Product.pools(self.organization.label, self.cp_id)
|
115
|
+
pools.each { |pool_json| ::Katello::Pool.import_pool(pool_json['id']) }
|
107
116
|
end
|
108
|
-
sub.import_data
|
109
|
-
pools = ::Katello::Resources::Candlepin::Product.pools(self.organization.label, self.cp_id)
|
110
|
-
pools.each { |pool_json| ::Katello::Pool.import_pool(pool_json['id']) }
|
111
117
|
end
|
112
118
|
end
|
113
119
|
end
|
@@ -76,9 +76,12 @@ module Katello
|
|
76
76
|
summary
|
77
77
|
end
|
78
78
|
|
79
|
+
def last_sync_audit
|
80
|
+
Audited::Audit.where(:auditable_id => self.repositories, :auditable_type => Katello::Repository.name).order(:created_at).last
|
81
|
+
end
|
82
|
+
|
79
83
|
def last_sync
|
80
|
-
|
81
|
-
task.nil? ? nil : task.started_at.to_s
|
84
|
+
last_repo_sync_task&.started_at&.to_s || last_sync_audit&.created_at&.to_s
|
82
85
|
end
|
83
86
|
|
84
87
|
def last_repo_sync_task
|
@@ -97,7 +100,7 @@ module Katello
|
|
97
100
|
def last_repo_sync_task_group
|
98
101
|
if last_repo_sync_task
|
99
102
|
started_after = last_repo_sync_task.started_at - 30.seconds
|
100
|
-
last_repo_sync_tasks.where("#{ForemanTasks::Task::DynflowTask.table_name}.started_at > '%s'", started_after).uniq
|
103
|
+
last_repo_sync_tasks.where("#{ForemanTasks::Task::DynflowTask.table_name}.started_at > '%s'", started_after.utc).uniq
|
101
104
|
else
|
102
105
|
[]
|
103
106
|
end
|
@@ -41,11 +41,6 @@ module Katello
|
|
41
41
|
host_facts["virt::host_type"] || host_facts["hypervisor::type"]
|
42
42
|
end
|
43
43
|
|
44
|
-
def dmi_system_uuid
|
45
|
-
host_facts = self.host.facts
|
46
|
-
host_facts["dmi::system::uuid"]
|
47
|
-
end
|
48
|
-
|
49
44
|
def update_from_consumer_attributes(consumer_params)
|
50
45
|
import_database_attributes(consumer_params)
|
51
46
|
self.facts = consumer_params['facts'] unless consumer_params['facts'].blank?
|
@@ -56,6 +51,10 @@ module Katello
|
|
56
51
|
update_hypervisor(consumer_params)
|
57
52
|
update_guests(consumer_params)
|
58
53
|
|
54
|
+
if consumer_params['facts']
|
55
|
+
self.dmi_uuid = consumer_params['facts']['dmi.system.uuid']
|
56
|
+
end
|
57
|
+
|
59
58
|
self.autoheal = consumer_params['autoheal'] unless consumer_params['autoheal'].blank?
|
60
59
|
self.service_level = consumer_params['serviceLevel'] unless consumer_params['serviceLevel'].nil?
|
61
60
|
self.registered_at = consumer_params['created'] unless consumer_params['created'].blank?
|
data/app/models/katello/ping.rb
CHANGED
@@ -71,7 +71,7 @@ module Katello
|
|
71
71
|
|
72
72
|
def ping_pulp3_without_auth(service_result, capsule_id)
|
73
73
|
exception_watch(service_result) do
|
74
|
-
Katello::Ping.pulp3_without_auth(fetch_proxy(capsule_id).pulp3_url
|
74
|
+
Katello::Ping.pulp3_without_auth(fetch_proxy(capsule_id).pulp3_url)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -193,10 +193,9 @@ module Katello
|
|
193
193
|
end
|
194
194
|
|
195
195
|
workers = json["online_workers"] || []
|
196
|
-
resource_manager_exists = workers.any? { |worker| worker["name"].include?("resource-manager
|
197
|
-
reservered_resource_worker_exists = workers.any? { |worker| worker["name"] =~ /reserved-resource-worker-./ }
|
196
|
+
resource_manager_exists = workers.any? { |worker| worker["name"].include?("resource-manager") }
|
198
197
|
|
199
|
-
unless resource_manager_exists &&
|
198
|
+
unless resource_manager_exists && workers.count > 1
|
200
199
|
fail _("Not all necessary pulp workers running at %s.") % url
|
201
200
|
end
|
202
201
|
|
data/app/models/katello/pool.rb
CHANGED
@@ -101,7 +101,7 @@ module Katello
|
|
101
101
|
end
|
102
102
|
|
103
103
|
class Jail < ::Safemode::Jail
|
104
|
-
allow :id, :name, :available, :quantity, :product_id, :contract_number, :type, :account_number, :start_date, :end_date
|
104
|
+
allow :id, :name, :available, :quantity, :product_id, :contract_number, :type, :account_number, :start_date, :end_date, :organization
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Katello
|
2
2
|
# rubocop:disable Metrics/ClassLength
|
3
3
|
class Repository < Katello::Model
|
4
|
+
audited
|
5
|
+
|
4
6
|
#pulp uses pulp id to sync with 'yum_distributor' on the end
|
5
7
|
PULP_ID_MAX_LENGTH = 220
|
6
8
|
|
@@ -19,6 +21,8 @@ module Katello
|
|
19
21
|
include ERB::Util
|
20
22
|
include ::ScopedSearchExtensions
|
21
23
|
|
24
|
+
AUDIT_SYNC_ACTION = 'sync'.freeze
|
25
|
+
|
22
26
|
DEB_TYPE = 'deb'.freeze
|
23
27
|
YUM_TYPE = 'yum'.freeze
|
24
28
|
FILE_TYPE = 'file'.freeze
|
@@ -99,6 +103,8 @@ module Katello
|
|
99
103
|
has_many :filters, :through => :repository_content_view_filters
|
100
104
|
|
101
105
|
belongs_to :content_view_version, :inverse_of => :repositories, :class_name => "Katello::ContentViewVersion"
|
106
|
+
has_many :distribution_references, :class_name => 'Katello::Pulp3::DistributionReference', :foreign_key => :repository_id,
|
107
|
+
:dependent => :destroy, :inverse_of => :repository
|
102
108
|
|
103
109
|
validates_with Validators::ContainerImageNameValidator, :attributes => :container_repository_name, :allow_blank => false, :if => :docker?
|
104
110
|
validates :container_repository_name, :if => :docker?, :uniqueness => {message: ->(object, _data) do
|
@@ -189,6 +195,10 @@ module Katello
|
|
189
195
|
end
|
190
196
|
end
|
191
197
|
|
198
|
+
def audit_sync
|
199
|
+
write_audit(action: AUDIT_SYNC_ACTION, comment: _('Successfully synchronized.'), audited_changes: {})
|
200
|
+
end
|
201
|
+
|
192
202
|
def set_pulp_id
|
193
203
|
return if self.pulp_id
|
194
204
|
|
@@ -460,6 +470,10 @@ module Katello
|
|
460
470
|
clone
|
461
471
|
end
|
462
472
|
|
473
|
+
def latest_sync_audit
|
474
|
+
self.audits.where(:action => AUDIT_SYNC_ACTION).order(:created_at).last
|
475
|
+
end
|
476
|
+
|
463
477
|
def cancel_dynflow_sync
|
464
478
|
if latest_dynflow_sync
|
465
479
|
plan = latest_dynflow_sync.execution_plan
|
@@ -42,8 +42,6 @@ module Katello
|
|
42
42
|
|
43
43
|
has_many :repository_references, :class_name => 'Katello::Pulp3::RepositoryReference', :foreign_key => :root_repository_id,
|
44
44
|
:dependent => :destroy, :inverse_of => :root_repository
|
45
|
-
has_many :distribution_references, :class_name => 'Katello::Pulp3::DistributionReference', :foreign_key => :root_repository_id,
|
46
|
-
:dependent => :destroy, :inverse_of => :root_repository
|
47
45
|
|
48
46
|
before_validation :update_ostree_upstream_sync_policy
|
49
47
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Katello
|
2
2
|
class SubscriptionStatus < HostStatus::Status
|
3
|
+
DISABLED = 5
|
3
4
|
UNSUBSCRIBED_HYPERVISOR = 4
|
4
5
|
UNKNOWN = 3
|
5
6
|
INVALID = 2
|
@@ -20,6 +21,8 @@ module Katello
|
|
20
21
|
N_("Unentitled")
|
21
22
|
when UNSUBSCRIBED_HYPERVISOR
|
22
23
|
N_("Unsubscribed hypervisor")
|
24
|
+
when DISABLED
|
25
|
+
N_("Disabled")
|
23
26
|
else
|
24
27
|
N_("Unknown subscription status")
|
25
28
|
end
|
@@ -29,6 +32,8 @@ module Katello
|
|
29
32
|
case status
|
30
33
|
when INVALID
|
31
34
|
::HostStatus::Global::ERROR
|
35
|
+
when DISABLED
|
36
|
+
::HostStatus::Global::OK
|
32
37
|
when VALID
|
33
38
|
::HostStatus::Global::OK
|
34
39
|
else
|
@@ -43,6 +48,8 @@ module Katello
|
|
43
48
|
status = status_override || Katello::Candlepin::Consumer.new(host.subscription_facet.uuid, host.organization.label).entitlement_status
|
44
49
|
|
45
50
|
case status
|
51
|
+
when Katello::Candlepin::Consumer::ENTITLEMENTS_DISABLED
|
52
|
+
DISABLED
|
46
53
|
when Katello::Candlepin::Consumer::ENTITLEMENTS_VALID
|
47
54
|
VALID
|
48
55
|
when Katello::Candlepin::Consumer::ENTITLEMENTS_PARTIAL
|
@@ -2,6 +2,8 @@ class Setting::Content < Setting
|
|
2
2
|
#rubocop:disable Metrics/MethodLength
|
3
3
|
#rubocop:disable Metrics/AbcSize
|
4
4
|
|
5
|
+
validate :content_default_http_proxy, if: proc { |s| s.name == 'content_default_http_proxy' }
|
6
|
+
|
5
7
|
after_save :add_organizations_and_locations_if_global_http_proxy
|
6
8
|
|
7
9
|
def self.hashify_parameters(parameters)
|
@@ -22,7 +24,7 @@ class Setting::Content < Setting
|
|
22
24
|
|
23
25
|
[
|
24
26
|
self.set('content_default_http_proxy', N_("Default HTTP Proxy for syncing content"),
|
25
|
-
nil, N_('Default
|
27
|
+
nil, N_('Default HTTP proxy'),
|
26
28
|
nil,
|
27
29
|
collection: proc { http_proxy_select }, include_blank: N_("no global default")
|
28
30
|
),
|
@@ -114,8 +116,6 @@ class Setting::Content < Setting
|
|
114
116
|
N_('Default Location where new Puppet content will be put upon Content View publish'),
|
115
117
|
nil, N_('Default Location Puppet content'), nil,
|
116
118
|
:collection => proc { Hash[Location.unscoped.all.map { |loc| [loc[:title], loc[:title]] }] }),
|
117
|
-
self.set('host_update_lock', N_("Allow multiple concurrent Actions::Katello::Host::Update calls for one host to be processed at the same time."),
|
118
|
-
false, N_('Concurrent Actions::Katello::Host::Update allowed')),
|
119
119
|
self.set('expire_soon_days', N_('The number of days remaining in a subscription before you will be reminded about renewing it.'),
|
120
120
|
120, N_('Expire soon days')),
|
121
121
|
self.set('content_view_solve_dependencies',
|
@@ -160,6 +160,13 @@ class Setting::Content < Setting
|
|
160
160
|
end
|
161
161
|
end
|
162
162
|
end
|
163
|
+
|
164
|
+
def content_default_http_proxy
|
165
|
+
proxy = HttpProxy.where(name: value).first
|
166
|
+
return if proxy || value.blank?
|
167
|
+
|
168
|
+
errors.add(:base, _('There is no such HTTP proxy'))
|
169
|
+
end
|
163
170
|
end
|
164
171
|
|
165
172
|
# If the database is not migrated yet, the system will not be able to load
|
@@ -2,6 +2,8 @@ module Katello
|
|
2
2
|
module Pulp
|
3
3
|
class Repository
|
4
4
|
class Yum < ::Katello::Pulp::Repository
|
5
|
+
REPOSITORY_TYPE = 'yum'.freeze
|
6
|
+
|
5
7
|
def generate_master_importer
|
6
8
|
config = {
|
7
9
|
download_policy: root.download_policy,
|
@@ -51,11 +53,13 @@ module Katello
|
|
51
53
|
distributors
|
52
54
|
end
|
53
55
|
|
54
|
-
def distributors_to_publish(
|
55
|
-
|
56
|
-
|
56
|
+
def distributors_to_publish(options)
|
57
|
+
source_repo_id = options[:source_repository]&.fetch(:id)
|
58
|
+
if (source_repo_id || !repo.master?) && smart_proxy.pulp_master?
|
59
|
+
source_repository = source_repo_id ? ::Katello::Repository.find(source_repo_id) : repo.target_repository
|
60
|
+
source_service = source_repository.backend_service(smart_proxy)
|
57
61
|
source_distributor_id = source_service.lookup_distributor_id(Runcible::Models::YumDistributor.type_id)
|
58
|
-
{Runcible::Models::YumCloneDistributor => {source_repo_id:
|
62
|
+
{Runcible::Models::YumCloneDistributor => {source_repo_id: source_repository.pulp_id,
|
59
63
|
source_distributor_id: source_distributor_id}}
|
60
64
|
else
|
61
65
|
{Runcible::Models::YumDistributor => {}}
|
@@ -171,7 +175,7 @@ module Katello
|
|
171
175
|
task = nil
|
172
176
|
repo.remove_partial_errata! do |errata_to_delete|
|
173
177
|
task = repo.unassociate_by_filter(::Katello::ContentViewErratumFilter::CONTENT_TYPE,
|
174
|
-
"id" => { "$in" => errata_to_delete.map(&:errata_id) })
|
178
|
+
"id" => { "$in" => errata_to_delete.map(&:errata_id).sort })
|
175
179
|
end
|
176
180
|
task
|
177
181
|
end
|
@@ -4,7 +4,7 @@ module Katello
|
|
4
4
|
include LazyAccessor
|
5
5
|
|
6
6
|
def self.content_api
|
7
|
-
PulpAnsibleClient::ContentCollectionVersionsApi.new(Katello::Pulp3::
|
7
|
+
PulpAnsibleClient::ContentCollectionVersionsApi.new(Katello::Pulp3::Api::AnsibleCollection.new(SmartProxy.pulp_master!).api_client)
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.ids_for_repository(repo_id)
|