katello 3.17.3 → 3.18.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +38 -21
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -1
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +10 -15
  5. data/app/controllers/katello/api/v2/api_controller.rb +2 -1
  6. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -8
  7. data/app/controllers/katello/api/v2/content_view_components_controller.rb +31 -14
  8. data/app/controllers/katello/api/v2/content_view_repositories_controller.rb +1 -0
  9. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +65 -36
  10. data/app/controllers/katello/api/v2/content_views_controller.rb +27 -25
  11. data/app/controllers/katello/api/v2/environments_controller.rb +8 -8
  12. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +5 -5
  13. data/app/controllers/katello/api/v2/host_collections_controller.rb +19 -16
  14. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +17 -0
  15. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
  16. data/app/controllers/katello/api/v2/repositories_controller.rb +8 -5
  17. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  18. data/app/controllers/katello/api/v2/sync_plans_controller.rb +8 -9
  19. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +9 -2
  20. data/app/controllers/katello/concerns/api/v2/authorization.rb +9 -5
  21. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +21 -0
  22. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
  23. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +2 -1
  24. data/app/helpers/katello/katello_urls_helper.rb +5 -2
  25. data/app/lib/actions/candlepin/product/content_create.rb +2 -0
  26. data/app/lib/actions/candlepin/product/content_update.rb +2 -0
  27. data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +2 -6
  28. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +2 -6
  29. data/app/lib/actions/katello/content_view/publish.rb +3 -4
  30. data/app/lib/actions/katello/content_view_version/import.rb +4 -3
  31. data/app/lib/actions/katello/content_view_version/incremental_update.rb +18 -3
  32. data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
  33. data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
  34. data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
  35. data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
  36. data/app/lib/actions/katello/product/content_create.rb +7 -6
  37. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
  38. data/app/lib/actions/katello/repository/import_upload.rb +2 -1
  39. data/app/lib/actions/katello/repository/update.rb +4 -1
  40. data/app/lib/actions/pulp3/abstract_async_task.rb +0 -1
  41. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  42. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
  43. data/app/lib/actions/pulp3/content_view_version/export.rb +2 -1
  44. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
  45. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +15 -10
  46. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -10
  47. data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
  48. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  49. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
  50. data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
  51. data/app/lib/katello/resources/candlepin/owner.rb +5 -0
  52. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  53. data/app/lib/katello/resources/registry.rb +3 -3
  54. data/app/models/katello/authorization/activation_key.rb +4 -0
  55. data/app/models/katello/authorization/content_view.rb +13 -0
  56. data/app/models/katello/authorization/content_view_component.rb +15 -0
  57. data/app/models/katello/authorization/gpg_key.rb +12 -4
  58. data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
  59. data/app/models/katello/authorization/sync_plan.rb +16 -0
  60. data/app/models/katello/concerns/organization_extensions.rb +4 -5
  61. data/app/models/katello/concerns/redhat_extensions.rb +2 -2
  62. data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -3
  63. data/app/models/katello/content_view_component.rb +2 -0
  64. data/app/models/katello/content_view_version_export_history.rb +2 -0
  65. data/app/models/katello/glue/candlepin/pool.rb +9 -14
  66. data/app/models/katello/glue/pulp/repo.rb +8 -0
  67. data/app/models/katello/gpg_key.rb +1 -1
  68. data/app/models/katello/root_repository.rb +26 -1
  69. data/app/services/katello/applicability/applicable_content_helper.rb +1 -12
  70. data/app/services/katello/candlepin/event_handler.rb +2 -0
  71. data/app/services/katello/candlepin/message_handler.rb +34 -0
  72. data/app/services/katello/candlepin/upstream_consumer.rb +28 -0
  73. data/app/services/katello/host_status_manager.rb +9 -0
  74. data/app/services/katello/pulp3/api/apt.rb +57 -0
  75. data/app/services/katello/pulp3/api/core.rb +8 -0
  76. data/app/services/katello/pulp3/content_view_version/export.rb +4 -3
  77. data/app/services/katello/pulp3/content_view_version/import.rb +5 -15
  78. data/app/services/katello/pulp3/deb.rb +38 -0
  79. data/app/services/katello/pulp3/erratum.rb +1 -2
  80. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -0
  81. data/app/services/katello/pulp3/repository/ansible_collection.rb +9 -0
  82. data/app/services/katello/pulp3/repository/apt.rb +63 -0
  83. data/app/services/katello/pulp3/repository/docker.rb +4 -0
  84. data/app/services/katello/pulp3/repository/yum.rb +2 -1
  85. data/app/services/katello/pulp3/repository.rb +11 -9
  86. data/app/services/katello/pulp3/repository_mirror.rb +9 -4
  87. data/app/services/katello/pulp3/task.rb +3 -3
  88. data/app/services/katello/pulp3/task_group.rb +0 -6
  89. data/app/views/dashboard/_subscription_widget.html.erb +0 -5
  90. data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -1
  91. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  92. data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
  93. data/config/routes/api/v2.rb +2 -0
  94. data/config/routes/overrides.rb +1 -0
  95. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  96. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +2 -5
  97. data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
  98. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
  99. data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
  100. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  101. data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
  102. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
  103. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
  104. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
  105. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +1 -1
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +4 -0
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +16 -14
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
  123. data/lib/katello/engine.rb +1 -0
  124. data/lib/katello/permission_creator.rb +68 -59
  125. data/lib/katello/permissions/host_permissions.rb +1 -0
  126. data/lib/katello/plugin.rb +4 -1
  127. data/lib/katello/repository_types/deb.rb +9 -1
  128. data/lib/katello/tasks/pulp3_content_switchover.rake +1 -3
  129. data/lib/katello/tasks/pulp3_migration_stats.rake +21 -0
  130. data/lib/katello/tasks/reports.rake +1 -4
  131. data/lib/katello/tasks/reset.rake +2 -1
  132. data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
  133. data/lib/katello/version.rb +1 -1
  134. data/locale/action_names.rb +54 -47
  135. data/locale/bn/katello.po +165 -26
  136. data/locale/cs/katello.po +164 -24
  137. data/locale/de/katello.po +165 -26
  138. data/locale/en/katello.po +164 -23
  139. data/locale/es/katello.po +165 -25
  140. data/locale/fr/katello.po +165 -25
  141. data/locale/gu/katello.po +165 -26
  142. data/locale/hi/katello.po +165 -26
  143. data/locale/it/katello.po +165 -25
  144. data/locale/ja/katello.po +165 -26
  145. data/locale/katello.pot +1036 -802
  146. data/locale/kn/katello.po +165 -26
  147. data/locale/ko/katello.po +165 -25
  148. data/locale/mr/katello.po +165 -26
  149. data/locale/or/katello.po +165 -26
  150. data/locale/pa/katello.po +165 -26
  151. data/locale/pt/katello.po +164 -23
  152. data/locale/pt_BR/katello.po +165 -25
  153. data/locale/ru/katello.po +165 -25
  154. data/locale/ta/katello.po +165 -26
  155. data/locale/te/katello.po +165 -26
  156. data/locale/zh_CN/katello.po +165 -25
  157. data/locale/zh_TW/katello.po +165 -26
  158. data/webpack/components/ActionableDetail.js +2 -1
  159. data/webpack/components/Search/Search.js +1 -1
  160. data/webpack/components/Table/MainTable.js +6 -2
  161. data/webpack/components/Table/TableWrapper.js +46 -9
  162. data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
  163. data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
  164. data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
  165. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
  166. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
  167. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
  168. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
  169. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
  170. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
  171. data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
  172. data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
  173. data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
  174. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
  175. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
  176. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  177. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
  178. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  179. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +16 -8
  180. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
  181. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
  182. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
  183. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
  184. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
  185. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
  186. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
  187. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
  188. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
  189. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
  190. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
  191. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
  192. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
  193. metadata +69 -26
@@ -78,8 +78,7 @@ module Katello
78
78
  joins("INNER JOIN katello_installed_packages ON
79
79
  katello_rpms.name = katello_installed_packages.name AND
80
80
  katello_rpms.arch = katello_installed_packages.arch AND
81
- katello_rpms.evr > katello_installed_packages.evr AND
82
- katello_installed_packages.id in (#{newest_distinct_installed_packages_query})").
81
+ katello_rpms.evr > katello_installed_packages.evr").
83
82
  joins("LEFT JOIN katello_module_stream_rpms ON
84
83
  katello_rpms.id = katello_module_stream_rpms.rpm_id").
85
84
  joins("INNER JOIN katello_host_installed_packages ON
@@ -93,16 +92,6 @@ module Katello
93
92
  :enabled_module_streams => enabled_module_stream_ids).pluck(:id).uniq
94
93
  end
95
94
 
96
- def newest_distinct_installed_packages_query
97
- "SELECT DISTINCT ON (katello_installed_packages.name) katello_installed_packages.id " \
98
- "FROM katello_installed_packages INNER JOIN " \
99
- "katello_host_installed_packages ON " \
100
- "katello_installed_packages.id = " \
101
- "katello_host_installed_packages.installed_package_id " \
102
- "WHERE katello_host_installed_packages.host_id = " \
103
- "#{content_facet.host.id} ORDER BY katello_installed_packages.name, katello_installed_packages.evr DESC"
104
- end
105
-
106
95
  def applicable_differences
107
96
  consumer_ids = content_facet.send(applicable_units).pluck("#{content_unit_class.table_name}.id")
108
97
  content_ids = fetch_content_ids
@@ -30,6 +30,8 @@ module Katello
30
30
  reindex_subscription_status
31
31
  when /system_purpose_compliance\.created/
32
32
  reindex_purpose_status
33
+ when /owner_content_access_mode\.modified/
34
+ message_handler.handle_content_access_mode_modified
33
35
  end
34
36
  end
35
37
 
@@ -20,6 +20,10 @@ module Katello
20
20
  @event_data ||= (data = content['eventData']) ? JSON.parse(data) : {}
21
21
  end
22
22
 
23
+ def target_name
24
+ content['targetName']
25
+ end
26
+
23
27
  def status
24
28
  event_data['status']
25
29
  end
@@ -85,6 +89,36 @@ module Katello
85
89
  Rails.logger.info "deleted pool #{pool_id} from Katello"
86
90
  end
87
91
  end
92
+
93
+ def handle_content_access_mode_modified
94
+ # Ideally the target_name would be the Candlepin Owner key
95
+ # Since it's the displayName, and we don't update that after org creation, there could be a mismatch
96
+ # For now, find the Candlepin Owner displayName from this event, and tie it back to a Katello org based on owner key
97
+ owners = Katello::Resources::Candlepin::Owner.all
98
+ owner = owners.find { |o| o['displayName'] == target_name }
99
+
100
+ unless owner
101
+ fail("Candlepin Owner %s could not be found" % target_name)
102
+ end
103
+
104
+ org = ::Organization.find_by!(label: owner['key'])
105
+ hosts = org.hosts
106
+
107
+ if event_data['contentAccessMode'] == 'org_environment'
108
+ Katello::HostStatusManager.clear_syspurpose_status(hosts)
109
+ Katello::HostStatusManager.update_subscription_status_to_sca(hosts)
110
+ elsif event_data['contentAccessMode'] == 'entitlement'
111
+ cp_consumer_uuids = hosts.joins(:subscription_facet).pluck("#{Katello::Host::SubscriptionFacet.table_name}.uuid")
112
+ cp_consumer_uuids.each do |uuid|
113
+ Katello::Resources::Candlepin::Consumer.compliance(uuid)
114
+ Katello::Resources::Candlepin::Consumer.purpose_compliance(uuid)
115
+ rescue => e
116
+ Rails.logger.error("Error encountered while fetching compliance for consumer #{uuid}: #{e.message}")
117
+ end
118
+ end
119
+
120
+ org.simple_content_access?(cached: false)
121
+ end
88
122
  end
89
123
  end
90
124
  end
@@ -0,0 +1,28 @@
1
+ module Katello
2
+ module Candlepin
3
+ class UpstreamConsumer
4
+ def initialize(organization)
5
+ @organization = organization
6
+ end
7
+
8
+ def simple_content_access_eligible?
9
+ eligible = true
10
+ ::Organization.as_org(@organization) do
11
+ content_modes = resource_class.content_access
12
+
13
+ if content_modes.key?(:contentAccessModeList)
14
+ eligible = content_modes[:contentAccessModeList].include?('org_environment')
15
+ end
16
+ end
17
+
18
+ eligible
19
+ end
20
+
21
+ private
22
+
23
+ def resource_class
24
+ Katello::Resources::Candlepin::UpstreamConsumer
25
+ end
26
+ end
27
+ end
28
+ end
@@ -16,5 +16,14 @@ module Katello
16
16
  Katello::PurposeRoleStatus,
17
17
  Katello::PurposeSlaStatus,
18
18
  Katello::PurposeUsageStatus].freeze
19
+
20
+ def self.update_subscription_status_to_sca(hosts)
21
+ HostStatus::Status.where(host: hosts, type: Katello::SubscriptionStatus.to_s).update(status: Katello::SubscriptionStatus::DISABLED)
22
+ end
23
+
24
+ def self.clear_syspurpose_status(hosts)
25
+ host_purpose = HostStatus::Status.where(type: ::Katello::HostStatusManager::PURPOSE_STATUS.map(&:to_s)).where('host_id in (?)', hosts.pluck(:id))
26
+ host_purpose.destroy_all
27
+ end
19
28
  end
20
29
  end
@@ -0,0 +1,57 @@
1
+ require "pulpcore_client"
2
+
3
+ module Katello
4
+ module Pulp3
5
+ module Api
6
+ class Apt < Core
7
+ def self.api_exception_class
8
+ PulpDebClient::ApiError
9
+ end
10
+
11
+ def self.client_module
12
+ PulpDebClient
13
+ end
14
+
15
+ def self.remote_class
16
+ PulpDebClient::DebAptRemote
17
+ end
18
+
19
+ def self.distribution_class
20
+ PulpDebClient::DebAptDistribution
21
+ end
22
+
23
+ def self.publication_class
24
+ PulpDebClient::DebAptPublication
25
+ end
26
+
27
+ def self.repository_sync_url_class
28
+ PulpDebClient::RepositorySyncURL
29
+ end
30
+
31
+ def api_client
32
+ PulpDebClient::ApiClient.new(smart_proxy.pulp3_configuration(PulpDebClient::Configuration))
33
+ end
34
+
35
+ def repositories_api
36
+ PulpDebClient::RepositoriesAptApi.new(api_client)
37
+ end
38
+
39
+ def repository_versions_api
40
+ PulpDebClient::RepositoriesDebVersionsApi.new(api_client)
41
+ end
42
+
43
+ def remotes_api
44
+ PulpDebClient::RemotesAptApi.new(api_client)
45
+ end
46
+
47
+ def publications_api
48
+ PulpDebClient::PublicationsAptApi.new(api_client)
49
+ end
50
+
51
+ def distributions_api
52
+ PulpDebClient::DistributionsAptApi.new(api_client)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -86,6 +86,14 @@ module Katello
86
86
  PulpcoreClient::UploadsApi.new(core_api_client)
87
87
  end
88
88
 
89
+ def upload_commit_class
90
+ PulpcoreClient::UploadCommit
91
+ end
92
+
93
+ def signing_services_api
94
+ PulpcoreClient::SigningServicesApi.new(core_api_client)
95
+ end
96
+
89
97
  def tasks_api
90
98
  PulpcoreClient::TasksApi.new(core_api_client)
91
99
  end
@@ -3,7 +3,6 @@ module Katello
3
3
  module ContentViewVersion
4
4
  class Export
5
5
  include ImportExportCommon
6
- METADATA_FILE = "metadata.json".freeze
7
6
 
8
7
  def initialize(smart_proxy:, content_view_version: nil, destination_server: nil)
9
8
  @smart_proxy = smart_proxy
@@ -26,8 +25,10 @@ module Katello
26
25
  repositories: repository_hrefs)
27
26
  end
28
27
 
29
- def create_export(exporter_href)
30
- [api.export_api.create(exporter_href, { versions: version_hrefs })]
28
+ def create_export(exporter_href, chunk_size = nil)
29
+ options = { versions: version_hrefs }
30
+ options[:chunk_size] = "#{chunk_size}MB" if chunk_size
31
+ [api.export_api.create(exporter_href, options)]
31
32
  end
32
33
 
33
34
  def fetch_export(exporter_href)
@@ -5,15 +5,16 @@ module Katello
5
5
  include ImportExportCommon
6
6
  BASEDIR = '/var/lib/pulp'.freeze
7
7
 
8
- def initialize(smart_proxy:, content_view_version: nil, path: nil)
8
+ def initialize(smart_proxy:, content_view_version: nil, path: nil, metadata: nil)
9
9
  @smart_proxy = smart_proxy
10
10
  @content_view_version = content_view_version
11
11
  @path = path
12
+ @metadata = metadata
12
13
  end
13
14
 
14
15
  def repository_mapping
15
16
  mapping = {}
16
- metadata[:repository_mapping].each do |key, value|
17
+ @metadata[:repository_mapping].each do |key, value|
17
18
  repo = @content_view_version.importable_repositories.joins(:root, :product).
18
19
  where("#{::Katello::Product.table_name}" => {:name => value[:product]},
19
20
  "#{::Katello::RootRepository.table_name}" => {:name => value[:repository]}).first
@@ -30,7 +31,7 @@ module Katello
30
31
  end
31
32
 
32
33
  def create_import(importer_href)
33
- [api.import_api.create(importer_href, toc: "#{@path}/#{metadata[:toc]}")]
34
+ [api.import_api.create(importer_href, toc: "#{@path}/#{@metadata[:toc]}")]
34
35
  end
35
36
 
36
37
  def fetch_import(importer_href)
@@ -43,24 +44,13 @@ module Katello
43
44
  api.importer_api.delete(importer_href)
44
45
  end
45
46
 
46
- def metadata
47
- @metadata ||= self.class.metadata(@path)
48
- end
49
-
50
47
  class << self
51
- def metadata(path)
52
- JSON.parse(File.read("#{path}/#{Export::METADATA_FILE}")).with_indifferent_access
53
- end
54
-
55
48
  def check_permissions!(path)
56
49
  fail _("Invalid path specified.") if path.blank? || !File.directory?(path)
57
50
  fail _("The import path must be in a subdirectory under '%s'." % BASEDIR) unless path.starts_with?(BASEDIR)
58
- metadata_file = "#{path}/#{::Katello::Pulp3::ContentViewVersion::Export::METADATA_FILE}"
59
- fail _("Could not find metadata.json at '%s'." % metadata_file) unless File.exist?(metadata_file)
60
- fail _("Unable to read the metadata.json at '%s'." % metadata_file) unless File.readable?(metadata_file)
61
51
  fail _("Pulp user or group unable to read content in '%s'." % path) unless pulp_user_accessible?(path)
52
+
62
53
  Dir.glob("#{path}/*").each do |file|
63
- next if file == metadata_file
64
54
  fail _("Pulp user or group unable to read '%s'." % file) unless pulp_user_accessible?(file)
65
55
  end
66
56
  end
@@ -0,0 +1,38 @@
1
+ module Katello
2
+ module Pulp3
3
+ class Deb < PulpContentUnit
4
+ include LazyAccessor
5
+ CONTENT_TYPE = "deb".freeze
6
+
7
+ def self.content_api
8
+ PulpDebClient::ContentPackagesApi.new(Katello::Pulp3::Api::Apt.new(SmartProxy.pulp_primary!).api_client)
9
+ end
10
+
11
+ def self.content_api_create(opts = {})
12
+ self.content_api.create(opts)
13
+ end
14
+
15
+ def self.create_content(options)
16
+ fail _("Artifact Id and relative path are needed to create content") unless options.dig(:file_name) && options.dig(:artifact)
17
+ PulpDebClient::DebContent.new(relative_path: options[:file_name], artifact: options[:artifact])
18
+ end
19
+
20
+ def self.ids_for_repository(repo_id)
21
+ repo = Katello::Pulp3::Repository::Apt.new(Katello::Repository.find(repo_id), SmartProxy.pulp_primary)
22
+ repo_content_list = repo.content_list
23
+ repo_content_list.map { |content| content.try(:pulp_href) }
24
+ end
25
+
26
+ def update_model(model)
27
+ custom_json = {}
28
+ custom_json['checksum'] = backend_data['sha256']
29
+ custom_json['filename'] = backend_data['relative_path']
30
+ custom_json['name'] = backend_data['package']
31
+ custom_json['version'] = backend_data['version']
32
+ custom_json['description'] = backend_data['description']
33
+ custom_json['architecture'] = backend_data['architecture']
34
+ model.update!(custom_json)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -35,8 +35,7 @@ module Katello
35
35
  custom_json["issued"] = convert_date_if_epoch(custom_json["issued"])
36
36
  custom_json["updated"] = convert_date_if_epoch(custom_json["updated"]) unless custom_json["updated"].blank?
37
37
 
38
- if model.updated.blank? ||
39
- (custom_json['updated'] && (custom_json['updated'].to_datetime != model.updated.to_datetime))
38
+ if model.updated.blank? || (custom_json['updated'].to_datetime != model.updated.to_datetime)
40
39
  custom_json['errata_id'] = custom_json.delete('id')
41
40
  custom_json['errata_type'] = custom_json.delete('type')
42
41
  custom_json['updated'] = custom_json['updated'].blank? ? custom_json['issued'] : custom_json['updated']
@@ -11,6 +11,11 @@ module Katello
11
11
  fail NotImplementedError
12
12
  end
13
13
 
14
+ def self.content_api_create(opts = {})
15
+ relative_path = opts.delete(:relative_path)
16
+ self.content_api.create(relative_path, opts)
17
+ end
18
+
14
19
  def self.create_content
15
20
  fail NotImplementedError
16
21
  end
@@ -19,6 +19,15 @@ module Katello
19
19
  name: "#{generate_backend_object_name}"
20
20
  }
21
21
  end
22
+
23
+ def partial_repo_path
24
+ "/pulp_ansible/galaxy/#{repo.relative_path}/api/v2/collections"
25
+ end
26
+
27
+ def mirror_remote_options
28
+ {
29
+ }
30
+ end
22
31
  end
23
32
  end
24
33
  end
@@ -0,0 +1,63 @@
1
+ require 'pulp_deb_client'
2
+
3
+ module Katello
4
+ module Pulp3
5
+ class Repository
6
+ class Apt < ::Katello::Pulp3::Repository
7
+ SIGNING_SERVICE_NAME = 'katello_deb_sign'.freeze
8
+
9
+ def remote_options
10
+ deb_remote_options = {
11
+ distributions: root.deb_releases
12
+ }
13
+ deb_remote_options[:components] = root.deb_components.present? ? root.deb_components : nil
14
+ deb_remote_options[:architectures] = root.deb_architectures.present? ? root.deb_architectures : nil
15
+
16
+ if root.url.blank?
17
+ deb_remote_options[:url] = nil
18
+ end
19
+
20
+ deb_remote_options[:gpgkey] = root.gpg_key.present? ? root.gpg_key.content : nil
21
+
22
+ common_remote_options.merge(deb_remote_options)
23
+ end
24
+
25
+ def publication_options(repository_version)
26
+ ss = api.signing_services_api.list(name: SIGNING_SERVICE_NAME).results
27
+ popts = super(repository_version)
28
+ popts.merge!(
29
+ {
30
+ # structured is not necessary for subscription-manager
31
+ #structured: true, # publish real suites (e.g. 'stable')
32
+ simple: true # publish all into 'default'-suite
33
+ }
34
+ )
35
+ popts[:signing_service] = ss[0].pulp_href if ss && ss.length == 1
36
+ popts
37
+ end
38
+
39
+ def distribution_options(path)
40
+ {
41
+ base_path: path,
42
+ publication: repo.publication_href,
43
+ name: "#{generate_backend_object_name}"
44
+ }
45
+ end
46
+
47
+ def partial_repo_path
48
+ "/pulp/deb/#{repo.relative_path}/".sub('//', '/')
49
+ end
50
+
51
+ def copy_content_for_source
52
+ # TODO
53
+ fail NotImplementedError
54
+ end
55
+
56
+ def regenerate_applicability
57
+ # TODO
58
+ fail NotImplementedError
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -8,6 +8,10 @@ module Katello
8
8
  repo.container_repository_name
9
9
  end
10
10
 
11
+ def partial_repo_path
12
+ ''
13
+ end
14
+
11
15
  def remote_options
12
16
  options = {url: root.url, upstream_name: root.docker_upstream_name}
13
17
  if root.docker_tags_whitelist&.any?
@@ -159,7 +159,8 @@ module Katello
159
159
 
160
160
  data_dup.config[i][:content] = leftover_units.pop(copy_amount)
161
161
  unit_copy_counter += copy_amount
162
- if unit_copy_counter != 0
162
+ # Do copy call if limit is reached or if we're under the limit but on the last repo config.
163
+ if unit_copy_counter >= UNIT_LIMIT || (i == data_dup.config.size - 1 && leftover_units.empty?)
163
164
  tasks << api.copy_api.copy_content(data_dup)
164
165
  unit_copy_counter = 0
165
166
  end
@@ -1,4 +1,5 @@
1
1
  require "pulpcore_client"
2
+
2
3
  module Katello
3
4
  module Pulp3
4
5
  class Repository
@@ -187,9 +188,8 @@ module Katello
187
188
  api.repositories_api.read(repository_reference.try(:repository_href))
188
189
  end
189
190
 
190
- def delete_repository(repo_reference = repository_reference)
191
- href = repo_reference.try(:repository_href)
192
- repo_reference.try(:destroy)
191
+ def delete(href = repository_reference.try(:repository_href))
192
+ repository_reference.try(:destroy)
193
193
  ignore_404_exception { api.repositories_api.delete(href) } if href
194
194
  end
195
195
 
@@ -205,10 +205,16 @@ module Katello
205
205
  end
206
206
 
207
207
  def create_publication
208
- publication_data = api.class.publication_class.new(repository_version: repo.version_href)
208
+ publication_data = api.class.publication_class.new(publication_options(repo.version_href))
209
209
  api.publications_api.create(publication_data)
210
210
  end
211
211
 
212
+ def publication_options(repository_version)
213
+ {
214
+ repository_version: repository_version
215
+ }
216
+ end
217
+
212
218
  def relative_path
213
219
  repo.relative_path.sub(/^\//, '')
214
220
  end
@@ -251,12 +257,8 @@ module Katello
251
257
  create_version(:base_version => from_repository.version_href)
252
258
  end
253
259
 
254
- def version_zero?
255
- repo.version_href.ends_with?('/versions/0/')
256
- end
257
-
258
260
  def delete_version
259
- ignore_404_exception { api.repository_versions_api.delete(repo.version_href) } unless version_zero?
261
+ ignore_404_exception { api.repository_versions_api.delete(repo.version_href) }
260
262
  end
261
263
 
262
264
  def create_version(options = {})
@@ -91,10 +91,11 @@ module Katello
91
91
 
92
92
  def remote_options
93
93
  base_options = common_remote_options
94
- base_options.merge(url: remote_feed_url)
94
+ base_options.merge!(url: remote_feed_url)
95
95
  if (type_specific_options = repo_service.try(:mirror_remote_options))
96
- base_options.merge(type_specific_options)
96
+ base_options.merge!(type_specific_options)
97
97
  end
98
+ base_options
98
99
  end
99
100
 
100
101
  def create_remote
@@ -110,8 +111,11 @@ module Katello
110
111
  api.remotes_list(name: backend_object_name).first
111
112
  end
112
113
 
113
- def sync
114
- repository_sync_url_data = api.class.repository_sync_url_class.new(remote: remote_href, mirror: true)
114
+ def sync(options = {})
115
+ sync_params = repo_service.sync_url_params(options)
116
+ sync_params[:remote] = remote_href
117
+ sync_params[:mirror] = true
118
+ repository_sync_url_data = api.class.repository_sync_url_class.new(sync_params)
115
119
  [api.repositories_api.sync(repository_href, repository_sync_url_data)]
116
120
  end
117
121
 
@@ -152,6 +156,7 @@ module Katello
152
156
  dist_params[:publication] = options[:publication] if options[:publication]
153
157
  dist_params[:repository_version] = version_href if options[:use_repository_version]
154
158
  dist_options = distribution_options(path, dist_params)
159
+ dist_options.delete(:content_guard) if repo_service.repo.content_type == "docker"
155
160
  if (distro = repo_service.lookup_distributions(base_path: path).first) ||
156
161
  (distro = repo_service.lookup_distributions(name: "#{backend_object_name}").first)
157
162
  # update dist
@@ -79,7 +79,7 @@ module Katello
79
79
 
80
80
  def error
81
81
  if task_data[:state] == CANCELED
82
- _("Task canceled")
82
+ self.new(_("Task canceled"))
83
83
  elsif task_data[:state] == FAILED
84
84
  if task_data[:error][:description].blank?
85
85
  _("Pulp task error")
@@ -90,8 +90,8 @@ module Katello
90
90
  end
91
91
 
92
92
  def cancel
93
- data = PulpcoreClient::TaskResponse.new(state: 'canceled')
94
- tasks_api.tasks_cancel(task_data['pulp_href'], data)
93
+ data = PulpcoreClient::Task.new(state: 'canceled')
94
+ tasks_api.tasks_cancel(pulp_task['pulp_href'], data)
95
95
  #the main task may have completed, so cancel spawned tasks too
96
96
  task_data['spawned_tasks']&.each { |spawned| tasks_api.tasks_cancel(spawned['pulp_href'], data) }
97
97
  end
@@ -73,12 +73,6 @@ module Katello
73
73
  end
74
74
 
75
75
  def cancel
76
- tasks_api = ::Katello::Pulp3::Api::Core.new(@smart_proxy).tasks_api
77
- tasks_response = tasks_api.list(task_group: task_group_data['pulp_href'])
78
- data = PulpcoreClient::TaskResponse.new(state: 'canceled')
79
- tasks_response.results.collect do |result|
80
- tasks_api.tasks_cancel(result.pulp_href, data)
81
- end
82
76
  end
83
77
  end
84
78
  end
@@ -4,11 +4,6 @@
4
4
 
5
5
  <% if Organization.current.blank? %>
6
6
  <p class="ca"><%= _("Please select an organization to view subscription status.") %></p>
7
- <% elsif Organization.current.simple_content_access?%>
8
- <div class="bastion alert alert-info">
9
- <span translate>This organization has Simple Content Access enabled. Hosts can consume from all repositories in their Content View regardless of subscription status.
10
- </span>
11
- </div>
12
7
  <% else %>
13
8
  <% total_count = total_host_count() %>
14
9
  <% partial_consumer_count = partial_consumer_count() %>
@@ -1,6 +1,6 @@
1
1
  object @resource
2
2
 
3
- attributes :destination_server, :path, :id
3
+ attributes :destination_server, :path, :id, :metadata
4
4
 
5
5
  node :content_view_version do |h|
6
6
  h.content_view_version.name
@@ -7,7 +7,7 @@ attributes :relative_path, :container_repository_name, :full_path, :library_inst
7
7
  attributes :version_href, :remote_href, :publication_href
8
8
 
9
9
  glue(@object.root) do
10
- attributes :content_type, :url, :arch, :content_id
10
+ attributes :content_type, :url, :arch, :os_versions, :content_id
11
11
  attributes :major, :minor
12
12
 
13
13
  child :product do |_product|
@@ -1,3 +1,3 @@
1
1
  <% if taxonomy.is_a?(Organization) %>
2
- <td><%= taxonomy.simple_content_access? ? _("Enabled") : _("Disabled") %></td>
2
+ <td><%= checked_icon taxonomy.simple_content_access? %></td>
3
3
  <% end %>
@@ -122,6 +122,7 @@ Katello::Engine.routes.draw do
122
122
  end
123
123
  collection do
124
124
  get :export_histories
125
+ get :export_api_status
125
126
  get :auto_complete_search
126
127
  post :incremental_update
127
128
  post :import
@@ -357,6 +358,7 @@ Katello::Engine.routes.draw do
357
358
  get :ping
358
359
  match '/simple_content_access/enable', :to => 'upstream_subscriptions#enable_simple_content_access', :via => :put
359
360
  match '/simple_content_access/disable', :to => 'upstream_subscriptions#disable_simple_content_access', :via => :put
361
+ match '/simple_content_access/eligible', :to => 'upstream_subscriptions#simple_content_access_eligible', :via => :get
360
362
  end
361
363
  end
362
364
  end
@@ -78,6 +78,7 @@ Foreman::Application.routes.draw do
78
78
  match '/bulk/release_version' => 'hosts_bulk_actions#release_version', :via => :put
79
79
  match '/bulk/traces' => 'hosts_bulk_actions#traces', :via => :post
80
80
  match '/bulk/resolve_traces' => 'hosts_bulk_actions#resolve_traces', :via => :put
81
+ match '/bulk/system_purpose' => 'hosts_bulk_actions#system_purpose', :via => :put
81
82
  match '/bulk/available_incremental_updates' => 'hosts_bulk_actions#available_incremental_updates', :via => :post
82
83
  match '/bulk/module_streams' => 'hosts_bulk_actions#module_streams', :via => :post
83
84
  match '/subscriptions/' => 'host_subscriptions#create', :via => :post
@@ -329,7 +329,7 @@ class MigrateContentHosts < ActiveRecord::Migration[4.2]
329
329
  # rubocop:disable Metrics/MethodLength
330
330
  # rubocop:disable Metrics/AbcSize
331
331
  def up
332
- unless User.unscoped.where(:login => User::ANONYMOUS_API_ADMIN).exists?
332
+ if User.where(:login => User::ANONYMOUS_API_ADMIN).first.nil?
333
333
  logger.warn("Foreman anonymous admin does not exist, skipping content host migration.")
334
334
  return
335
335
  end
@@ -1,6 +1,6 @@
1
1
  class MoveKatelloFieldsFromHostgroups < ActiveRecord::Migration[6.0]
2
2
  def up
3
- if User.unscoped.where(login: User::ANONYMOUS_ADMIN).exists?
3
+ if User.where(login: User::ANONYMOUS_ADMIN).exists?
4
4
  User.as_anonymous_admin do
5
5
  copy_data_from_hostgroup
6
6
  end
@@ -46,10 +46,7 @@ class MoveKatelloFieldsFromHostgroups < ActiveRecord::Migration[6.0]
46
46
  content_facet.kickstart_repository_id = kickstart_repository_id
47
47
  content_facet.content_view_id = content_view_id
48
48
  content_facet.lifecycle_environment_id = lifecycle_environment_id
49
- unless content_facet.save
50
- Rails.logger.warn("Unable to save content facet hostgroup for #{content_facet.inspect} ")
51
- Rails.logger.warn(content_facet.errors.full_messages.join("\n"))
52
- end
49
+ content_facet.save!
53
50
  end
54
51
  end
55
52
  end