katello 4.2.0.1.rc2 → 4.2.2

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.

Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +6 -3
  3. data/app/controllers/katello/api/v2/content_uploads_controller.rb +6 -3
  4. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +2 -1
  5. data/app/controllers/katello/api/v2/generic_content_units_controller.rb +26 -0
  6. data/app/controllers/katello/api/v2/repositories_controller.rb +16 -4
  7. data/app/helpers/katello/content_view_helper.rb +4 -4
  8. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +18 -11
  9. data/app/lib/actions/katello/activation_key/destroy.rb +1 -1
  10. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  11. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +7 -47
  12. data/app/lib/actions/katello/content_view/incremental_updates.rb +13 -3
  13. data/app/lib/actions/katello/content_view/promote_to_environment.rb +2 -7
  14. data/app/lib/actions/katello/content_view/publish.rb +7 -6
  15. data/app/lib/actions/katello/content_view_version/incremental_update.rb +4 -4
  16. data/app/lib/actions/katello/environment/publish_repositories.rb +1 -0
  17. data/app/lib/actions/katello/repository/filtered_index_content.rb +5 -0
  18. data/app/lib/actions/katello/repository/finish_upload.rb +1 -1
  19. data/app/lib/actions/katello/repository/import_upload.rb +6 -2
  20. data/app/lib/actions/katello/repository/index_content.rb +2 -1
  21. data/app/lib/actions/katello/repository/instance_update.rb +1 -1
  22. data/app/lib/actions/katello/repository/metadata_generate.rb +2 -0
  23. data/app/lib/actions/katello/repository/multi_clone_to_version.rb +1 -1
  24. data/app/lib/actions/katello/repository/remove_content.rb +6 -2
  25. data/app/lib/actions/katello/repository/sync.rb +0 -2
  26. data/app/lib/actions/katello/repository/upload_files.rb +6 -1
  27. data/app/lib/actions/pulp3/abstract_async_task.rb +16 -3
  28. data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +14 -18
  29. data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +1 -11
  30. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -2
  31. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +3 -1
  32. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +2 -4
  33. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +8 -1
  34. data/app/lib/actions/pulp3/orchestration/repository/upload_content.rb +2 -7
  35. data/app/lib/actions/pulp3/repository/save_artifact.rb +4 -1
  36. data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
  37. data/app/lib/katello/qpid/connection.rb +3 -1
  38. data/app/lib/katello/resources/registry.rb +1 -1
  39. data/app/lib/katello/util/errata.rb +9 -2
  40. data/app/lib/katello/util/pulpcore_content_filters.rb +1 -0
  41. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +27 -14
  42. data/app/models/katello/concerns/host_managed_extensions.rb +19 -0
  43. data/app/models/katello/concerns/hostgroup_extensions.rb +4 -4
  44. data/app/models/katello/concerns/pulp_database_unit.rb +32 -11
  45. data/app/models/katello/concerns/redhat_extensions.rb +3 -2
  46. data/app/models/katello/concerns/smart_proxy_extensions.rb +44 -9
  47. data/app/models/katello/content_view.rb +13 -0
  48. data/app/models/katello/content_view_repository.rb +1 -1
  49. data/app/models/katello/docker_tag.rb +2 -2
  50. data/app/models/katello/erratum.rb +13 -0
  51. data/app/models/katello/generic_content_unit.rb +4 -1
  52. data/app/models/katello/ping.rb +1 -4
  53. data/app/models/katello/repository.rb +19 -7
  54. data/app/models/katello/root_repository.rb +9 -2
  55. data/app/models/katello/yum_metadata_file.rb +2 -2
  56. data/app/overrides/add_activation_keys_input.rb +1 -1
  57. data/app/services/katello/applicability/applicable_content_helper.rb +4 -3
  58. data/app/services/katello/organization_creator.rb +11 -4
  59. data/app/services/katello/pulp/content.rb +1 -1
  60. data/app/services/katello/pulp3/content.rb +6 -2
  61. data/app/services/katello/pulp3/erratum.rb +21 -5
  62. data/app/services/katello/pulp3/generic_content_unit.rb +1 -1
  63. data/app/services/katello/pulp3/package_group.rb +10 -10
  64. data/app/services/katello/pulp3/pulp_content_unit.rb +26 -1
  65. data/app/services/katello/pulp3/repository/apt.rb +16 -0
  66. data/app/services/katello/pulp3/repository/yum.rb +29 -47
  67. data/app/services/katello/pulp3/repository.rb +19 -20
  68. data/app/services/katello/pulp3/repository_mirror.rb +23 -5
  69. data/app/services/katello/pulp3/task.rb +3 -2
  70. data/app/services/katello/pulp3/task_group.rb +1 -0
  71. data/app/services/katello/repository_type.rb +8 -6
  72. data/app/services/katello/repository_type_manager.rb +25 -22
  73. data/app/views/katello/api/v2/generic_content_units/base.json.rabl +7 -0
  74. data/app/views/katello/api/v2/generic_content_units/compare.json.rabl +10 -0
  75. data/app/views/katello/api/v2/generic_content_units/index.json.rabl +7 -0
  76. data/app/views/katello/api/v2/generic_content_units/show.json.rabl +3 -0
  77. data/app/views/katello/api/v2/repositories/show.json.rabl +2 -1
  78. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -3
  79. data/config/initializers/filter_parameters.rb +1 -0
  80. data/config/routes/api/v2.rb +12 -1
  81. data/db/migrate/20210331180353_katello_pool_organization_id_not_nullable.rb +2 -0
  82. data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +1 -1
  83. data/db/migrate/20210831161843_add_upstream_auth_token_to_root_repository.rb +5 -0
  84. data/db/seeds.d/111-upgrade_tasks.rb +3 -1
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -1
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +6 -13
  87. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +3 -1
  88. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -0
  89. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -0
  90. data/lib/katello/permission_creator.rb +2 -0
  91. data/lib/katello/repository_types/deb.rb +1 -1
  92. data/lib/katello/repository_types/docker.rb +1 -1
  93. data/lib/katello/repository_types/file.rb +1 -1
  94. data/lib/katello/repository_types/ostree.rb +1 -1
  95. data/lib/katello/repository_types/python.rb +4 -1
  96. data/lib/katello/repository_types/yum.rb +1 -1
  97. data/lib/katello/tasks/reset.rake +6 -5
  98. data/lib/katello/tasks/test.rake +1 -2
  99. data/lib/katello/tasks/upgrades/4.1/{update_content_import_export_perms.rake → reupdate_content_import_export_perms.rake} +24 -1
  100. data/lib/katello/tasks/upgrades/4.2/remove_checksum_values.rake +17 -0
  101. data/lib/katello/version.rb +1 -1
  102. data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/ActivationKeys.test.js.snap +1 -0
  103. data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/Force.test.js.snap +1 -0
  104. data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/IgnoreSubmanErrors.test.js.snap +1 -0
  105. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +2 -4
  106. metadata +23 -31
  107. data/locale/bn/katello.po.time_stamp +0 -0
  108. data/locale/cs/katello.po.time_stamp +0 -0
  109. data/locale/de/katello.po.time_stamp +0 -0
  110. data/locale/en/katello.po.time_stamp +0 -0
  111. data/locale/es/katello.po.time_stamp +0 -0
  112. data/locale/fr/katello.po.time_stamp +0 -0
  113. data/locale/gu/katello.po.time_stamp +0 -0
  114. data/locale/hi/katello.po.time_stamp +0 -0
  115. data/locale/it/katello.po.time_stamp +0 -0
  116. data/locale/ja/katello.po.time_stamp +0 -0
  117. data/locale/kn/katello.po.time_stamp +0 -0
  118. data/locale/ko/katello.po.time_stamp +0 -0
  119. data/locale/mr/katello.po.time_stamp +0 -0
  120. data/locale/or/katello.po.time_stamp +0 -0
  121. data/locale/pa/katello.po.time_stamp +0 -0
  122. data/locale/pt/katello.po.time_stamp +0 -0
  123. data/locale/pt_BR/katello.po.time_stamp +0 -0
  124. data/locale/ru/katello.po.time_stamp +0 -0
  125. data/locale/ta/katello.po.time_stamp +0 -0
  126. data/locale/te/katello.po.time_stamp +0 -0
  127. data/locale/zh_CN/katello.po.time_stamp +0 -0
  128. data/locale/zh_TW/katello.po.time_stamp +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27a69c642aae16f1d0c623a4b236b981c1b09c0e78a304555d130a745983ebbc
4
- data.tar.gz: aac4bfc71c9bbb798750fbbe27d545aa7a5b4586488598a4fc27fac1c513ddaa
3
+ metadata.gz: 3cdba19f418c59dd75998081c306267defc02548958e1c48b38db4db29f2c633
4
+ data.tar.gz: 96f3ff300309604144e935295d3d8f859f757a694cde91768f773a63dfde1106
5
5
  SHA512:
6
- metadata.gz: 5427524abdae177c66bae610c182e1a58a116ef21198984d9f99b8b03d2615214d8820eca5a7a5cac6fbfea88afa7c8722110529aea86fc8f171f9423143eae2
7
- data.tar.gz: 479223ec1f930a5f25adf8c6a97b423a47e6b09871a1cc75c5aaac418b0d6246cb7069d7c11df5ff428f78c2cfc75925d36625a716500bea4e2c7e7723f8f03b
6
+ metadata.gz: e793a484c717492274ee01345a14ccefb4ddad648a0db9b3615232a9b329f8681c1208ccabc21e382d7343bd5a812703db1a9840f59fe895bce42637a125c67f
7
+ data.tar.gz: f9a960acb16529071412b353e79c392cb0c79d8cb4f5f001d67b8ddc64056c80d8e9fd51ead49fce0d8f04918063ee95f31856608ddcef013eb22a70cb827f20
@@ -4,7 +4,7 @@ KT.hosts = {};
4
4
  $(document).on('ContentLoad', function(){
5
5
  KT.hosts.onKatelloHostEditLoad();
6
6
  window.tfm.hosts.registerPluginAttributes("os",
7
- ['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id']);
7
+ ['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id', 'parent_id']);
8
8
 
9
9
  $("#hostgroup_lifecycle_environment_id").change(KT.hosts.environmentChanged);
10
10
  $("#host_lifecycle_environment_id").change(KT.hosts.environmentChanged);
@@ -27,13 +27,15 @@ KT.hosts.fetchContentViews = function () {
27
27
  var envId = KT.hosts.getSelectedEnvironment();
28
28
  var option;
29
29
  var previous_view = KT.hosts.getSelectedContentView();
30
-
30
+ var previousInheritViewText = select.find('option:first-child').text();
31
31
  select.find('option').remove();
32
32
  if (envId) {
33
33
  KT.hosts.signalContentViewFetch(true);
34
34
  var url = tfm.tools.foremanUrl('/katello/api/v2/content_views/');
35
35
  $.get(url, {environment_id: envId, full_result: true}, function (data) {
36
- select.append($("<option />"));
36
+ if ($('#hostgroup_parent_id').length > 0) {
37
+ select.append($("<option />").text(previousInheritViewText).val(''));
38
+ }
37
39
  $.each(data.results, function(index, view) {
38
40
  option = $("<option />").val(view.id).text(view.name);
39
41
  if (view.id === parseInt(previous_view)) {
@@ -41,6 +43,7 @@ KT.hosts.fetchContentViews = function () {
41
43
  }
42
44
  select.append(option);
43
45
  });
46
+ select.trigger('change');
44
47
  KT.hosts.signalContentViewFetch(false);
45
48
  });
46
49
  }
@@ -15,9 +15,12 @@ module Katello
15
15
  fail Katello::Errors::InvalidRepositoryContent, _("Cannot upload Ansible collections.") if @repository.ansible_collection?
16
16
  content_type = params[:content_type] || ::Katello::RepositoryTypeManager.find(@repository.content_type)&.default_managed_content_type&.label
17
17
  RepositoryTypeManager.check_content_matches_repo_type!(@repository, content_type)
18
-
19
- unit_type_id = SmartProxy.pulp_primary.content_service(content_type).content_type
20
- render :json => @repository.backend_content_service(::SmartProxy.pulp_primary).create_upload(params[:size], params[:checksum], unit_type_id)
18
+ if ::Katello::RepositoryTypeManager.generic_content_type?(content_type)
19
+ unit_type_id = content_type
20
+ else
21
+ unit_type_id = SmartProxy.pulp_primary.content_service(content_type).content_type
22
+ end
23
+ render :json => @repository.backend_content_service(::SmartProxy.pulp_primary).create_upload(params[:size], params[:checksum], unit_type_id, @repository)
21
24
  end
22
25
 
23
26
  api :PUT, "/repositories/:repository_id/content_uploads/:id", N_("Upload a chunk of the file's content")
@@ -124,7 +124,8 @@ module Katello
124
124
  validate_content(params[:add_content])
125
125
  resolve_dependencies = params.fetch(:resolve_dependencies, true)
126
126
  task = async_task(::Actions::Katello::ContentView::IncrementalUpdates, @content_view_version_environments, @composite_version_environments,
127
- params[:add_content], resolve_dependencies, hosts, params[:description])
127
+ params[:add_content], resolve_dependencies, hosts, params[:description],
128
+ Setting[:remote_execution_by_default] && ::Katello.with_remote_execution?)
128
129
  respond_for_async :resource => task
129
130
  end
130
131
 
@@ -0,0 +1,26 @@
1
+ module Katello
2
+ class Api::V2::GenericContentUnitsController < Api::V2::ApiController
3
+ Katello::RepositoryTypeManager.generic_content_types(enabled_only: false).each do |type|
4
+ apipie_concern_subst(:a_resource => N_(type), :resource_id => type.pluralize)
5
+ resource_description do
6
+ name type.pluralize.titleize
7
+ end
8
+ end
9
+
10
+ include Katello::Concerns::Api::V2::RepositoryContentController
11
+
12
+ def default_sort
13
+ %w(name asc)
14
+ end
15
+
16
+ def resource_class
17
+ ::Katello::GenericContentUnit.where(content_type: params[:content_type].singularize)
18
+ end
19
+
20
+ private
21
+
22
+ def repo_association
23
+ :repository_id
24
+ end
25
+ end
26
+ end
@@ -56,6 +56,7 @@ module Katello
56
56
  param :verify_ssl_on_sync, :bool, :desc => N_("if true, Katello will verify the upstream url's SSL certifcates are signed by a trusted CA")
57
57
  param :upstream_username, String, :desc => N_("Username of the upstream repository user used for authentication")
58
58
  param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
59
+ param :upstream_authentication_token, String, :desc => N_("Password of the upstream authentication token.")
59
60
  param :ostree_upstream_sync_policy, ::Katello::RootRepository::OSTREE_UPSTREAM_SYNC_POLICIES, :desc => N_("policies for syncing upstream ostree repositories")
60
61
  param :ostree_upstream_sync_depth, :number, :desc => N_("if a custom sync policy is chosen for ostree repositories then a 'depth' value must be provided")
61
62
  param :deb_releases, String, :desc => N_("whitespace-separated list of releases to be synced from deb-archive")
@@ -462,10 +463,11 @@ module Katello
462
463
 
463
464
  # rubocop:disable Metrics/CyclomaticComplexity
464
465
  def repository_params
465
- keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password, :upstream_username, :download_concurrency,
466
+ keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password,
467
+ :upstream_username, :download_concurrency, :upstream_authentication_token,
466
468
  :ostree_upstream_sync_depth, :ostree_upstream_sync_policy, {:os_versions => []},
467
- :deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy, :http_proxy_id, :retain_package_versions_count,
468
- {:ignorable_content => []}
469
+ :deb_releases, :deb_components, :deb_architectures, :description, :http_proxy_policy,
470
+ :http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
469
471
  ]
470
472
 
471
473
  keys += [{:docker_tags_whitelist => []}, :docker_upstream_name] if params[:action] == 'create' || @repository&.docker?
@@ -512,6 +514,7 @@ module Katello
512
514
  root.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
513
515
  root.upstream_username = repo_params[:upstream_username] if repo_params.key?(:upstream_username)
514
516
  root.upstream_password = repo_params[:upstream_password] if repo_params.key?(:upstream_password)
517
+ root.upstream_authentication_token = repo_params[:upstream_authentication_token] if repo_params.key?(:upstream_authentication_token)
515
518
  root.ignorable_content = repo_params[:ignorable_content] if root.yum? && repo_params.key?(:ignorable_content)
516
519
  root.http_proxy_policy = repo_params[:http_proxy_policy] if repo_params.key?(:http_proxy_policy)
517
520
  root.http_proxy_id = repo_params[:http_proxy_id] if repo_params.key?(:http_proxy_id)
@@ -563,12 +566,21 @@ module Katello
563
566
  content_type = params[:content_type]
564
567
 
565
568
  if content_type
569
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, params[:content_type]) if params[:content_type]
566
570
  @content = @repository.units_for_removal(params[:ids], content_type)
567
571
  else
568
572
  @content = @repository.units_for_removal(params[:ids])
569
573
  end
570
574
 
571
- RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.class::CONTENT_TYPE)
575
+ if @repository.generic?
576
+ if content_type
577
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.content_type)
578
+ else
579
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, @repository.repository_type.default_managed_content_type.label)
580
+ end
581
+ else
582
+ RepositoryTypeManager.check_content_matches_repo_type!(@repository, @content.first.class::CONTENT_TYPE)
583
+ end
572
584
  end
573
585
 
574
586
  def filter_by_content_view(query, content_view_id, environment_id, is_available_for)
@@ -1,10 +1,10 @@
1
1
  module Katello
2
2
  module ContentViewHelper
3
- def separated_repo_mapping(repo_mapping)
4
- separated_mapping = { :pulp3_yum => {}, :other => {} }
3
+ def separated_repo_mapping(repo_mapping, use_multicopy_actions)
4
+ separated_mapping = { :pulp3_yum_multicopy => {}, :other => {} }
5
5
  repo_mapping.each do |source_repos, dest_repo|
6
- if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo)
7
- separated_mapping[:pulp3_yum][source_repos] = dest_repo
6
+ if dest_repo.content_type == "yum" && SmartProxy.pulp_primary.pulp3_support?(dest_repo) && use_multicopy_actions
7
+ separated_mapping[:pulp3_yum_multicopy][source_repos] = dest_repo
8
8
  else
9
9
  separated_mapping[:other][source_repos] = dest_repo
10
10
  end
@@ -58,19 +58,19 @@ module Katello
58
58
  end
59
59
 
60
60
  def fetch_lifecycle_environment(host, options = {})
61
- return host.lifecycle_environment if host.lifecycle_environment.present?
61
+ return host.lifecycle_environment if host.try(:lifecycle_environment_id)
62
62
  selected_host_group = options.fetch(:selected_host_group, nil)
63
63
  return selected_host_group.lifecycle_environment if selected_host_group.present?
64
64
  end
65
65
 
66
66
  def fetch_content_view(host, options = {})
67
- return host.content_view if host.content_view.present?
67
+ return host.content_view if host.try(:content_view_id)
68
68
  selected_host_group = options.fetch(:selected_host_group, nil)
69
69
  return selected_host_group.content_view if selected_host_group.present?
70
70
  end
71
71
 
72
72
  def fetch_content_source(host, options = {})
73
- return host.content_source if host.content_source.present?
73
+ return host.content_source if host.try(:content_source_id)
74
74
  selected_host_group = options.fetch(:selected_host_group, nil)
75
75
  return selected_host_group.content_source if selected_host_group.present?
76
76
  end
@@ -216,11 +216,15 @@ module Katello
216
216
  new_host.operatingsystem.kickstart_repos(new_host).map { |repo| OpenStruct.new(repo) }
217
217
  else
218
218
  # case 2
219
- os_updated_kickstart_options(host)
219
+ os_updated_kickstart_options
220
220
  end
221
221
  end
222
222
 
223
- def os_updated_kickstart_options(host)
223
+ def fetch_inherited_param(id, entity, parent_value)
224
+ id.blank? ? parent_value : entity.find(id)
225
+ end
226
+
227
+ def os_updated_kickstart_options(host = nil)
224
228
  # this method gets called in 1 place Once you chose a diff os/content source/arch/lifecycle env/cv
225
229
  # via the os_selected method.
226
230
  # In this case we want it play by the rules of "one of these params" and
@@ -228,19 +232,22 @@ module Katello
228
232
  os_selection_params = ["operatingsystem_id", 'content_view_id', 'lifecycle_environment_id',
229
233
  'content_source_id', 'architecture_id']
230
234
  view_options = []
235
+
231
236
  host_params = params[:hostgroup] || params[:host]
232
- if host_params && os_selection_params.all? { |key| host_params[key].present? }
237
+ parent = ::Hostgroup.find(host_params[:parent_id]) unless host_params.blank? || host_params[:parent_id].blank?
238
+ if host_params && (parent || os_selection_params.all? { |key| host_params[key].present? })
233
239
  if host.nil?
234
240
  host = ::Host.new
235
241
  end
236
- host.operatingsystem = Operatingsystem.find(host_params[:operatingsystem_id])
237
- host.architecture = Architecture.find(host_params[:architecture_id])
242
+ host.operatingsystem = fetch_inherited_param(host_params[:operatingsystem_id], ::Operatingsystem, parent&.os)
243
+ host.architecture = fetch_inherited_param(host_params[:architecture_id], ::Architecture, parent&.architecture)
244
+ lifecycle_env = fetch_inherited_param(host_params[:lifecycle_environment_id], ::Katello::KTEnvironment, parent&.lifecycle_environment)
245
+ content_view = fetch_inherited_param(host_params[:content_view_id], ::Katello::ContentView, parent&.content_view)
246
+ content_source = fetch_inherited_param(host_params[:content_source_id], ::SmartProxy, parent&.content_source)
238
247
 
239
- lifecycle_env = Katello::KTEnvironment.find(host_params[:lifecycle_environment_id])
240
- content_view = Katello::ContentView.find(host_params[:content_view_id])
241
248
  host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => lifecycle_env.id,
242
249
  :content_view_id => content_view.id,
243
- :content_source => SmartProxy.find(host_params[:content_source_id]))
250
+ :content_source => content_source)
244
251
  if host.operatingsystem.is_a?(Redhat)
245
252
  view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
246
253
  end
@@ -6,7 +6,7 @@ module Actions
6
6
  skip_candlepin = options.fetch(:skip_candlepin, false)
7
7
  action_subject(activation_key)
8
8
 
9
- plan_action(Candlepin::ActivationKey::Destroy, cp_id: activation_key.cp_id) unless skip_candlepin
9
+ plan_action(Candlepin::ActivationKey::Destroy, cp_id: activation_key.cp_id) if !skip_candlepin && activation_key.cp_id.present?
10
10
  plan_self
11
11
  end
12
12
 
@@ -40,7 +40,7 @@ module Actions
40
40
  pulp_repo = repo.backend_service(smart_proxy)
41
41
  if !current_repos_on_capsule_ids.include?(repo.id)
42
42
  pulp_repo.create_mirror_entities
43
- elsif pulp_repo.mirror_needs_updates?
43
+ else
44
44
  tasks += pulp_repo.refresh_mirror_entities
45
45
  end
46
46
  end
@@ -4,6 +4,7 @@ module Actions
4
4
  class SyncCapsule < ::Actions::EntryAction
5
5
  include Actions::Katello::PulpSelector
6
6
  def plan(smart_proxy, options = {})
7
+ plan_self(:smart_proxy_id => smart_proxy.id)
7
8
  action_subject(smart_proxy)
8
9
  environment = options[:environment]
9
10
  content_view = options[:content_view]
@@ -11,6 +12,7 @@ module Actions
11
12
  skip_metadata_check = options.fetch(:skip_metadata_check, false)
12
13
  sequence do
13
14
  repos = repos_to_sync(smart_proxy, environment, content_view, repository, skip_metadata_check)
15
+ return nil if repos.empty?
14
16
 
15
17
  repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch|
16
18
  concurrence do
@@ -36,53 +38,6 @@ module Actions
36
38
  end
37
39
  end
38
40
  end
39
- sync_container_gateway(smart_proxy)
40
- end
41
-
42
- def sync_container_gateway(smart_proxy)
43
- if smart_proxy.has_feature?(::SmartProxy::CONTAINER_GATEWAY_FEATURE)
44
- update_container_repo_list(smart_proxy)
45
- users = smart_proxy.container_gateway_users
46
- update_user_container_repo_mapping(smart_proxy, users) if users.any?
47
- end
48
- end
49
-
50
- def unauthenticated_container_repositories
51
- ::Katello::Repository.joins(:environment).where("#{::Katello::KTEnvironment.table_name}.registry_unauthenticated_pull" => true).select(:id).pluck(:id)
52
- end
53
-
54
- def update_container_repo_list(smart_proxy)
55
- # [{ repository: "repoA", auth_required: false }]
56
- repo_list = []
57
- ::Katello::SmartProxyHelper.new(smart_proxy).combined_repos_available_to_capsule.each do |repo|
58
- if repo.docker? && !repo.container_repository_name.nil?
59
- repo_list << { repository: repo.container_repository_name,
60
- auth_required: !unauthenticated_container_repositories.include?(repo.id) }
61
- end
62
- end
63
- smart_proxy.update_container_repo_list(repo_list)
64
- end
65
-
66
- def update_user_container_repo_mapping(smart_proxy, users)
67
- # Example user-repo mapping:
68
- # { users:
69
- # [
70
- # 'user a' => [{ repository: 'repo 1', auth_required: true }]
71
- # ]
72
- # }
73
-
74
- user_repo_map = { users: [] }
75
- users.each do |user|
76
- inner_repo_list = []
77
- repositories = ::Katello::Repository.readable_docker_catalog_as(user)
78
- repositories.each do |repo|
79
- next if repo.container_repository_name.nil?
80
- inner_repo_list << { repository: repo.container_repository_name,
81
- auth_required: !unauthenticated_container_repositories.include?(repo.id) }
82
- end
83
- user_repo_map[:users] << { user.login => inner_repo_list }
84
- end
85
- smart_proxy.update_user_container_repo_mapping(user_repo_map)
86
41
  end
87
42
 
88
43
  def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metatadata_check = false)
@@ -108,6 +63,11 @@ module Actions
108
63
  :link
109
64
  end
110
65
 
66
+ def run
67
+ smart_proxy = ::SmartProxy.find(input[:smart_proxy_id])
68
+ smart_proxy.sync_container_gateway
69
+ end
70
+
111
71
  def rescue_strategy
112
72
  Dynflow::Action::Rescue::Skip
113
73
  end
@@ -4,7 +4,8 @@ module Actions
4
4
  class IncrementalUpdates < Actions::EntryAction
5
5
  include Helpers::Presenter
6
6
 
7
- def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description)
7
+ def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description,
8
+ use_remote_execution = false)
8
9
  old_new_version_map = {}
9
10
  output_for_version_ids = []
10
11
 
@@ -28,12 +29,13 @@ module Actions
28
29
  handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description)
29
30
  end
30
31
 
31
- if hosts.any? && !content[:errata_ids].blank?
32
+ if hosts.any? && !content[:errata_ids].blank? && !use_remote_execution
32
33
  errata = ::Katello::Erratum.with_identifiers(content[:errata_ids])
33
34
  hosts = hosts.where(:id => ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
34
35
  plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, :errata_ids => content[:errata_ids])
35
36
  end
36
- plan_self(:version_outputs => output_for_version_ids)
37
+ plan_self(:version_outputs => output_for_version_ids, :host_ids => hosts.pluck(:id),
38
+ :errata_ids => content[:errata_ids], :use_remote_execution => use_remote_execution)
37
39
  end
38
40
  end
39
41
 
@@ -59,6 +61,14 @@ module Actions
59
61
  end
60
62
 
61
63
  def run
64
+ if input[:errata_ids].present? && input[:host_ids].present? && input[:use_remote_execution]
65
+ errata_ids = input[:errata_ids].join(',')
66
+ errata = ::Katello::Erratum.with_identifiers(input[:errata_ids])
67
+ hosts = ::Host.where(:id => input[:host_ids] &
68
+ ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
69
+ JobInvocationComposer.for_feature('katello_errata_install', hosts, { :errata => errata_ids }).trigger
70
+ end
71
+
62
72
  output[:changed_content] = input[:version_outputs].map do |version_output|
63
73
  {
64
74
  :content_view_version => {:id => version_output[:version_id]},
@@ -45,17 +45,12 @@ module Actions
45
45
  end
46
46
 
47
47
  def finalize
48
- # update errata applicability counts for all hosts in the CV & LE
49
- ::Katello::Host::ContentFacet.where(:content_view_id => input[:content_view_id],
50
- :lifecycle_environment_id => input[:environment_id]).each do |facet|
51
- facet.update_applicability_counts
52
- facet.update_errata_status
53
- end
48
+ environment = ::Katello::KTEnvironment.find(input[:environment_id])
49
+ ::Katello::ContentView.find(input[:content_view_id]).update_host_statuses(environment)
54
50
 
55
51
  history = ::Katello::ContentViewHistory.find(input[:history_id])
56
52
  history.status = ::Katello::ContentViewHistory::SUCCESSFUL
57
53
  history.save!
58
- environment = ::Katello::KTEnvironment.find(input[:environment_id])
59
54
 
60
55
  if !input[:incremental_update] && sync_proxies?(environment)
61
56
  ForemanTasks.async_task(ContentView::CapsuleSync,
@@ -49,13 +49,12 @@ module Actions
49
49
  plan_action(ContentView::AddToEnvironment, version, library) unless options[:skip_promotion]
50
50
  repository_mapping = plan_action(ContentViewVersion::CreateRepos, version, source_repositories).repository_mapping
51
51
  # Split Pulp 3 Yum repos out of the repository_mapping. Only Pulp 3 RPM plugin has multi repo copy support.
52
- separated_repo_map = separated_repo_mapping(repository_mapping)
52
+ separated_repo_map = separated_repo_mapping(repository_mapping, content_view.solve_dependencies)
53
53
 
54
54
  if options[:importing]
55
55
  handle_import(version, options.slice(:path, :metadata))
56
- elsif separated_repo_map[:pulp3_yum].keys.flatten.present? &&
57
- SmartProxy.pulp_primary.pulp3_support?(separated_repo_map[:pulp3_yum].keys.flatten.first)
58
- plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
56
+ elsif separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present?
57
+ plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum_multicopy], version)
59
58
  end
60
59
 
61
60
  concurrence do
@@ -194,12 +193,14 @@ module Actions
194
193
  def handle_import(version, path:, metadata:)
195
194
  sequence do
196
195
  plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::Import, version, path: path, metadata: metadata)
197
- plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
198
196
  concurrence do
199
197
  version.importable_repositories.pluck(:id).each do |id|
200
- plan_action(Katello::Repository::IndexContent, id: id)
198
+ # need to force full_indexing for these version repositories
199
+ # on import. This will then help us correctly copy version units to the library
200
+ plan_action(Katello::Repository::IndexContent, id: id, full_index: true)
201
201
  end
202
202
  end
203
+ plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
203
204
  end
204
205
  end
205
206
 
@@ -55,7 +55,7 @@ module Actions
55
55
 
56
56
  sequence do
57
57
  repository_mapping = plan_action(ContentViewVersion::CreateRepos, new_content_view_version, repos_to_clone).repository_mapping
58
- separated_repo_map = separated_repo_mapping(repository_mapping)
58
+ separated_repo_map = separated_repo_mapping(repository_mapping, true)
59
59
 
60
60
  repos_to_clone.each do |source_repos|
61
61
  plan_action(Repository::CloneToVersion,
@@ -66,8 +66,8 @@ module Actions
66
66
  end
67
67
 
68
68
  concurrence do
69
- if separated_repo_map[:pulp3_yum].keys.flatten.present?
70
- extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum], old_version)
69
+ if separated_repo_map[:pulp3_yum_multicopy].keys.flatten.present?
70
+ extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum_multicopy], old_version)
71
71
  unit_map = pulp3_content_mapping(content)
72
72
 
73
73
  unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
@@ -75,7 +75,7 @@ module Actions
75
75
  copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
76
76
  dependency_solving: dep_solve).output
77
77
  repos_to_clone.each do |source_repos|
78
- if separated_repo_map[:pulp3_yum].keys.include?(source_repos)
78
+ if separated_repo_map[:pulp3_yum_multicopy].keys.include?(source_repos)
79
79
  copy_repos(repository_mapping[source_repos])
80
80
  end
81
81
  end
@@ -16,6 +16,7 @@ module Actions
16
16
  repositories.each do |repository|
17
17
  sequence do
18
18
  repository.set_container_repository_name
19
+ repository.clear_smart_proxy_sync_histories
19
20
  plan_action(::Actions::Katello::Repository::InstanceUpdate, repository)
20
21
  plan_action(::Actions::Katello::Repository::CapsuleSync, repository)
21
22
  end
@@ -13,6 +13,7 @@ module Actions
13
13
  # rubocop:disable Metrics/MethodLength
14
14
  # rubocop:disable Metrics/CyclomaticComplexity
15
15
  # rubocop:disable Metrics/PerceivedComplexity
16
+ # rubocop:disable Metrics/AbcSize
16
17
  def run
17
18
  repo = ::Katello::Repository.find(input[:id])
18
19
  if repo.docker?
@@ -21,6 +22,10 @@ module Actions
21
22
  ::Katello::DockerManifestList.import_for_repository(repo)
22
23
  elsif repo.file?
23
24
  ::Katello::FileUnit.import_for_repository(repo)
25
+ elsif repo.generic?
26
+ repo.repository_type.content_types_to_index.each do |type|
27
+ type.model_class.import_for_repository(repo, generic_content_type: type.content_type)
28
+ end
24
29
  elsif repo.deb?
25
30
  if input[:import_upload_task] && input[:import_upload_task][:content_unit_href]
26
31
  unit_ids = [input[:import_upload_task][:content_unit_href]]
@@ -13,7 +13,7 @@ module Actions
13
13
  unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
14
14
  end
15
15
  generate_metadata = options.fetch(:generate_metadata, true)
16
- plan_action(Katello::Repository::MetadataGenerate, repository, :dependency => import_upload_task) if generate_metadata
16
+ plan_action(Katello::Repository::MetadataGenerate, repository, :dependency => import_upload_task, :force_publication => true) if generate_metadata
17
17
 
18
18
  recent_range = 5.minutes.ago.utc.iso8601
19
19
  plan_action(Katello::Repository::FilteredIndexContent,
@@ -16,7 +16,11 @@ module Actions
16
16
  generate_applicability = options.fetch(:generate_applicability, repository.yum?)
17
17
 
18
18
  options[:content_type] ||= ::Katello::RepositoryTypeManager.find(repository.content_type).default_managed_content_type.label
19
- unit_type_id = SmartProxy.pulp_primary.content_service(options[:content_type])::CONTENT_TYPE
19
+ if ::Katello::RepositoryTypeManager.generic_content_type?(options[:content_type])
20
+ unit_type_id = options[:content_type]
21
+ else
22
+ unit_type_id = SmartProxy.pulp_primary.content_service(options[:content_type])::CONTENT_TYPE
23
+ end
20
24
 
21
25
  sequence do
22
26
  upload_results = concurrence do
@@ -37,7 +41,7 @@ module Actions
37
41
  import_upload.output
38
42
  end
39
43
  end
40
- plan_action(Katello::Repository::MetadataGenerate, repository) if generate_metadata
44
+ plan_action(Katello::Repository::MetadataGenerate, repository, force_publication: true) if generate_metadata
41
45
  plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repository.id]) if generate_applicability
42
46
  plan_self(repository_id: repository.id, sync_capsule: sync_capsule, upload_results: upload_results)
43
47
  end
@@ -10,12 +10,13 @@ module Actions
10
10
  param :contents_changed
11
11
  param :matching_content
12
12
  param :source_repository_id
13
+ param :full_index
13
14
  end
14
15
 
15
16
  def run
16
17
  source_repository = ::Katello::Repository.find(input[:source_repository_id]) if input[:source_repository_id]
17
18
  repo = ::Katello::Repository.find(input[:id])
18
- repo.index_content(source_repository: source_repository)
19
+ repo.index_content(source_repository: source_repository, full_index: input[:full_index].present?)
19
20
  end
20
21
  end
21
22
  end
@@ -7,7 +7,7 @@ module Actions
7
7
  def plan(repository)
8
8
  action_subject repository
9
9
  repository.save!
10
- plan_action(::Actions::Pulp3::Orchestration::Repository::RefreshIfNeeded, repository)
10
+ plan_action(::Actions::Pulp3::Orchestration::Repository::RefreshIfNeeded, repository, SmartProxy.pulp_primary)
11
11
  plan_self(:repository_id => repository.id)
12
12
  end
13
13
 
@@ -7,9 +7,11 @@ module Actions
7
7
  source_repository ||= repository.target_repository if repository.link?
8
8
  smart_proxy = options.fetch(:smart_proxy, SmartProxy.pulp_primary)
9
9
  matching_content = options.fetch(:matching_content, false)
10
+ force_publication = options.fetch(:force_publication, false)
10
11
 
11
12
  plan_action(Pulp3::Orchestration::Repository::GenerateMetadata,
12
13
  repository, smart_proxy,
14
+ :force_publication => force_publication,
13
15
  :source_repository => source_repository,
14
16
  :matching_content => matching_content)
15
17
  end
@@ -9,7 +9,7 @@ module Actions
9
9
  sequence do
10
10
  plan_action(::Actions::Katello::Repository::MultiCloneContents, extended_repo_map,
11
11
  copy_contents: true,
12
- solve_dependencies: content_view.solve_dependencies,
12
+ solve_dependencies: true,
13
13
  metadata_generate: !incremental)
14
14
  end
15
15
  end
@@ -16,7 +16,11 @@ module Actions
16
16
  action_subject(repository)
17
17
 
18
18
  content_unit_ids = content_units.map(&:id)
19
- content_unit_type = options[:content_type] || content_units.first.class::CONTENT_TYPE
19
+ if repository.generic?
20
+ content_unit_type = options[:content_type] || content_units.first.content_type
21
+ else
22
+ content_unit_type = options[:content_type] || content_units.first.class::CONTENT_TYPE
23
+ end
20
24
  ::Katello::RepositoryTypeManager.check_content_matches_repo_type!(repository, content_unit_type)
21
25
 
22
26
  generate_applicability = options.fetch(:generate_applicability, repository.yum?)
@@ -38,7 +42,7 @@ module Actions
38
42
 
39
43
  def create_sub_plans
40
44
  trigger(Actions::Katello::Repository::MetadataGenerate,
41
- ::Katello::Repository.find(input[:repository][:id]))
45
+ ::Katello::Repository.find(input[:repository][:id]), :force_publication => true)
42
46
  end
43
47
 
44
48
  def resource_locks
@@ -18,7 +18,6 @@ module Actions
18
18
  # of Katello and we just need to finish the rest of the orchestration
19
19
  # rubocop:disable Metrics/MethodLength
20
20
  # rubocop:disable Metrics/CyclomaticComplexity
21
- # rubocop:disable Metrics/PerceivedComplexity
22
21
  def plan(repo, options = {})
23
22
  action_subject(repo)
24
23
 
@@ -54,7 +53,6 @@ module Actions
54
53
  plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id)
55
54
  plan_action(Katello::Repository::CorrectChecksum, repo)
56
55
  concurrence do
57
- plan_action(Katello::Repository::MetadataGenerate, repo, :force => true) if skip_metadata_check && repo.yum?
58
56
  plan_action(Katello::Repository::ErrataMail, repo, nil, contents_changed)
59
57
  plan_action(Actions::Katello::Applicability::Repository::Regenerate, :repo_ids => [repo.id]) if generate_applicability
60
58
  end
@@ -15,7 +15,12 @@ module Actions
15
15
  content_type ||= ::Katello::RepositoryTypeManager.find(repository.content_type).default_managed_content_type.label
16
16
  ::Katello::RepositoryTypeManager.check_content_matches_repo_type!(repository, content_type)
17
17
 
18
- unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
18
+ if ::Katello::RepositoryTypeManager.generic_content_type?(content_type)
19
+ unit_type_id = content_type
20
+ else
21
+ unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
22
+ end
23
+
19
24
  upload_actions = []
20
25
 
21
26
  generate_applicability = options.fetch(:generate_applicability, repository.yum?)