katello 4.1.0.rc1 → 4.1.0

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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +7 -7
  3. data/app/controllers/katello/api/v2/content_exports_controller.rb +7 -7
  4. data/app/controllers/katello/api/v2/content_imports_controller.rb +2 -2
  5. data/app/controllers/katello/api/v2/errata_controller.rb +2 -23
  6. data/app/controllers/katello/api/v2/host_errata_controller.rb +5 -32
  7. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -1
  9. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +0 -1
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
  11. data/app/controllers/katello/concerns/api/v2/host_errata_extensions.rb +41 -0
  12. data/app/controllers/katello/concerns/registration_commands_controller_extensions.rb +1 -1
  13. data/app/controllers/katello/remote_execution_controller.rb +5 -9
  14. data/app/lib/actions/candlepin/abstract_async_task.rb +9 -1
  15. data/app/lib/actions/katello/agent_action.rb +8 -1
  16. data/app/lib/actions/katello/applicability/repository/regenerate.rb +10 -10
  17. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  18. data/app/lib/actions/katello/content_view/publish.rb +8 -8
  19. data/app/lib/actions/katello/content_view_version/auto_create_redhat_repositories.rb +22 -0
  20. data/app/lib/actions/katello/content_view_version/import.rb +1 -0
  21. data/app/lib/actions/katello/host/upload_package_profile.rb +1 -6
  22. data/app/lib/actions/katello/host/upload_profiles.rb +2 -41
  23. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +2 -2
  24. data/app/lib/actions/katello/repository/check_matching_content.rb +13 -14
  25. data/app/lib/actions/katello/repository/sync.rb +3 -14
  26. data/app/lib/actions/katello/repository/verify_checksum.rb +1 -1
  27. data/app/lib/actions/katello/sync_plan/run.rb +7 -2
  28. data/app/lib/actions/pulp3/content_guard/refresh.rb +6 -10
  29. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +2 -1
  30. data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +1 -1
  31. data/app/lib/actions/pulp3/repository/save_version.rb +1 -0
  32. data/app/lib/katello/agent/client_message_handler.rb +11 -3
  33. data/app/lib/katello/concerns/base_template_scope_extensions.rb +34 -14
  34. data/app/lib/katello/errors.rb +1 -1
  35. data/app/lib/katello/event_daemon/monitor.rb +1 -0
  36. data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +6 -10
  37. data/app/lib/katello/http_resource.rb +1 -11
  38. data/app/lib/katello/util/hostgroup_facets_helper.rb +126 -0
  39. data/app/models/katello/authorization/content_view.rb +5 -9
  40. data/app/models/katello/authorization/organization.rb +4 -4
  41. data/app/models/katello/concerns/hostgroup_extensions.rb +4 -2
  42. data/app/models/katello/concerns/http_proxy_extensions.rb +1 -2
  43. data/app/models/katello/concerns/pulp_database_unit.rb +42 -0
  44. data/app/models/katello/concerns/redhat_extensions.rb +18 -10
  45. data/app/models/katello/concerns/setting_extensions.rb +1 -1
  46. data/app/models/katello/erratum.rb +0 -4
  47. data/app/models/katello/glue/candlepin/candlepin_object.rb +29 -11
  48. data/app/models/katello/glue/candlepin/pool.rb +15 -11
  49. data/app/models/katello/glue/pulp/repo.rb +0 -19
  50. data/app/models/katello/host/content_facet.rb +11 -20
  51. data/app/models/katello/host_available_module_stream.rb +4 -4
  52. data/app/models/katello/module_stream.rb +0 -4
  53. data/app/models/katello/ping.rb +2 -9
  54. data/app/models/katello/pool.rb +1 -1
  55. data/app/models/katello/repository.rb +14 -4
  56. data/app/models/katello/root_repository.rb +5 -1
  57. data/app/models/katello/rpm.rb +0 -4
  58. data/app/services/cert/certs.rb +4 -0
  59. data/app/services/katello/applicable_host_queue.rb +2 -2
  60. data/app/services/katello/pulp/yum_metadata_file.rb +6 -2
  61. data/app/services/katello/pulp3/api/content_guard.rb +39 -5
  62. data/app/services/katello/pulp3/content_view_version/export.rb +11 -2
  63. data/app/services/katello/pulp3/content_view_version/import.rb +2 -2
  64. data/app/services/katello/pulp3/content_view_version/import_validator.rb +39 -14
  65. data/app/services/katello/pulp3/content_view_version/importable_repositories.rb +23 -10
  66. data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +6 -0
  67. data/app/services/katello/pulp3/repository.rb +7 -2
  68. data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -1
  69. data/app/services/katello/pulp3/repository/apt.rb +1 -2
  70. data/app/services/katello/pulp3/repository/yum.rb +1 -0
  71. data/app/services/katello/registration_manager.rb +4 -24
  72. data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -0
  73. data/app/views/katello/api/v2/repository_sets/show.json.rabl +9 -5
  74. data/config/katello.yaml.example +0 -13
  75. data/config/routes/api/v2.rb +0 -1
  76. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +15 -1
  77. data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +18 -22
  78. data/db/migrate/20210512170039_add_repo_timestamps.rb +6 -0
  79. data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +11 -0
  80. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js +1 -6
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +2 -1
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +26 -27
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-module-streams-modal.controller.js +1 -3
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +1 -5
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-host-bulk-module-streams-modal.html +1 -1
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +2 -2
  87. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +7 -2
  88. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +5 -2
  89. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +1 -1
  90. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +1 -1
  91. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +2 -2
  92. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +1 -1
  93. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +7 -2
  94. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +2 -2
  95. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +1 -1
  96. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +5 -10
  97. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +11 -4
  98. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +4 -13
  99. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +10 -9
  100. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +6 -9
  101. data/lib/katello.rb +1 -1
  102. data/lib/katello/engine.rb +0 -2
  103. data/lib/katello/permission_creator.rb +7 -14
  104. data/lib/katello/plugin.rb +9 -0
  105. data/lib/katello/tasks/clean_backend_objects.rake +0 -25
  106. data/lib/katello/tasks/fix_hostgroup_facets.rake +8 -0
  107. data/lib/katello/tasks/upgrades/4.1/update_content_import_export_perms.rake +33 -0
  108. data/lib/katello/version.rb +1 -1
  109. data/locale/action_names.rb +39 -39
  110. data/locale/bn/katello.edit.po +114 -107
  111. data/locale/bn/katello.po +12 -6
  112. data/locale/cs/katello.edit.po +118 -115
  113. data/locale/cs/katello.po +12 -6
  114. data/locale/de/katello.edit.po +126 -136
  115. data/locale/de/katello.po +12 -6
  116. data/locale/en/katello.edit.po +114 -106
  117. data/locale/en/katello.po +12 -6
  118. data/locale/es/katello.edit.po +129 -165
  119. data/locale/es/katello.po +12 -6
  120. data/locale/fr/katello.edit.po +143 -247
  121. data/locale/fr/katello.po +13 -9
  122. data/locale/gu/katello.edit.po +114 -107
  123. data/locale/gu/katello.po +12 -6
  124. data/locale/hi/katello.edit.po +114 -107
  125. data/locale/hi/katello.po +12 -6
  126. data/locale/it/katello.edit.po +121 -131
  127. data/locale/it/katello.po +12 -6
  128. data/locale/ja/katello.edit.po +141 -229
  129. data/locale/ja/katello.po +13 -9
  130. data/locale/katello.pot +124 -114
  131. data/locale/kn/katello.edit.po +114 -107
  132. data/locale/kn/katello.po +12 -6
  133. data/locale/ko/katello.edit.po +126 -136
  134. data/locale/ko/katello.po +12 -6
  135. data/locale/mr/katello.edit.po +114 -107
  136. data/locale/mr/katello.po +12 -6
  137. data/locale/or/katello.edit.po +114 -107
  138. data/locale/or/katello.po +12 -6
  139. data/locale/pa/katello.edit.po +114 -107
  140. data/locale/pa/katello.po +12 -6
  141. data/locale/pt/katello.edit.po +114 -107
  142. data/locale/pt/katello.po +12 -6
  143. data/locale/pt_BR/katello.edit.po +129 -165
  144. data/locale/pt_BR/katello.po +12 -6
  145. data/locale/ru/katello.edit.po +126 -136
  146. data/locale/ru/katello.po +12 -6
  147. data/locale/ta/katello.edit.po +114 -107
  148. data/locale/ta/katello.po +12 -6
  149. data/locale/te/katello.edit.po +114 -107
  150. data/locale/te/katello.po +12 -6
  151. data/locale/zh_CN/katello.edit.po +140 -229
  152. data/locale/zh_CN/katello.po +13 -9
  153. data/locale/zh_TW/katello.edit.po +127 -153
  154. data/locale/zh_TW/katello.po +12 -6
  155. data/webpack/components/RoutedTabs/RoutedTabs.js +1 -1
  156. data/webpack/components/react-bootstrap-select/index.js +1 -1
  157. metadata +27 -18
  158. data/app/lib/actions/katello/host/generate_applicability.rb +0 -41
  159. data/app/lib/actions/katello/repository/import_applicability.rb +0 -25
  160. data/app/lib/actions/pulp/consumer.rb +0 -100
  161. data/app/lib/actions/pulp/consumer/create.rb +0 -19
  162. data/app/lib/actions/pulp/consumer/destroy.rb +0 -17
  163. data/app/lib/actions/pulp/consumer/generate_applicability.rb +0 -24
  164. data/app/lib/actions/pulp/consumer/update.rb +0 -20
  165. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +0 -17
  166. data/app/models/katello/events/import_host_applicability.rb +0 -16
  167. data/app/services/katello/applicable_content_helper.rb +0 -111
  168. data/app/services/katello/pulp/consumer.rb +0 -83
  169. data/app/services/katello/pulp/consumer_group.rb +0 -95
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc20921c082e7725e89028befc8b8e9469b5088304795b5cbeb4cfc9bc343866
4
- data.tar.gz: aee4945d14f0e66a96d516eb3e47ee0e93fc02d9bb7384e28f5d360646a73a88
3
+ metadata.gz: f30d037b42e387abe07cb200218782b7918735e7ae3e6eff511491914e7dc4e3
4
+ data.tar.gz: f92e5533113942c7f23d579f53dbe1474bbf68970d1ea9c53a850e98cfb7783c
5
5
  SHA512:
6
- metadata.gz: b868b400fb3a0be4e7db0755700b45b5388e4c433a447dfe335c7bc156f40b5dc557fce7553aa79fa2eaa61bb83e0ceae3c27cbb7deb2458efb15f7ac890df22
7
- data.tar.gz: 550c55ae8bec58857cfa5b75d33579f9c9de56013a58f273487fdccdf9378890f2d47ac257fdf8b2b29a89fd648cdd8e668725358b169dcf35f0277d7758e0a3
6
+ metadata.gz: 9d408e0837a5efce7541213d3631d3d5f29dc552688cc54ca025d4add697c6443e0c6974b4bae66727eee4cbc34eb9cae37f8863b125b8725d1cdc71492480c0
7
+ data.tar.gz: 8ee4d0ab24c2d2525338cf6e44f54e67416682e3ce56db109d4460dd93d5bbdac7e038fa72fa9371817fa0f5ffd75ad68c3797fac3d365610ac29e3fefd7c48d
@@ -8,8 +8,8 @@ module Katello
8
8
  api :POST, "/content_export_incrementals/version", N_("Performs an incremental-export of a content view version.")
9
9
  param :id, :number, :desc => N_("Content view version identifier"), :required => true
10
10
  param :destination_server, String, :desc => N_("Destination Server name"), :required => false
11
- param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
12
- "no greater than the specified size in megabytes."), :required => false
11
+ param :chunk_size_gb, :number, :desc => N_("Split the exported content into archives "\
12
+ "no greater than the specified size in gigabytes."), :required => false
13
13
  param :from_history_id, :number, :desc => N_("Export history identifier used for incremental export. "\
14
14
  "If not provided the most recent export history will be used."), :required => false
15
15
  param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
@@ -18,7 +18,7 @@ module Katello
18
18
  tasks = async_task(Actions::Katello::ContentViewVersion::Export,
19
19
  content_view_version: @version,
20
20
  destination_server: params[:destination_server],
21
- chunk_size: params[:chunk_size_mb],
21
+ chunk_size: params[:chunk_size_gb],
22
22
  from_history: @history,
23
23
  fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
24
24
 
@@ -28,8 +28,8 @@ module Katello
28
28
  api :POST, "/content_export_incrementals/library", N_("Performs an incremental-export of the repositories in library.")
29
29
  param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
30
30
  param :destination_server, String, :desc => N_("Destination Server name"), :required => false
31
- param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
32
- "no greater than the specified size in megabytes."), :required => false
31
+ param :chunk_size_gb, :number, :desc => N_("Split the exported content into archives "\
32
+ "no greater than the specified size in gigabytes."), :required => false
33
33
  param :from_history_id, :number, :desc => N_("Export history identifier used for incremental export. "\
34
34
  "If not provided the most recent export history will be used."), :required => false
35
35
  param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
@@ -38,7 +38,7 @@ module Katello
38
38
  tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
39
39
  @organization,
40
40
  destination_server: params[:destination_server],
41
- chunk_size: params[:chunk_size_mb],
41
+ chunk_size: params[:chunk_size_gb],
42
42
  from_history: @history,
43
43
  fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
44
44
  respond_for_async :resource => tasks
@@ -83,7 +83,7 @@ module Katello
83
83
 
84
84
  def find_exportable_organization
85
85
  find_organization
86
- unless @organization.can_export_library_content?
86
+ unless @organization.can_export_content?
87
87
  throw_resource_not_found(name: 'organization', id: params[:organization_id])
88
88
  end
89
89
  end
@@ -29,15 +29,15 @@ module Katello
29
29
  api :POST, "/content_exports/version", N_("Performs a full-export of a content view version.")
30
30
  param :id, :number, :desc => N_("Content view version identifier"), :required => true
31
31
  param :destination_server, String, :desc => N_("Destination Server name"), :required => false
32
- param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
33
- "no greater than the specified size in megabytes."), :required => false
32
+ param :chunk_size_gb, :number, :desc => N_("Split the exported content into archives "\
33
+ "no greater than the specified size in gigabytes."), :required => false
34
34
  param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
35
35
  " are unexportable. False by default."), :required => false
36
36
  def version
37
37
  tasks = async_task(::Actions::Katello::ContentViewVersion::Export,
38
38
  content_view_version: @version,
39
39
  destination_server: params[:destination_server],
40
- chunk_size: params[:chunk_size_mb],
40
+ chunk_size: params[:chunk_size_gb],
41
41
  fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
42
42
  respond_for_async :resource => tasks
43
43
  end
@@ -45,15 +45,15 @@ module Katello
45
45
  api :POST, "/content_exports/library", N_("Performs a full-export of the repositories in library.")
46
46
  param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
47
47
  param :destination_server, String, :desc => N_("Destination Server name"), :required => false
48
- param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
49
- "no greater than the specified size in megabytes."), :required => false
48
+ param :chunk_size_gb, :number, :desc => N_("Split the exported content into archives "\
49
+ "no greater than the specified size in gigabytes."), :required => false
50
50
  param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
51
51
  " are unexportable. False by default."), :required => false
52
52
  def library
53
53
  tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
54
54
  @organization,
55
55
  destination_server: params[:destination_server],
56
- chunk_size: params[:chunk_size_mb],
56
+ chunk_size: params[:chunk_size_gb],
57
57
  fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
58
58
  respond_for_async :resource => tasks
59
59
  end
@@ -67,7 +67,7 @@ module Katello
67
67
 
68
68
  def find_exportable_organization
69
69
  find_organization
70
- unless @organization.can_export_library_content?
70
+ unless @organization.can_export_content?
71
71
  throw_resource_not_found(name: 'organization', id: params[:organization_id])
72
72
  end
73
73
  end
@@ -49,7 +49,7 @@ module Katello
49
49
  private
50
50
 
51
51
  def check_authorized
52
- fail HttpErrors::Forbidden, _("Action unauthorized to be performed in this organization.") unless ContentView.importable?
52
+ fail HttpErrors::Forbidden, _("Action unauthorized to be performed in this organization.") unless @organization.can_import_content?
53
53
  end
54
54
 
55
55
  def find_default_content_view
@@ -59,7 +59,7 @@ module Katello
59
59
 
60
60
  def find_importable_organization
61
61
  find_organization
62
- throw_resource_not_found(name: 'organization', id: params[:organization_id]) unless @organization.can_import_library_content?
62
+ throw_resource_not_found(name: 'organization', id: params[:organization_id]) unless @organization.can_import_content?
63
63
  end
64
64
 
65
65
  def metadata_params
@@ -3,10 +3,8 @@ module Katello
3
3
  apipie_concern_subst(:a_resource => N_("an erratum"), :resource => "errata")
4
4
  include Katello::Concerns::Api::V2::RepositoryContentController
5
5
 
6
- before_action :find_host, :only => [:index, :available_errata]
7
- before_action :find_optional_organization, :only => [:index, :auto_complete_search, :available_errata]
8
- before_action :find_environment, :only => :available_errata
9
- before_action :find_filter, :only => :available_errata
6
+ before_action :find_host, :only => [:index]
7
+ before_action :find_optional_organization, :only => [:index, :auto_complete_search]
10
8
 
11
9
  api :GET, "/errata", N_("List errata")
12
10
  param :organization_id, :number, :desc => N_("Organization identifier")
@@ -62,25 +60,6 @@ module Katello
62
60
  collection
63
61
  end
64
62
 
65
- api :GET, "/content_view_versions/:id/available_errata", N_("Return errata that can be added to the Content View Version via an Incremental Update. Will be removed in Katello 4.1."), :deprecated => true
66
- param :id, :number, :desc => N_("Content View Version identifier"), :required => true
67
- param :organization_id, :number, :desc => N_("Organization identifier")
68
- param :content_view_filter_id, :number, :desc => N_("Content View Filter identifier")
69
- param :repository_id, :number, :desc => N_("Repository identifier")
70
- param :environment_id, :number, :desc => N_("Environment identifier")
71
- param :cve, String, :desc => N_("CVE identifier")
72
- param :host_id, :number, :desc => N_("Host id to list applicable errata for")
73
- param :errata_restrict_applicable, :bool, :desc => N_("Return errata that are applicable to one or more hosts (defaults to true if host_id is specified)")
74
- param :errata_restrict_installable, :bool, :desc => N_("Return errata that are upgradable on one or more hosts")
75
- param_group :search, Api::V2::ApiController
76
- def available_errata
77
- params[:content_view_version_id] = params[:id]
78
- find_content_view_version
79
- params[:available_for] = "content_view_version"
80
- sort_by, sort_order, options = sort_options
81
- respond_for_index(:collection => scoped_search(index_relation, sort_by, sort_order, options))
82
- end
83
-
84
63
  private
85
64
 
86
65
  def find_host
@@ -1,6 +1,7 @@
1
1
  module Katello
2
2
  class Api::V2::HostErrataController < Api::V2::ApiController
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
+ include Katello::Concerns::Api::V2::HostErrataExtensions
4
5
 
5
6
  before_action :find_host, only: :index
6
7
  before_action :find_host_editable, except: :index
@@ -52,7 +53,7 @@ module Katello
52
53
 
53
54
  api :PUT, "/hosts/:host_id/errata/apply", N_("Schedule errata for installation using katello-agent. %s") % katello_agent_deprecation_text, deprecated: true
54
55
  param :host_id, :number, :desc => N_("Host ID"), :required => true
55
- param :errata_ids, Array, :desc => N_("List of Errata ids to install. Will be removed in Katello 4.1."), :required => false, :deprecated => true
56
+ param :errata_ids, Array, :desc => N_("List of Errata ids to install. Will be removed in %s") % katello_agent_removal_release, required: false, deprecated: true
56
57
 
57
58
  param_group :bulk_errata_ids
58
59
  def apply
@@ -72,36 +73,8 @@ module Katello
72
73
  api :PUT, "/hosts/:host_id/errata/applicability", N_("Force regenerate applicability.")
73
74
  param :host_id, :number, :desc => N_("Host ID"), :required => true
74
75
  def applicability
75
- task = async_task(::Actions::Katello::Host::GenerateApplicability, [@host], false)
76
- respond_for_async :resource => task
77
- end
78
-
79
- def find_bulk_errata_ids(bulk_params)
80
- #works on a structure of param_group bulk_params and transforms it into a list of errata_ids
81
- bulk_params[:included] ||= {}
82
- bulk_params[:excluded] ||= {}
83
- @errata = []
84
-
85
- unless bulk_params[:included][:ids].blank?
86
- @errata = @host.content_facet.installable_errata.where(:errata_id => bulk_params[:included][:ids])
87
- end
88
-
89
- if bulk_params[:included][:search]
90
- search_errata = @host.content_facet.installable_errata
91
- search_errata = search_errata.search_for(bulk_params[:included][:search])
92
- if @errata.any?
93
- @errata = ::Katello::Erratum.where(errata_id: @errata).or(::Katello::Erratum.where(errata_id: search_errata))
94
- else
95
- @errata = search_errata
96
- end
97
- end
98
-
99
- @errata = @errata.where.not(errata_id: bulk_params[:excluded][:ids]) unless @errata.empty? || bulk_params[:excluded][:ids].blank?
100
-
101
- if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
102
- fail HttpErrors::BadRequest, _("No errata has been specified.")
103
- end
104
- @errata.pluck(:errata_id)
76
+ Katello::Host::ContentFacet.trigger_applicability_generation(@host.id)
77
+ respond_for_async :resource => {}
105
78
  end
106
79
 
107
80
  protected
@@ -142,7 +115,7 @@ module Katello
142
115
  fail HttpErrors::NotFound, _("Couldn't find errata ids '%s'") % missing.to_sentence if missing.any?
143
116
  @errata_ids = params[:errata_ids]
144
117
  else
145
- @errata_ids = find_bulk_errata_ids(params[:bulk_errata_ids])
118
+ @errata_ids = find_bulk_errata_ids([@host], params[:bulk_errata_ids])
146
119
  end
147
120
  end
148
121
  end
@@ -15,7 +15,7 @@ module Katello
15
15
 
16
16
  def_param_group :packages_or_groups do
17
17
  param :packages, Array, :desc => N_("List of package names"), :required => false
18
- param :groups, Array, :desc => N_("List of package group names"), :required => false
18
+ param :groups, Array, :desc => N_("List of package group names (Deprecated)"), :required => false
19
19
  end
20
20
 
21
21
  api :GET, "/hosts/:host_id/packages", N_("List packages installed on the host")
@@ -120,7 +120,7 @@ module Katello
120
120
  param :content_type, String,
121
121
  :desc => N_("The type of content. The following types are supported: 'package', 'package_group' and 'errata'."),
122
122
  :required => true
123
- param :content, Array, :desc => N_("List of content (e.g. package names, package group names or errata ids)")
123
+ param :content, Array, :desc => N_("List of content (e.g. package names, package group names (Deprecated) or errata ids)")
124
124
  def install_content
125
125
  content_action
126
126
  end
@@ -43,7 +43,6 @@ module Katello
43
43
  task = async_task(::Actions::BulkAction,
44
44
  ::Actions::Katello::Repository::Sync,
45
45
  syncable_repositories,
46
- nil,
47
46
  :skip_metadata_check => skip_metadata_check,
48
47
  :validate_contents => validate_contents)
49
48
 
@@ -286,7 +286,7 @@ module Katello
286
286
  fail HttpErrors::BadRequest, _("attempted to sync without a feed URL")
287
287
  end
288
288
 
289
- task = async_task(::Actions::Katello::Repository::Sync, @repository, nil, sync_options)
289
+ task = async_task(::Actions::Katello::Repository::Sync, @repository, sync_options)
290
290
  respond_for_async :resource => task
291
291
  rescue Errors::InvalidActionOptionError => e
292
292
  raise HttpErrors::BadRequest, e.message
@@ -0,0 +1,41 @@
1
+ module Katello
2
+ module Concerns
3
+ module Api::V2::HostErrataExtensions
4
+ extend ActiveSupport::Concern
5
+
6
+ def find_bulk_errata_ids(hosts, bulk_errata_ids)
7
+ bulk_params = ActiveSupport::JSON.decode(bulk_errata_ids).deep_symbolize_keys
8
+ bulk_params[:included] ||= {}
9
+ bulk_params[:excluded] ||= {}
10
+
11
+ if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
12
+ fail HttpErrors::BadRequest, _("No errata has been specified.")
13
+ end
14
+
15
+ #works on a structure of param_group bulk_params and transforms it into a list of errata_ids
16
+ errata = ::Katello::Erratum.installable_for_hosts(hosts)
17
+
18
+ if bulk_params[:included][:ids]
19
+ errata = errata.where(:errata_id => bulk_params[:included][:ids])
20
+ end
21
+
22
+ if bulk_params[:included][:search]
23
+ search_errata = ::Katello::Erratum.installable_for_hosts(hosts)
24
+ search_errata = search_errata.search_for(bulk_params[:included][:search])
25
+
26
+ if errata.any?
27
+ errata = errata.merge(search_errata)
28
+ else
29
+ errata = search_errata
30
+ end
31
+ end
32
+
33
+ if bulk_params[:excluded][:ids].present?
34
+ errata = errata.where.not(errata_id: bulk_params[:excluded][:ids])
35
+ end
36
+
37
+ errata.pluck(:errata_id)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -13,7 +13,7 @@ module Katello
13
13
  .where(organization_id: registration_params[:organization_id])
14
14
  .order(:name)
15
15
 
16
- data = { activationKeys: aks, lifeCycleEnvironments: lces }
16
+ data = { activationKeys: aks, lifecycleEnvironments: lces }
17
17
 
18
18
  if registration_params[:hostgroup_id].present?
19
19
  host_group = ::Hostgroup.authorized(:view_hostgroups).find(registration_params[:hostgroup_id])
@@ -2,6 +2,7 @@ module Katello
2
2
  if Katello.with_remote_execution?
3
3
  class RemoteExecutionController < JobInvocationsController
4
4
  include Concerns::Api::V2::BulkHostsExtensions
5
+ include Concerns::Api::V2::HostErrataExtensions
5
6
 
6
7
  def new
7
8
  @composer = prepare_composer
@@ -30,21 +31,16 @@ module Katello
30
31
  end
31
32
 
32
33
  def hosts
33
- host_ids = params[:host_ids].is_a?(String) ? params[:host_ids].split(',') : params[:host_ids]
34
+ bulk_host_ids = ActiveSupport::JSON.decode(params[:bulk_host_ids]).deep_symbolize_keys
34
35
 
35
- bulk_params = {
36
- included: {
37
- ids: host_ids,
38
- search: params[:scoped_search]
39
- }
40
- }
41
-
42
- find_bulk_hosts('edit_hosts', bulk_params)
36
+ find_bulk_hosts('edit_hosts', bulk_host_ids)
43
37
  end
44
38
 
45
39
  def errata_inputs
46
40
  if ::Foreman::Cast.to_bool(params[:install_all])
47
41
  Erratum.installable_for_hosts(hosts).pluck(:errata_id).join(',')
42
+ elsif params[:bulk_errata_ids]
43
+ find_bulk_errata_ids(hosts, params[:bulk_errata_ids]).join(',')
48
44
  else
49
45
  params[:name]
50
46
  end
@@ -32,7 +32,15 @@ module Actions
32
32
  private
33
33
 
34
34
  def poll_external_task
35
- ::Katello::Resources::Candlepin::Job.get(external_task[:id])
35
+ task = ::Katello::Resources::Candlepin::Job.get(external_task[:id])
36
+ check_for_errors!(task)
37
+ task
38
+ end
39
+
40
+ def check_for_errors!(task)
41
+ if task[:state] == 'FAILED'
42
+ fail ::Katello::Errors::CandlepinError, task[:resultData]
43
+ end
36
44
  end
37
45
  end
38
46
  end
@@ -49,6 +49,8 @@ module Actions
49
49
 
50
50
  schedule_timeout(timeout)
51
51
  end
52
+ when Dynflow::Action::Skip
53
+ # Do not fail and goto a paused state, instead skip and send the state to warning so we do not block other host actions
52
54
  when Dynflow::Action::Timeouts::Timeout
53
55
  process_timeout
54
56
  when 'accepted'
@@ -83,7 +85,12 @@ module Actions
83
85
  end
84
86
 
85
87
  unless history.finished?
86
- fail _("Host did not finish content action in %s seconds. The task has been cancelled.") % finish_timeout
88
+ # we could be processing the accept_timeout here
89
+ # only fail for finish_timeout unless the actual duration has elapsed
90
+ finish_limit = history.accepted_at + finish_timeout
91
+ if finish_limit < DateTime.now
92
+ fail _("Host did not finish content action in %s seconds. The task has been cancelled.") % finish_timeout
93
+ end
87
94
  end
88
95
  end
89
96
 
@@ -3,22 +3,22 @@ module Actions
3
3
  module Applicability
4
4
  module Repository
5
5
  class Regenerate < Actions::EntryAction
6
- middleware.use Actions::Middleware::ExecuteIfContentsChanged
7
-
8
6
  input_format do
9
- param :repo_id, Integer
10
- param :contents_changed
7
+ param :repo_ids, Array
11
8
  end
12
9
 
13
10
  def run
14
- host_ids = ::Katello::Repository.find(input[:repo_id]).hosts_with_applicability.pluck(:id)
15
- return if host_ids.empty?
16
-
17
- host_ids.each do |host_id|
18
- ::Katello::ApplicableHostQueue.push_host(host_id)
11
+ repos = ::Katello::Repository.where(:id => input[:repo_ids]).select do |repo|
12
+ repo.last_contents_changed >= repo.last_applicability_regen
19
13
  end
20
14
 
21
- ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
15
+ if repos.any?
16
+ host_ids = ::Katello::RootRepository.where(:id => repos.map(&:root_id)).hosts_with_applicability.pluck(:id)
17
+ ::Katello::Host::ContentFacet.trigger_applicability_generation(host_ids) unless host_ids.empty?
18
+
19
+ ::Katello::Repository.where(:id => repos.map(&:id)).update_all(:last_applicability_regen => DateTime.now)
20
+ end
21
+ output[:regenerated => repos.map(&:id)]
22
22
  end
23
23
 
24
24
  def humanized_name
@@ -39,7 +39,7 @@ module Actions
39
39
  end
40
40
 
41
41
  if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE)
42
- plan_action(Actions::Pulp3::CapsuleContent::RefreshContentGuard, smart_proxy)
42
+ plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy)
43
43
  plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
44
44
  end
45
45
  plan_action(SyncCapsule, smart_proxy, refresh_options)
@@ -135,6 +135,14 @@ module Actions
135
135
  rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to
136
136
  end
137
137
 
138
+ def content_view_version_id
139
+ input['content_view_version_id']
140
+ end
141
+
142
+ def content_view_version_name
143
+ input['content_view_version_name']
144
+ end
145
+
138
146
  private
139
147
 
140
148
  def include_other_components(override_components, content_view)
@@ -190,14 +198,6 @@ module Actions
190
198
  end
191
199
  end
192
200
 
193
- def content_view_version_id
194
- input['content_view_version_id']
195
- end
196
-
197
- def content_view_version_name
198
- input['content_view_version_name']
199
- end
200
-
201
201
  apipie :class, "A class representing #{self} object" do
202
202
  desc 'This object is available as **@object** variable in
203
203
  webhook templates when a corresponding event occures.