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
@@ -0,0 +1,143 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class Rpm < PulpContentUnit
|
4
|
+
include LazyAccessor
|
5
|
+
CONTENT_TYPE = "rpm".freeze
|
6
|
+
|
7
|
+
PULP_INDEXED_FIELDS = %w(pulp_href name version release arch epoch summary is_modular rpm_sourcerpm location_href pkgId).freeze
|
8
|
+
|
9
|
+
lazy_accessor :description, :license, :buildhost, :vendor, :relativepath, :children, :checksumtype,
|
10
|
+
:changelog, :group, :size, :url, :build_time, :group,
|
11
|
+
:initializer => :backend_data
|
12
|
+
|
13
|
+
def self.content_api
|
14
|
+
PulpRpmClient::ContentPackagesApi.new(Katello::Pulp3::Api::Yum.new(SmartProxy.pulp_master!).api_client)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.ids_for_repository(repo_id)
|
18
|
+
repo = Katello::Pulp3::Repository::Yum.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
|
19
|
+
repo_content_list = repo.content_list
|
20
|
+
repo_content_list.map { |content| content.try(:pulp_href) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.rpm_architectures
|
24
|
+
['i386', 'i486', 'i586', 'i686', 'athlon', 'geode', 'pentium3', 'pentium4',
|
25
|
+
'x86_64', 'amd64',
|
26
|
+
'ia64',
|
27
|
+
'alpha', 'alphaev5', 'alphaev56', 'alphapca56', 'alphaev6', 'alphaev67',
|
28
|
+
'sparc', 'sparcv8', 'sparcv9', 'sparc64', 'sparc64v', 'sun4', 'sun4c', 'sun4d', 'sun4m', 'sun4u',
|
29
|
+
'armv3l', 'armv4b', 'armv4l', 'armv5tel', 'armv5tejl', 'armv6l', 'armv7l',
|
30
|
+
'mips', 'mipsel',
|
31
|
+
'ppc', 'ppciseries', 'ppcpseries', 'ppc64', 'ppc8260', 'ppc8560', 'ppc32dy4',
|
32
|
+
'm68k', 'm68kmint', 'atarist', 'atariste', 'ataritt', 'falcon', 'atariclone', 'milan', 'hades',
|
33
|
+
'Sgi',
|
34
|
+
'rs6000',
|
35
|
+
'i370', 's390x', 's390',
|
36
|
+
'noarch']
|
37
|
+
end
|
38
|
+
|
39
|
+
def requires
|
40
|
+
results = []
|
41
|
+
flags = {'GT' => '>', 'LT' => '>', 'EQ' => '=', 'GE' => '>=', 'LE' => '<='}
|
42
|
+
if backend_data['requires']
|
43
|
+
backend_data['requires'].each do |requirement|
|
44
|
+
requires_str = ""
|
45
|
+
if requirement.count < 3
|
46
|
+
requires_str = requirement.first
|
47
|
+
results << requires_str
|
48
|
+
else
|
49
|
+
requirement[1] = flags[requirement[1]]
|
50
|
+
requirement[0...2].each { |requirement_piece| requires_str += "#{requirement_piece} " }
|
51
|
+
requirement[2...-1].each { |requirement_piece| requires_str += "#{requirement_piece}." }
|
52
|
+
results << requires_str[0...-1]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
results.uniq
|
57
|
+
end
|
58
|
+
|
59
|
+
def provides
|
60
|
+
results = []
|
61
|
+
flags = {'GT' => '>', 'LT' => '>', 'EQ' => '=', 'GE' => '>=', 'LE' => '<='}
|
62
|
+
if backend_data['provides']
|
63
|
+
backend_data['provides'].each do |provided|
|
64
|
+
provides_str = ""
|
65
|
+
if provided.count < 3
|
66
|
+
provides_str = provided.first
|
67
|
+
results << provides_str
|
68
|
+
else
|
69
|
+
provided[1] = flags[provided[1]]
|
70
|
+
provided[0...2].each { |provided_piece| provides_str += "#{provided_piece} " }
|
71
|
+
provided[2...-1].each { |provided_piece| provides_str += "#{provided_piece}." }
|
72
|
+
results << provides_str[0...-1]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
results.uniq
|
77
|
+
end
|
78
|
+
|
79
|
+
def files
|
80
|
+
files = backend_data['files'].collect do |file_and_path|
|
81
|
+
# First item in the array might be a directive like "dir" or "ghost"
|
82
|
+
if file_and_path[0][0] != '/'
|
83
|
+
file_and_path.shift
|
84
|
+
end
|
85
|
+
file_and_path.join('')
|
86
|
+
end
|
87
|
+
|
88
|
+
files.uniq
|
89
|
+
end
|
90
|
+
|
91
|
+
def buildhost
|
92
|
+
backend_data['rpm_buildhost']
|
93
|
+
end
|
94
|
+
|
95
|
+
def vendor
|
96
|
+
backend_data['rpm_vendor']
|
97
|
+
end
|
98
|
+
|
99
|
+
def relativepath
|
100
|
+
backend_data['location_href']
|
101
|
+
end
|
102
|
+
|
103
|
+
def checksumtype
|
104
|
+
backend_data['checksum_type']
|
105
|
+
end
|
106
|
+
|
107
|
+
def changelog
|
108
|
+
backend_data['changelogs']
|
109
|
+
end
|
110
|
+
|
111
|
+
def group
|
112
|
+
backend_data['rpm_group']
|
113
|
+
end
|
114
|
+
|
115
|
+
def build_time
|
116
|
+
backend_data['time_build']
|
117
|
+
end
|
118
|
+
|
119
|
+
def size
|
120
|
+
backend_data['size_package']
|
121
|
+
end
|
122
|
+
|
123
|
+
def license
|
124
|
+
backend_data['rpm_license']
|
125
|
+
end
|
126
|
+
|
127
|
+
def update_model(model)
|
128
|
+
custom_json = {}
|
129
|
+
custom_json['modular'] = backend_data['is_modular']
|
130
|
+
custom_json['pulp_id'] = backend_data['pulp_href']
|
131
|
+
(PULP_INDEXED_FIELDS - ['is_modular', 'pulp_href', 'rpm_sourcerpm', 'pkgId', 'location_href']).
|
132
|
+
each { |field| custom_json[field] = backend_data[field] }
|
133
|
+
custom_json['release_sortable'] = Util::Package.sortable_version(backend_data['release'])
|
134
|
+
custom_json['version_sortable'] = Util::Package.sortable_version(backend_data['version'])
|
135
|
+
custom_json['nvra'] = model.build_nvra
|
136
|
+
custom_json['filename'] = backend_data['location_href']
|
137
|
+
custom_json['checksum'] = backend_data['pkgId']
|
138
|
+
custom_json['sourcerpm'] = backend_data['rpm_sourcerpm']
|
139
|
+
model.update_attributes!(custom_json)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class SmartProxyMirrorRepository < SmartProxyRepository
|
4
|
+
def initialize(smart_proxy)
|
5
|
+
fail "Cannot use a central pulp smart proxy" if smart_proxy.pulp_master?
|
6
|
+
@smart_proxy = smart_proxy
|
7
|
+
end
|
8
|
+
|
9
|
+
def orphaned_repositories
|
10
|
+
repo_map = {}
|
11
|
+
|
12
|
+
smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
|
13
|
+
katello_pulp_ids = smart_proxy_helper.repos_available_to_capsule.map(&:pulp_id)
|
14
|
+
pulp3_enabled_repo_types.each do |repo_type|
|
15
|
+
api = repo_type.pulp3_service_class.api(smart_proxy)
|
16
|
+
repo_map[api] = api.list_all.reject { |capsule_repo| katello_pulp_ids.include? capsule_repo.name }
|
17
|
+
end
|
18
|
+
|
19
|
+
repo_map
|
20
|
+
end
|
21
|
+
|
22
|
+
def orphan_repository_versions
|
23
|
+
repo_version_map = {}
|
24
|
+
|
25
|
+
pulp3_enabled_repo_types.each do |repo_type|
|
26
|
+
api = repo_type.pulp3_service_class.api(smart_proxy)
|
27
|
+
version_hrefs = api.repository_versions
|
28
|
+
orphan_version_hrefs = api.list_all.collect do |pulp_repo|
|
29
|
+
mirror_repo_versions = api.versions_list_for_repository(pulp_repo.pulp_href, ordering: :_created)
|
30
|
+
version_hrefs = mirror_repo_versions.collect { |version| version.pulp_href }
|
31
|
+
|
32
|
+
version_hrefs - [pulp_repo.latest_version_href]
|
33
|
+
end
|
34
|
+
repo_version_map[api] = orphan_version_hrefs.flatten
|
35
|
+
end
|
36
|
+
|
37
|
+
repo_version_map
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete_orphan_repositories
|
41
|
+
tasks = []
|
42
|
+
|
43
|
+
orphaned_repositories.each do |api, pulp3_repo_list|
|
44
|
+
tasks << pulp3_repo_list.collect do |repo|
|
45
|
+
api.repositories_api.delete(repo.pulp_href)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
tasks.flatten!
|
50
|
+
end
|
51
|
+
|
52
|
+
def delete_orphan_distributions
|
53
|
+
tasks = []
|
54
|
+
pulp3_enabled_repo_types.each do |repo_type|
|
55
|
+
pulp3_class = repo_type.pulp3_service_class
|
56
|
+
orphan_distributions(pulp3_class).each do |distribution|
|
57
|
+
tasks << pulp3_class.api(smart_proxy).delete_distribution(distribution.pulp_href)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
tasks
|
61
|
+
end
|
62
|
+
|
63
|
+
def orphan_distributions(pulp3_service_class)
|
64
|
+
api = pulp3_service_class.api(smart_proxy)
|
65
|
+
api.distributions_list_all.select do |distribution|
|
66
|
+
dist = api.get_distribution(distribution.pulp_href)
|
67
|
+
self.class.orphan_distribution?(dist)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.orphan_distribution?(distribution)
|
72
|
+
distribution.try(:publication).nil? &&
|
73
|
+
distribution.try(:repository).nil? &&
|
74
|
+
distribution.try(:repository_version).nil?
|
75
|
+
end
|
76
|
+
|
77
|
+
def delete_orphan_remotes
|
78
|
+
tasks = []
|
79
|
+
repo_names = Katello::Repository.pluck(:pulp_id)
|
80
|
+
pulp3_enabled_repo_types.each do |repo_type|
|
81
|
+
api = repo_type.pulp3_service_class.api(smart_proxy)
|
82
|
+
remotes = api.remotes_list
|
83
|
+
|
84
|
+
remotes.each do |remote|
|
85
|
+
tasks << api.delete_remote(remote.pulp_href) unless repo_names.include?(remote.name)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
tasks
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -4,9 +4,18 @@ module Katello
|
|
4
4
|
attr_accessor :smart_proxy
|
5
5
|
|
6
6
|
def initialize(smart_proxy)
|
7
|
+
fail "Cannot use a mirror" if smart_proxy.pulp_mirror?
|
7
8
|
@smart_proxy = smart_proxy
|
8
9
|
end
|
9
10
|
|
11
|
+
def self.instance_for_type(smart_proxy)
|
12
|
+
if smart_proxy.pulp_master?
|
13
|
+
SmartProxyRepository.new(smart_proxy)
|
14
|
+
else
|
15
|
+
SmartProxyMirrorRepository.new(smart_proxy)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
10
19
|
def ==(other)
|
11
20
|
other.class == self.class && other.smart_proxy == smart_proxy
|
12
21
|
end
|
@@ -16,23 +25,43 @@ module Katello
|
|
16
25
|
katello_repos = katello_repos.where(:environment_id => environment_id) if environment_id
|
17
26
|
katello_repos = katello_repos.in_content_views([content_view_id]) if content_view_id
|
18
27
|
katello_repos = katello_repos.select { |repo| smart_proxy.pulp3_support?(repo) }
|
19
|
-
repos_on_capsule =
|
28
|
+
repos_on_capsule = pulp3_enabled_repo_types.collect do |repo_type|
|
29
|
+
repo_type.pulp3_service_class.api(smart_proxy).list_all(name_in: katello_repos.map(&:pulp_id))
|
30
|
+
end
|
31
|
+
repos_on_capsule.flatten!
|
20
32
|
repo_ids = repos_on_capsule.map(&:name)
|
21
33
|
katello_repos.select { |repo| repo_ids.include? repo.pulp_id }
|
22
34
|
end
|
23
35
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
36
|
+
def delete_orphan_repository_versions
|
37
|
+
tasks = []
|
38
|
+
|
39
|
+
orphan_repository_versions.each do |api, version_hrefs|
|
40
|
+
tasks << version_hrefs.collect do |href|
|
41
|
+
api.repository_versions_api.delete(href)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
tasks.flatten
|
29
46
|
end
|
30
47
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
48
|
+
def pulp3_enabled_repo_types
|
49
|
+
Katello::RepositoryTypeManager.repository_types.values.select do |repository_type|
|
50
|
+
smart_proxy.pulp3_repository_type_support?(repository_type)
|
34
51
|
end
|
35
52
|
end
|
53
|
+
|
54
|
+
def orphan_repository_versions
|
55
|
+
# Each key is a Pulp 3 plugin API and each value is the list of version_hrefs
|
56
|
+
repo_version_map = {}
|
57
|
+
pulp3_enabled_repo_types.each do |repo_type|
|
58
|
+
api = repo_type.pulp3_service_class.api(smart_proxy)
|
59
|
+
version_hrefs = api.repository_versions
|
60
|
+
repo_version_map[api] = version_hrefs - ::Katello::Repository.where(version_href: version_hrefs).pluck(:version_href)
|
61
|
+
end
|
62
|
+
|
63
|
+
repo_version_map
|
64
|
+
end
|
36
65
|
end
|
37
66
|
end
|
38
67
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class Srpm < PulpContentUnit
|
4
|
+
include LazyAccessor
|
5
|
+
|
6
|
+
PULP_INDEXED_FIELDS = %w(pulp_href name version release arch epoch summary location_href pkgId).freeze
|
7
|
+
|
8
|
+
lazy_accessor :pulp_facts, :initializer => :backend_data
|
9
|
+
|
10
|
+
lazy_accessor :description, :license, :buildhost, :vendor, :relativepath, :children, :checksumtype,
|
11
|
+
:changelog, :group, :size, :url, :build_time, :group,
|
12
|
+
:initializer => :pulp_facts
|
13
|
+
|
14
|
+
def self.content_api
|
15
|
+
PulpRpmClient::ContentPackagesApi.new(Katello::Pulp3::Api::Yum.new(SmartProxy.pulp_master!).api_client)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.ids_for_repository(repo_id)
|
19
|
+
repo = Katello::Pulp3::Repository::Yum.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
|
20
|
+
repo_content_list = repo.content_list
|
21
|
+
repo_content_list.map { |content| content.try(:pulp_href) }
|
22
|
+
end
|
23
|
+
|
24
|
+
def buildhost
|
25
|
+
backend_data['rpm_buildhost']
|
26
|
+
end
|
27
|
+
|
28
|
+
def vendor
|
29
|
+
backend_data['rpm_vendor']
|
30
|
+
end
|
31
|
+
|
32
|
+
def relativepath
|
33
|
+
backend_data['location_href']
|
34
|
+
end
|
35
|
+
|
36
|
+
def checksumtype
|
37
|
+
backend_data['checksum_type']
|
38
|
+
end
|
39
|
+
|
40
|
+
def changelog
|
41
|
+
backend_data['changelogs']
|
42
|
+
end
|
43
|
+
|
44
|
+
def group
|
45
|
+
backend_data['rpm_group']
|
46
|
+
end
|
47
|
+
|
48
|
+
def build_time
|
49
|
+
backend_data['time_build']
|
50
|
+
end
|
51
|
+
|
52
|
+
def size
|
53
|
+
backend_data['size_package']
|
54
|
+
end
|
55
|
+
|
56
|
+
def license
|
57
|
+
backend_data['rpm_license']
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_model(model)
|
61
|
+
custom_json = {}
|
62
|
+
custom_json['pulp_id'] = backend_data['pulp_href']
|
63
|
+
(PULP_INDEXED_FIELDS - ['pulp_href', 'pkgId', 'location_href']).
|
64
|
+
each { |field| custom_json[field] = backend_data[field] }
|
65
|
+
custom_json['release_sortable'] = Util::Package.sortable_version(backend_data['release'])
|
66
|
+
custom_json['version_sortable'] = Util::Package.sortable_version(backend_data['version'])
|
67
|
+
custom_json['nvra'] = model.build_nvra
|
68
|
+
custom_json['filename'] = backend_data['location_href']
|
69
|
+
custom_json['checksum'] = backend_data['pkgId']
|
70
|
+
model.update_attributes!(custom_json)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class YumMetadataFile < PulpContentUnit
|
4
|
+
include LazyAccessor
|
5
|
+
|
6
|
+
def self.content_api
|
7
|
+
PulpRpmClient::ContentRepoMetadataFilesApi.new(Katello::Pulp3::Repository::Yum.api_client(SmartProxy.pulp_master!))
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.ids_for_repository(repo_id)
|
11
|
+
repo = Katello::Pulp3::Repository::Yum.new(Katello::Repository.find(repo_id), SmartProxy.pulp_master)
|
12
|
+
repo_content_list = repo.content_list
|
13
|
+
repo_content_list.map { |content| content.try(:pulp_href) }
|
14
|
+
end
|
15
|
+
|
16
|
+
# TODO: The Pulp 3 Yum Metadata File API doesn't expose names or file paths yet.
|
17
|
+
# Need to decide if we'll still index Yum Metadata Files in Pulp 3.
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -46,18 +46,19 @@ module Katello
|
|
46
46
|
host
|
47
47
|
end
|
48
48
|
|
49
|
-
def dmi_uuid_fact_id
|
50
|
-
RhsmFactName.find_or_create_by(name: 'dmi::system::uuid').id
|
51
|
-
end
|
52
|
-
|
53
49
|
def dmi_uuid_allowed_dups
|
54
50
|
Katello::Host::SubscriptionFacet::DMI_UUID_ALLOWED_DUPS
|
55
51
|
end
|
56
52
|
|
57
53
|
def find_existing_hosts(host_name, host_uuid)
|
58
|
-
::Host.unscoped.
|
59
|
-
|
60
|
-
|
54
|
+
query = ::Host.unscoped.where("#{::Host.table_name}.name = ?", host_name)
|
55
|
+
|
56
|
+
unless host_uuid.nil? || dmi_uuid_allowed_dups.include?(host_uuid) # no need to include the dmi uuid lookup
|
57
|
+
query = query.left_outer_joins(:subscription_facet).or(::Host.unscoped.left_outer_joins(:subscription_facet)
|
58
|
+
.where("#{Katello::Host::SubscriptionFacet.table_name}.dmi_uuid = ?", host_uuid)).distinct
|
59
|
+
end
|
60
|
+
|
61
|
+
query
|
61
62
|
end
|
62
63
|
|
63
64
|
def validate_hosts(hosts, organization, host_name, host_uuid, host_uuid_overridden = false)
|
@@ -77,8 +78,8 @@ module Katello
|
|
77
78
|
|
78
79
|
if host.name == host_name
|
79
80
|
unless Setting[:host_profile_assume] || host.subscription_facet.nil? || host.build || host_uuid_overridden
|
80
|
-
|
81
|
-
if
|
81
|
+
current_dmi_uuid = host.subscription_facet.dmi_uuid
|
82
|
+
if current_dmi_uuid && current_dmi_uuid != host_uuid
|
82
83
|
registration_error("This host is reporting a DMI UUID that differs from the existing registration.")
|
83
84
|
end
|
84
85
|
end
|
@@ -271,7 +272,7 @@ module Katello
|
|
271
272
|
def populate_subscription_facet(host, activation_keys, consumer_params, uuid)
|
272
273
|
subscription_facet = host.subscription_facet || ::Katello::Host::SubscriptionFacet.new(:host => host)
|
273
274
|
subscription_facet.last_checkin = Time.now
|
274
|
-
subscription_facet.update_from_consumer_attributes(consumer_params.except(:guestIds
|
275
|
+
subscription_facet.update_from_consumer_attributes(consumer_params.except(:guestIds))
|
275
276
|
subscription_facet.uuid = uuid
|
276
277
|
subscription_facet.user = User.current unless User.current.nil? || User.current.hidden?
|
277
278
|
subscription_facet.save!
|
@@ -297,7 +298,7 @@ module Katello
|
|
297
298
|
host.get_status(::Katello::TraceStatus).destroy
|
298
299
|
host.installed_packages.delete_all
|
299
300
|
|
300
|
-
host.rhsm_fact_values.
|
301
|
+
host.rhsm_fact_values.delete_all
|
301
302
|
end
|
302
303
|
end
|
303
304
|
end
|