katello 4.1.0.rc2.2 → 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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +1 -1
  3. data/app/controllers/katello/api/v2/content_exports_controller.rb +1 -1
  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/remote_execution_controller.rb +5 -9
  13. data/app/lib/actions/candlepin/abstract_async_task.rb +9 -1
  14. data/app/lib/actions/katello/agent_action.rb +2 -0
  15. data/app/lib/actions/katello/applicability/repository/regenerate.rb +10 -10
  16. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  17. data/app/lib/actions/katello/host/upload_package_profile.rb +1 -6
  18. data/app/lib/actions/katello/host/upload_profiles.rb +2 -41
  19. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +2 -2
  20. data/app/lib/actions/katello/repository/check_matching_content.rb +13 -14
  21. data/app/lib/actions/katello/repository/sync.rb +3 -14
  22. data/app/lib/actions/katello/repository/verify_checksum.rb +1 -1
  23. data/app/lib/actions/katello/sync_plan/run.rb +7 -2
  24. data/app/lib/actions/pulp3/content_guard/refresh.rb +6 -10
  25. data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +1 -1
  26. data/app/lib/actions/pulp3/repository/save_version.rb +1 -0
  27. data/app/lib/katello/errors.rb +1 -1
  28. data/app/lib/katello/event_daemon/monitor.rb +1 -0
  29. data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +6 -10
  30. data/app/lib/katello/util/hostgroup_facets_helper.rb +126 -0
  31. data/app/models/katello/authorization/content_view.rb +5 -9
  32. data/app/models/katello/authorization/organization.rb +4 -4
  33. data/app/models/katello/concerns/hostgroup_extensions.rb +3 -1
  34. data/app/models/katello/concerns/pulp_database_unit.rb +42 -0
  35. data/app/models/katello/concerns/redhat_extensions.rb +18 -10
  36. data/app/models/katello/erratum.rb +0 -4
  37. data/app/models/katello/glue/pulp/repo.rb +0 -19
  38. data/app/models/katello/host/content_facet.rb +11 -20
  39. data/app/models/katello/host_available_module_stream.rb +4 -4
  40. data/app/models/katello/module_stream.rb +0 -4
  41. data/app/models/katello/ping.rb +2 -9
  42. data/app/models/katello/repository.rb +14 -4
  43. data/app/models/katello/root_repository.rb +4 -0
  44. data/app/models/katello/rpm.rb +0 -4
  45. data/app/services/cert/certs.rb +4 -0
  46. data/app/services/katello/applicable_host_queue.rb +2 -2
  47. data/app/services/katello/pulp/yum_metadata_file.rb +6 -2
  48. data/app/services/katello/pulp3/api/content_guard.rb +39 -5
  49. data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -1
  50. data/app/services/katello/pulp3/repository/yum.rb +1 -0
  51. data/app/services/katello/registration_manager.rb +4 -24
  52. data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -0
  53. data/app/views/katello/api/v2/repository_sets/show.json.rabl +9 -5
  54. data/config/katello.yaml.example +0 -13
  55. data/config/routes/api/v2.rb +0 -1
  56. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +15 -1
  57. data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +18 -22
  58. data/db/migrate/20210512170039_add_repo_timestamps.rb +6 -0
  59. data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +11 -0
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +26 -27
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-module-streams-modal.controller.js +1 -3
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +1 -5
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-host-bulk-module-streams-modal.html +1 -1
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +2 -2
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +7 -2
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +5 -2
  67. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +1 -1
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +1 -1
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +2 -2
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +1 -1
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +7 -2
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +2 -2
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +5 -10
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +3 -5
  75. data/lib/katello.rb +1 -1
  76. data/lib/katello/engine.rb +0 -2
  77. data/lib/katello/permission_creator.rb +7 -14
  78. data/lib/katello/plugin.rb +9 -0
  79. data/lib/katello/tasks/fix_hostgroup_facets.rake +8 -0
  80. data/lib/katello/tasks/upgrades/4.1/update_content_import_export_perms.rake +33 -0
  81. data/lib/katello/version.rb +1 -1
  82. data/locale/action_names.rb +39 -39
  83. data/locale/bn/katello.edit.po +114 -107
  84. data/locale/bn/katello.po +12 -6
  85. data/locale/cs/katello.edit.po +118 -115
  86. data/locale/cs/katello.po +12 -6
  87. data/locale/de/katello.edit.po +126 -136
  88. data/locale/de/katello.po +12 -6
  89. data/locale/en/katello.edit.po +114 -106
  90. data/locale/en/katello.po +12 -6
  91. data/locale/es/katello.edit.po +129 -165
  92. data/locale/es/katello.po +12 -6
  93. data/locale/fr/katello.edit.po +143 -247
  94. data/locale/fr/katello.po +13 -9
  95. data/locale/gu/katello.edit.po +114 -107
  96. data/locale/gu/katello.po +12 -6
  97. data/locale/hi/katello.edit.po +114 -107
  98. data/locale/hi/katello.po +12 -6
  99. data/locale/it/katello.edit.po +121 -131
  100. data/locale/it/katello.po +12 -6
  101. data/locale/ja/katello.edit.po +141 -229
  102. data/locale/ja/katello.po +13 -9
  103. data/locale/katello.pot +124 -114
  104. data/locale/kn/katello.edit.po +114 -107
  105. data/locale/kn/katello.po +12 -6
  106. data/locale/ko/katello.edit.po +126 -136
  107. data/locale/ko/katello.po +12 -6
  108. data/locale/mr/katello.edit.po +114 -107
  109. data/locale/mr/katello.po +12 -6
  110. data/locale/or/katello.edit.po +114 -107
  111. data/locale/or/katello.po +12 -6
  112. data/locale/pa/katello.edit.po +114 -107
  113. data/locale/pa/katello.po +12 -6
  114. data/locale/pt/katello.edit.po +114 -107
  115. data/locale/pt/katello.po +12 -6
  116. data/locale/pt_BR/katello.edit.po +129 -165
  117. data/locale/pt_BR/katello.po +12 -6
  118. data/locale/ru/katello.edit.po +126 -136
  119. data/locale/ru/katello.po +12 -6
  120. data/locale/ta/katello.edit.po +114 -107
  121. data/locale/ta/katello.po +12 -6
  122. data/locale/te/katello.edit.po +114 -107
  123. data/locale/te/katello.po +12 -6
  124. data/locale/zh_CN/katello.edit.po +140 -229
  125. data/locale/zh_CN/katello.po +13 -9
  126. data/locale/zh_TW/katello.edit.po +127 -153
  127. data/locale/zh_TW/katello.po +12 -6
  128. data/webpack/components/react-bootstrap-select/index.js +1 -1
  129. metadata +26 -18
  130. data/app/lib/actions/katello/host/generate_applicability.rb +0 -41
  131. data/app/lib/actions/katello/repository/import_applicability.rb +0 -25
  132. data/app/lib/actions/pulp/consumer.rb +0 -100
  133. data/app/lib/actions/pulp/consumer/create.rb +0 -19
  134. data/app/lib/actions/pulp/consumer/destroy.rb +0 -17
  135. data/app/lib/actions/pulp/consumer/generate_applicability.rb +0 -24
  136. data/app/lib/actions/pulp/consumer/update.rb +0 -20
  137. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +0 -17
  138. data/app/models/katello/events/import_host_applicability.rb +0 -16
  139. data/app/services/katello/applicable_content_helper.rb +0 -111
  140. data/app/services/katello/pulp/consumer.rb +0 -83
  141. data/app/services/katello/pulp/consumer_group.rb +0 -95
@@ -1,20 +0,0 @@
1
- module Actions
2
- module Pulp
3
- module Consumer
4
- class Update < Pulp::Abstract
5
- input_format do
6
- param :uuid, String
7
- param :display_name, String
8
- end
9
-
10
- def plan(system)
11
- plan_self(:uuid => system.uuid, :display_name => system.name)
12
- end
13
-
14
- def run
15
- ::Katello.pulp_server.extensions.consumer.update(input[:uuid], :display_name => input[:name])
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- module Actions
2
- module Pulp3
3
- module CapsuleContent
4
- class RefreshContentGuard < Pulp3::AbstractAsyncTask
5
- def plan(smart_proxy, options = {})
6
- content_guard_api = ::Katello::Pulp3::Api::ContentGuard.new(smart_proxy)
7
- content_guard_href = content_guard_api.list&.results&.first&.pulp_href
8
- if content_guard_href && options.try(:[], :update)
9
- content_guard_api.partial_update content_guard_href
10
- else
11
- content_guard_api.create
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,16 +0,0 @@
1
- module Katello
2
- module Events
3
- class ImportHostApplicability
4
- EVENT_TYPE = 'import_host_applicability'.freeze
5
-
6
- def initialize(object_id)
7
- @host = ::Host.find_by_id(object_id)
8
- Rails.logger.warn "Host not found for ID #{object_id}" if @host.nil?
9
- end
10
-
11
- def run
12
- @host.content_facet.try(:import_applicability, true) if @host
13
- end
14
- end
15
- end
16
- end
@@ -1,111 +0,0 @@
1
- module Katello
2
- class ApplicableContentHelper
3
- attr_accessor :content_facet, :content_unit_class
4
-
5
- def initialize(content_unit_class, content_facet = nil)
6
- self.content_facet = content_facet
7
- self.content_unit_class = content_unit_class
8
- end
9
-
10
- def import(partial)
11
- to_add, to_remove = applicable_differences(partial)
12
- content_facet_association_class.where(:content_facet_id => content_facet.id).delete_all unless partial
13
- ActiveRecord::Base.transaction do
14
- insert(to_add) unless to_add.blank?
15
- remove(to_remove) unless to_remove.blank?
16
- end
17
- end
18
-
19
- def installable(env = nil, content_view = nil)
20
- repos = if env && content_view
21
- Katello::Repository.in_environment(env).in_content_views([content_view])
22
- else
23
- content_facet.bound_repositories.pluck(:id)
24
- end
25
- content_facet.send(applicable_units).in_repositories(repos)
26
- end
27
-
28
- def installable_for_hosts(hosts = nil)
29
- # Main goal of this query
30
- # 1) Get me the applicable content units for these set of hosts
31
- # 2) Now further prune this list. Only include units from repos that have been "enabled" on those hosts.
32
- # In other words, prune the list to only include the units in the "bound" repositories signified by
33
- # the inner join between ContentFacetRepository and Repository<Unit>
34
-
35
- facet_repos = Katello::ContentFacetRepository.joins(:content_facet => :host).select(:repository_id)
36
- facet_content_units = content_facet_association_class.joins(:content_facet => :host).select(content_unit_association_id)
37
-
38
- if hosts
39
- hosts = ::Host.where(id: hosts) if hosts.is_a?(Array)
40
- facet_repos = facet_repos.merge(hosts).reorder(nil)
41
- facet_content_units = facet_content_units.merge(hosts).reorder(nil)
42
- end
43
-
44
- content_unit_class.joins(repository_association_units).
45
- where(repository_association_class.table_name => {:repository_id => facet_repos,
46
- content_unit_association_id => facet_content_units}).distinct
47
- end
48
-
49
- private
50
-
51
- def content_units
52
- content_unit_class.name.demodulize.pluralize.underscore.to_sym
53
- end
54
-
55
- def applicable_units
56
- "applicable_#{content_units}".to_sym
57
- end
58
-
59
- def content_unit_association_id
60
- "#{content_unit_class.name.demodulize.underscore}_id".to_sym
61
- end
62
-
63
- def content_type
64
- content_unit_class.const_get(:CONTENT_TYPE)
65
- end
66
-
67
- def content_facet_association_class
68
- # Example: ContentFacetErratum
69
- self.content_unit_class.content_facet_association_class
70
- end
71
-
72
- def content_facet_association_units
73
- content_facet_association_class.name.demodulize.pluralize.underscore.to_sym
74
- end
75
-
76
- def repository_association_class
77
- content_unit_class.repository_association_class
78
- end
79
-
80
- def repository_association_units
81
- repository_association_class.name.demodulize.pluralize.underscore.to_sym
82
- end
83
-
84
- def applicable_differences(partial)
85
- content_uuids = ::Katello::Pulp::Consumer.new(content_facet.uuid).applicable_ids(content_type)
86
- if partial
87
- consumer_uuids = content_facet.send(applicable_units).pluck("#{content_unit_class.table_name}.pulp_id")
88
- to_remove = consumer_uuids - content_uuids
89
- to_add = content_uuids - consumer_uuids
90
- else
91
- to_add = content_uuids
92
- to_remove = nil
93
- end
94
- [to_add, to_remove]
95
- end
96
-
97
- def insert(pulp_ids)
98
- applicable_ids = content_unit_class.where(:pulp_id => pulp_ids).pluck(:id)
99
- unless applicable_ids.empty?
100
- inserts = applicable_ids.map { |applicable_id| "(#{applicable_id.to_i}, #{content_facet.id.to_i})" }
101
- sql = "INSERT INTO #{content_facet_association_class.table_name} (#{content_unit_association_id}, content_facet_id) VALUES #{inserts.join(', ')}"
102
- ActiveRecord::Base.connection.execute(sql)
103
- end
104
- end
105
-
106
- def remove(pulp_ids)
107
- applicable_ids = content_unit_class.where(:pulp_id => pulp_ids).pluck(:id)
108
- content_facet_association_class.where(:content_facet_id => content_facet.id, content_unit_association_id => applicable_ids).delete_all
109
- end
110
- end
111
- end
@@ -1,83 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class Consumer
4
- include LazyAccessor
5
-
6
- attr_accessor :uuid
7
-
8
- lazy_accessor :pulp_facts, :initializer => lambda { |_s| Katello.pulp_server.extensions.consumer.retrieve(uuid) }
9
- lazy_accessor :package_profile, :initializer => lambda { |_s| fetch_package_profile }
10
- lazy_accessor :simple_packages, :initializer => (lambda do |_s|
11
- fetch_package_profile["profile"].
12
- collect { |package| Katello::Pulp::SimplePackage.new(package) }
13
- end)
14
-
15
- def initialize(uuid)
16
- self.uuid = uuid
17
- end
18
-
19
- def upload_package_profile(profile)
20
- Katello.pulp_server.extensions.consumer.upload_profile(self.uuid, 'rpm', profile)
21
- end
22
-
23
- def upload_module_stream_profile(profile)
24
- Katello.pulp_server.extensions.consumer.upload_profile(self.uuid, 'modulemd', profile)
25
- end
26
-
27
- def applicable_ids(content_unit_type)
28
- consumer_method = case content_unit_type
29
- when ::Katello::Erratum::CONTENT_TYPE
30
- :applicable_errata
31
- when ::Katello::ModuleStream::CONTENT_TYPE
32
- :applicable_module_streams
33
- else
34
- :applicable_rpms
35
- end
36
- response = Katello.pulp_server.extensions.consumer.send(consumer_method, [self.uuid])
37
- return [] if response.empty?
38
- response[0]['applicability'][content_unit_type] || []
39
- end
40
-
41
- def bind_yum_repositories(ids)
42
- bind_repos(Runcible::Models::YumDistributor.type_id, bound_yum_repositories, ids, :notify_agent => false)
43
- end
44
-
45
- def bound_yum_repositories
46
- bindings(Runcible::Models::YumDistributor.type_id)
47
- end
48
-
49
- private
50
-
51
- def bindings(type_id)
52
- bindings = Katello.pulp_server.extensions.consumer.retrieve_bindings(uuid)
53
- bindings.select { |b| b['type_id'] == type_id }.collect { |repo| repo["repo_id"] }
54
- end
55
-
56
- def bind_repos(distributor_type, existing_ids, update_ids, bind_options = {})
57
- bound_ids = existing_ids
58
- intersection = update_ids & bound_ids
59
- bind_ids = update_ids - intersection
60
- unbind_ids = bound_ids - intersection
61
-
62
- unbind_repo_ids(unbind_ids, distributor_type)
63
- bind_repo_ids(bind_ids, distributor_type, bind_options)
64
- end
65
-
66
- def unbind_repo_ids(repo_ids, distributor_type)
67
- repo_ids.each do |repo_id|
68
- Katello.pulp_server.extensions.consumer.unbind_all(uuid, repo_id, distributor_type)
69
- rescue => e
70
- Rails.logger.error "Failed to unbind repo #{repo_id}: #{e}, #{e.backtrace.join("\n")}"
71
- end
72
- end
73
-
74
- def bind_repo_ids(repo_ids, distributor_type, bind_options)
75
- repo_ids.each do |repo_id|
76
- Katello.pulp_server.extensions.consumer.bind_all(uuid, repo_id, distributor_type, bind_options)
77
- rescue => e
78
- Rails.logger.error "Failed to bind repo #{repo_id}: #{e}, #{e.backtrace.join("\n")}"
79
- end
80
- end
81
- end
82
- end
83
- end
@@ -1,95 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class ConsumerGroup
4
- attr_accessor :pulp_id, :consumer_ids
5
-
6
- def set_pulp_consumer_group
7
- Rails.logger.debug "creating pulp consumer group '#{self.pulp_id}'"
8
- Katello.pulp_server.extensions.consumer_group.create(self.pulp_id, :consumer_ids => (consumer_ids || []))
9
- rescue => e
10
- Rails.logger.error "Failed to create pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
11
- raise e
12
- end
13
-
14
- def del_pulp_consumer_group
15
- Rails.logger.debug "deleting pulp consumer group '#{self.pulp_id}'"
16
- Katello.pulp_server.extensions.consumer_group.delete(self.pulp_id)
17
- rescue => e
18
- Rails.logger.error "Failed to delete pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
19
- raise e
20
- end
21
-
22
- def install_package(packages)
23
- Rails.logger.debug "Scheduling package install for consumer group #{self.pulp_id}"
24
-
25
- Katello.pulp_server.extensions.consumer_group.install_content(self.pulp_id,
26
- 'rpm',
27
- packages,
28
- 'importkeys' => true)
29
- rescue => e
30
- Rails.logger.error "Failed to schedule package install for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
31
- raise e
32
- end
33
-
34
- def uninstall_package(packages)
35
- Rails.logger.debug "Scheduling package uninstall for consumer group #{self.pulp_id}"
36
-
37
- Katello.pulp_server.extensions.consumer_group.uninstall_content(self.pulp_id,
38
- 'rpm',
39
- packages)
40
- rescue => e
41
- Rails.logger.error "Failed to schedule package uninstall for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
42
- raise e
43
- end
44
-
45
- def update_package(packages, options = {})
46
- Rails.logger.debug "Scheduling package update for consumer group #{self.pulp_id}"
47
-
48
- options.merge!(:importkeys => true)
49
- options[:all] = true if options[:update_all]
50
- Katello.pulp_server.extensions.consumer_group.update_content(self.pulp_id,
51
- 'rpm',
52
- packages,
53
- options)
54
- rescue => e
55
- Rails.logger.error "Failed to schedule package update for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
56
- raise e
57
- end
58
-
59
- def install_package_group(groups)
60
- Rails.logger.debug "Scheduling package group install for consumer group #{self.pulp_id}"
61
-
62
- Katello.pulp_server.extensions.consumer_group.install_content(self.pulp_id,
63
- 'package_group',
64
- groups,
65
- 'importkeys' => true)
66
- rescue => e
67
- Rails.logger.error "Failed to schedule package group install for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
68
- raise e
69
- end
70
-
71
- def uninstall_package_group(groups)
72
- Rails.logger.debug "Scheduling package group uninstall for consumer group #{self.pulp_id}"
73
-
74
- Katello.pulp_server.extensions.consumer_group.uninstall_content(self.pulp_id,
75
- 'package_group',
76
- groups)
77
- rescue => e
78
- Rails.logger.error "Failed to schedule package group uninstall for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
79
- raise e
80
- end
81
-
82
- def install_consumer_errata(errata_ids)
83
- Rails.logger.debug "Scheduling errata install for consumer group #{self.pulp_id}"
84
-
85
- Katello.pulp_server.extensions.consumer_group.install_content(self.pulp_id,
86
- 'erratum',
87
- errata_ids,
88
- 'importkeys' => true)
89
- rescue => e
90
- Rails.logger.error "Failed to schedule errata install for pulp consumer group #{self.pulp_id}: #{e}, #{e.backtrace.join("\n")}"
91
- raise e
92
- end
93
- end
94
- end
95
- end