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
@@ -4,34 +4,6 @@ module Katello
|
|
4
4
|
module Pulp3
|
5
5
|
class Repository
|
6
6
|
class AnsibleCollection < ::Katello::Pulp3::Repository
|
7
|
-
def self.api_client(smart_proxy)
|
8
|
-
PulpAnsibleClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpAnsibleClient::Configuration))
|
9
|
-
end
|
10
|
-
|
11
|
-
def client_class
|
12
|
-
PulpAnsibleClient
|
13
|
-
end
|
14
|
-
|
15
|
-
def api_exception_class
|
16
|
-
PulpAnsibleClient::ApiError
|
17
|
-
end
|
18
|
-
|
19
|
-
def remote_class
|
20
|
-
PulpAnsibleClient::CollectionRemote
|
21
|
-
end
|
22
|
-
|
23
|
-
def remotes_api
|
24
|
-
PulpAnsibleClient::RemotesCollectionApi.new(api_client)
|
25
|
-
end
|
26
|
-
|
27
|
-
def distribution_class
|
28
|
-
PulpAnsibleClient::AnsibleDistribution
|
29
|
-
end
|
30
|
-
|
31
|
-
def distributions_api
|
32
|
-
PulpAnsibleClient::DistributionsAnsibleApi.new(api_client)
|
33
|
-
end
|
34
|
-
|
35
7
|
def remote_options
|
36
8
|
if root.url.blank?
|
37
9
|
super
|
@@ -44,7 +16,7 @@ module Katello
|
|
44
16
|
{
|
45
17
|
base_path: path,
|
46
18
|
repository_version: repo.version_href,
|
47
|
-
name: "#{
|
19
|
+
name: "#{generate_backend_object_name}"
|
48
20
|
}
|
49
21
|
end
|
50
22
|
end
|
@@ -1,49 +1,17 @@
|
|
1
|
-
require '
|
1
|
+
require 'pulp_container_client'
|
2
2
|
|
3
3
|
module Katello
|
4
4
|
module Pulp3
|
5
5
|
class Repository
|
6
6
|
class Docker < ::Katello::Pulp3::Repository
|
7
|
-
def
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def api_exception_class
|
12
|
-
PulpDockerClient::ApiError
|
13
|
-
end
|
14
|
-
|
15
|
-
def client_class
|
16
|
-
PulpDockerClient
|
17
|
-
end
|
18
|
-
|
19
|
-
def remote_class
|
20
|
-
PulpDockerClient::DockerRemote
|
21
|
-
end
|
22
|
-
|
23
|
-
def remotes_api
|
24
|
-
PulpDockerClient::RemotesDockerApi.new(api_client)
|
25
|
-
end
|
26
|
-
|
27
|
-
def distribution_class
|
28
|
-
PulpDockerClient::DockerDistribution
|
29
|
-
end
|
30
|
-
|
31
|
-
def distributions_api
|
32
|
-
PulpDockerClient::DistributionsDockerApi.new(api_client)
|
33
|
-
end
|
34
|
-
|
35
|
-
def recursive_manage_class
|
36
|
-
PulpDockerClient::RecursiveManage
|
37
|
-
end
|
38
|
-
|
39
|
-
def recursive_add_api
|
40
|
-
PulpDockerClient::DockerRecursiveAddApi.new(api_client)
|
7
|
+
def relative_path
|
8
|
+
repo.container_repository_name
|
41
9
|
end
|
42
10
|
|
43
11
|
def remote_options
|
44
12
|
options = {url: root.url, upstream_name: root.docker_upstream_name}
|
45
13
|
if root.docker_tags_whitelist && root.docker_tags_whitelist.any?
|
46
|
-
options[:whitelist_tags] = root.docker_tags_whitelist
|
14
|
+
options[:whitelist_tags] = root.docker_tags_whitelist
|
47
15
|
else
|
48
16
|
options[:whitelist_tags] = nil
|
49
17
|
end
|
@@ -51,28 +19,40 @@ module Katello
|
|
51
19
|
end
|
52
20
|
|
53
21
|
def mirror_remote_options
|
54
|
-
|
22
|
+
{
|
55
23
|
url: "https://#{SmartProxy.pulp_master.pulp3_host!.downcase}",
|
56
24
|
upstream_name: repo.container_repository_name
|
57
25
|
}
|
58
|
-
common_mirror_remote_options.merge(docker_options)
|
59
26
|
end
|
60
27
|
|
61
28
|
def distribution_options(path)
|
62
29
|
{
|
63
30
|
base_path: path,
|
64
31
|
repository_version: repo.version_href,
|
65
|
-
name: "#{
|
32
|
+
name: "#{generate_backend_object_name}"
|
66
33
|
}
|
67
34
|
end
|
68
35
|
|
36
|
+
def create_version(options = {})
|
37
|
+
api.repositories_api.add(repository_reference.repository_href,
|
38
|
+
api.class.recursive_manage_class.new(content_units: options[:add_content_units]))
|
39
|
+
api.repositories_api.remove(repository_reference.repository_href,
|
40
|
+
api.class.recursive_manage_class.new(content_units: options[:remove_content_units]))
|
41
|
+
end
|
42
|
+
|
43
|
+
def add_content(content_unit_href)
|
44
|
+
content_unit_href = [content_unit_href] unless content_unit_href.is_a?(Array)
|
45
|
+
api.repositories_api.add(repository_reference.repository_href, content_units: content_unit_href)
|
46
|
+
end
|
47
|
+
|
69
48
|
def copy_units_recursively(unit_hrefs, clear_repo = false)
|
70
49
|
tasks = []
|
71
50
|
if clear_repo
|
72
|
-
tasks <<
|
51
|
+
tasks << api.repositories_api.remove(repository_reference.repository_href,
|
52
|
+
api.class.recursive_manage_class.new(:content_units => ["*"]))
|
73
53
|
end
|
74
|
-
tasks <<
|
75
|
-
|
54
|
+
tasks << api.repositories_api.add(repository_reference.repository_href,
|
55
|
+
api.class.recursive_manage_class.new(content_units: unit_hrefs))
|
76
56
|
tasks
|
77
57
|
end
|
78
58
|
|
@@ -89,7 +69,7 @@ module Katello
|
|
89
69
|
end
|
90
70
|
|
91
71
|
if whitelist_ids.empty?
|
92
|
-
copy_units_recursively(source_repository.docker_tags.pluck(:pulp_id) - blacklist_ids, true)
|
72
|
+
copy_units_recursively(source_repository.docker_tags.pluck(:pulp_id).sort - blacklist_ids, true)
|
93
73
|
else
|
94
74
|
copy_units_recursively(whitelist_ids - blacklist_ids, true)
|
95
75
|
end
|
@@ -4,42 +4,6 @@ module Katello
|
|
4
4
|
module Pulp3
|
5
5
|
class Repository
|
6
6
|
class File < ::Katello::Pulp3::Repository
|
7
|
-
def api_exception_class
|
8
|
-
PulpFileClient::ApiError
|
9
|
-
end
|
10
|
-
|
11
|
-
def client_class
|
12
|
-
PulpFileClient
|
13
|
-
end
|
14
|
-
|
15
|
-
def remote_class
|
16
|
-
PulpFileClient::FileRemote
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.api_client(smart_proxy)
|
20
|
-
PulpFileClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpFileClient::Configuration))
|
21
|
-
end
|
22
|
-
|
23
|
-
def remotes_api
|
24
|
-
PulpFileClient::RemotesFileApi.new(api_client)
|
25
|
-
end
|
26
|
-
|
27
|
-
def publication_class
|
28
|
-
PulpFileClient::FilePublication
|
29
|
-
end
|
30
|
-
|
31
|
-
def publications_api
|
32
|
-
PulpFileClient::PublicationsFileApi.new(api_client)
|
33
|
-
end
|
34
|
-
|
35
|
-
def distribution_class
|
36
|
-
PulpFileClient::FileDistribution
|
37
|
-
end
|
38
|
-
|
39
|
-
def distributions_api
|
40
|
-
PulpFileClient::DistributionsFileApi.new(api_client)
|
41
|
-
end
|
42
|
-
|
43
7
|
def copy_content_for_source(source_repository, _options = {})
|
44
8
|
copy_units_by_href(source_repository.files.pluck(:pulp_id))
|
45
9
|
end
|
@@ -48,7 +12,7 @@ module Katello
|
|
48
12
|
{
|
49
13
|
base_path: path,
|
50
14
|
publication: repo.publication_href,
|
51
|
-
name: "#{
|
15
|
+
name: "#{generate_backend_object_name}"
|
52
16
|
}
|
53
17
|
end
|
54
18
|
|
@@ -4,42 +4,6 @@ module Katello
|
|
4
4
|
module Pulp3
|
5
5
|
class Repository
|
6
6
|
class Yum < ::Katello::Pulp3::Repository
|
7
|
-
def self.api_client(smart_proxy)
|
8
|
-
PulpRpmClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpRpmClient::Configuration))
|
9
|
-
end
|
10
|
-
|
11
|
-
def api_exception_class
|
12
|
-
PulpRpmClient::ApiError
|
13
|
-
end
|
14
|
-
|
15
|
-
def client_class
|
16
|
-
PulpRpmClient
|
17
|
-
end
|
18
|
-
|
19
|
-
def remote_class
|
20
|
-
PulpRpmClient::RpmRemote
|
21
|
-
end
|
22
|
-
|
23
|
-
def remotes_api
|
24
|
-
PulpRpmClient::RemotesRpmApi.new(api_client)
|
25
|
-
end
|
26
|
-
|
27
|
-
def publication_class
|
28
|
-
PulpRpmClient::RpmPublication
|
29
|
-
end
|
30
|
-
|
31
|
-
def publications_api
|
32
|
-
PulpRpmClient::PublicationsRpmApi.new(api_client)
|
33
|
-
end
|
34
|
-
|
35
|
-
def distribution_class
|
36
|
-
PulpRpmClient::RpmDistribution
|
37
|
-
end
|
38
|
-
|
39
|
-
def distributions_api
|
40
|
-
PulpRpmClient::DistributionsRpmApi.new(api_client)
|
41
|
-
end
|
42
|
-
|
43
7
|
def remote_options
|
44
8
|
if root.url.blank?
|
45
9
|
common_remote_options.merge(url: nil, policy: root.download_policy)
|
@@ -52,9 +16,44 @@ module Katello
|
|
52
16
|
{
|
53
17
|
base_path: path,
|
54
18
|
publication: repo.publication_href,
|
55
|
-
name: "#{
|
19
|
+
name: "#{generate_backend_object_name}"
|
56
20
|
}
|
57
21
|
end
|
22
|
+
|
23
|
+
def import_distribution_data
|
24
|
+
distribution = ::Katello::Pulp3::Distribution.fetch_content_list(repository_version: repo.version_href)
|
25
|
+
if distribution.results.present?
|
26
|
+
repo.update_attributes!(
|
27
|
+
:distribution_version => distribution.results.first.release_version,
|
28
|
+
:distribution_arch => distribution.results.first.arch,
|
29
|
+
:distribution_family => distribution.results.first.release_name,
|
30
|
+
:distribution_uuid => distribution.results.first.pulp_href,
|
31
|
+
:distribution_bootable => self.class.distribution_bootable?(distribution)
|
32
|
+
)
|
33
|
+
unless distribution.results.first.variants.empty?
|
34
|
+
unless distribution.results.first.variants.first.name.nil?
|
35
|
+
repo.update_attributes!(:distribution_variant => distribution.results.first.variants.first.name)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.distribution_bootable?(distribution)
|
42
|
+
file_paths = distribution.results.first.images.map(&:path)
|
43
|
+
file_paths.any? do |path|
|
44
|
+
path.include?('vmlinuz') || path.include?('pxeboot') || path.include?('kernel.img') || path.include?('initrd.img') || path.include?('boot.iso')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def copy_content_for_source
|
49
|
+
# TODO
|
50
|
+
fail NotImplementedError
|
51
|
+
end
|
52
|
+
|
53
|
+
def regenerate_applicability
|
54
|
+
# TODO
|
55
|
+
fail NotImplementedError
|
56
|
+
end
|
58
57
|
end
|
59
58
|
end
|
60
59
|
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class RepositoryMirror
|
4
|
+
attr_accessor :repo_service
|
5
|
+
delegate :repo, to: :repo_service
|
6
|
+
delegate :smart_proxy, to: :repo_service
|
7
|
+
|
8
|
+
delegate :api, to: :repo_service
|
9
|
+
|
10
|
+
def initialize(repository_service)
|
11
|
+
@repo_service = repository_service
|
12
|
+
end
|
13
|
+
|
14
|
+
def backend_object_name
|
15
|
+
#Create repos in pulp3 instance with the name as this repo's pulp_id
|
16
|
+
repo.pulp_id
|
17
|
+
end
|
18
|
+
|
19
|
+
def refresh_entities
|
20
|
+
href = remote_href
|
21
|
+
if href
|
22
|
+
[api.remotes_api.partial_update(href, remote_options)]
|
23
|
+
else
|
24
|
+
create_remote
|
25
|
+
[]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def needs_updates?
|
30
|
+
remote = fetch_remote
|
31
|
+
return true if remote.blank?
|
32
|
+
options = repo_service.compute_remote_options
|
33
|
+
options.keys.any? { |key| remote.send(key) != options[key] }
|
34
|
+
end
|
35
|
+
|
36
|
+
def remote_href
|
37
|
+
fetch_remote.try(:pulp_href)
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_entities
|
41
|
+
create
|
42
|
+
create_remote unless fetch_remote
|
43
|
+
end
|
44
|
+
|
45
|
+
def create
|
46
|
+
api.repositories_api.create(name: backend_object_name)
|
47
|
+
end
|
48
|
+
|
49
|
+
def update
|
50
|
+
api.repositories_api.update(repository_href, name: backend_object_name)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete(href = repository_href)
|
54
|
+
api.repositories_api.delete(href) if href
|
55
|
+
end
|
56
|
+
|
57
|
+
def repository_href
|
58
|
+
fetch_repository.try(:pulp_href)
|
59
|
+
end
|
60
|
+
|
61
|
+
def fetch_repository
|
62
|
+
repo_service.api.list_all(name: backend_object_name).first
|
63
|
+
end
|
64
|
+
|
65
|
+
def version_href
|
66
|
+
fetch_repository.latest_version_href
|
67
|
+
end
|
68
|
+
|
69
|
+
def create_version(options = {})
|
70
|
+
api.repository_versions_api.create(repository_href, options)
|
71
|
+
end
|
72
|
+
|
73
|
+
def distribution_options(path, options = {})
|
74
|
+
ret = {
|
75
|
+
base_path: path,
|
76
|
+
name: "#{backend_object_name}"
|
77
|
+
}
|
78
|
+
ret[:publication] = options[:publication] if options.key? :publication
|
79
|
+
ret[:repository_version] = options[:repository_version] if options.key? :repository_version
|
80
|
+
ret
|
81
|
+
end
|
82
|
+
|
83
|
+
def remote_options
|
84
|
+
base_options = common_remote_options
|
85
|
+
if (type_specific_options = repo_service.try(:mirror_remote_options))
|
86
|
+
base_options.merge(type_specific_options)
|
87
|
+
else
|
88
|
+
base_options.merge(url: remote_feed_url)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def create_remote
|
93
|
+
remote_file_data = @repo_service.api.class.remote_class.new(remote_options)
|
94
|
+
api.remotes_api.create(remote_file_data)
|
95
|
+
end
|
96
|
+
|
97
|
+
def compute_remote_options
|
98
|
+
repo_service.compute_remote_options(remote_options)
|
99
|
+
end
|
100
|
+
|
101
|
+
def fetch_remote
|
102
|
+
api.remotes_list(name: backend_object_name).first
|
103
|
+
end
|
104
|
+
|
105
|
+
def sync
|
106
|
+
api_module = api.class.client_module
|
107
|
+
repository_sync_url_data = api_module::RepositorySyncURL.new(remote: remote_href, mirror: true)
|
108
|
+
[api.repositories_api.sync(repository_href, repository_sync_url_data)]
|
109
|
+
end
|
110
|
+
|
111
|
+
def common_remote_options
|
112
|
+
remote_options = {
|
113
|
+
name: backend_object_name
|
114
|
+
}
|
115
|
+
remote_options.merge!(ssl_remote_options)
|
116
|
+
end
|
117
|
+
|
118
|
+
def ssl_remote_options
|
119
|
+
ueber_cert = ::Cert::Certs.ueber_cert(repo.root.organization)
|
120
|
+
{
|
121
|
+
client_cert: ueber_cert[:cert],
|
122
|
+
client_key: ueber_cert[:key],
|
123
|
+
ca_cert: ::Cert::Certs.ca_cert,
|
124
|
+
tls_validation: true
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
def remote_feed_url
|
129
|
+
uri = ::SmartProxy.pulp_master.pulp3_uri!
|
130
|
+
uri.path = repo_service.partial_repo_path
|
131
|
+
uri.to_s
|
132
|
+
end
|
133
|
+
|
134
|
+
def create_publication
|
135
|
+
if (href = version_href)
|
136
|
+
publication_data = api.class.publication_class.new(repository_version: href)
|
137
|
+
api.publications_api.create(publication_data)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def refresh_distributions(options = {})
|
142
|
+
path = repo_service.relative_path
|
143
|
+
dist_params = {}
|
144
|
+
dist_params[:publication] = options[:publication] if options[:publication]
|
145
|
+
dist_params[:repository_version] = version_href if options[:use_repository_version]
|
146
|
+
dist_options = distribution_options(path, dist_params)
|
147
|
+
if (distro = repo_service.lookup_distributions(base_path: path).first) ||
|
148
|
+
(distro = repo_service.lookup_distributions(name: "#{backend_object_name}").first)
|
149
|
+
# update dist
|
150
|
+
dist_options = dist_options.except(:name, :base_path)
|
151
|
+
api.distributions_api.partial_update(distro.pulp_href, dist_options)
|
152
|
+
else
|
153
|
+
# create dist
|
154
|
+
distribution_data = api.class.distribution_class.new(dist_options)
|
155
|
+
api.distributions_api.create(distribution_data)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def pulp3_enabled_repo_types
|
160
|
+
Katello::RepositoryTypeManager.repository_types.values.select do |repository_type|
|
161
|
+
smart_proxy.pulp3_repository_type_support?(repository_type)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def create_distribution(path)
|
166
|
+
distribution_data = api.class.distribution_class.new(distribution_options(path))
|
167
|
+
repo_service.distributions_api.create(distribution_data)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|