katello 4.5.0.rc2 → 4.5.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5922047abc1b1bd8649e30bbaaf5eaf2e09f09bc9abb5e1b61920c0b84b1b57b
4
- data.tar.gz: 8105c45f9d16ca034430e89224f9bb81fa95c02d38ca638268864e34a9d57e2b
3
+ metadata.gz: 687476385ef6943c54b1bbe07e424155cde7b21fc79230d3013a730cdd5d2261
4
+ data.tar.gz: 9619b38f2b5505ced4d59a6e46ce8042be4d0a95bcdabf467177554b33d48b04
5
5
  SHA512:
6
- metadata.gz: '069335f24169763ce80081693498c668a115893acb4e9c7b2a1486d54d5394f53b9d21cb6442acd6cba990f07d58e6b75f7ec0d9e32515165226fb833874a311'
7
- data.tar.gz: 22cda386e45a6d989daff56fe3897d07a75205282b2aa1e901bf7c333fd38d72869ab3dd808641a5535d8f72063c2961aa575c2420dfa51c2f98a3ab4152b28c
6
+ metadata.gz: e03d2a7fcd995895fbc94435d5bed4fae374a5a3a081ffce1bbe12f249dafa8ebba964c62c8d018419c3744ca976bcd1badada46b8bf1843e1d50842eec1cc5f
7
+ data.tar.gz: 8b0cbe4d4ce376daeae8901ac5f7fed804de075f9b89baf109a1134933d7cb6a910cc64cf9cd123d77b5b05bc14f531b80b7762e34cff1334ede4d0c138a69f6
@@ -206,21 +206,22 @@ module Katello
206
206
  search_up_to = up_to.present? ? "ended_at < \"#{up_to}\"" : nil
207
207
  search_since = since.present? ? "ended_at > \"#{since}\"" : nil
208
208
  search_result = status.present? && status != 'all' ? "result = #{status}" : nil
209
- search = [search_up_to, search_since, search_result].compact.join(' and ')
209
+ labels = 'label ^ (Actions::Katello::Host::Erratum::Install, Actions::Katello::Host::Erratum::ApplicableErrataInstall)'
210
+ select = 'foreman_tasks_tasks.*'
210
211
 
211
212
  if Katello.with_remote_execution?
212
- condition = ["state = 'stopped' AND ((label = 'Actions::RemoteExecution::RunHostJob' AND templates.id = ?) " \
213
- "OR label = 'Actions::Katello::Host::Erratum::Install' OR label = 'Actions::Katello::Host::Erratum::ApplicableErrataInstall')",
214
- RemoteExecutionFeature.feature('katello_errata_install').job_template_id]
213
+ new_labels = 'label = Actions::RemoteExecution::RunHostJob AND remote_execution_feature.label ^ (katello_errata_install, katello_errata_install_by_search)'
214
+ labels = [labels, new_labels].map { |label| "(#{label})" }.join(' OR ')
215
+ select += ',template_invocations.id AS template_invocation_id'
215
216
  else
216
- condition = "state = 'stopped' AND (label = 'Actions::Katello::Host::Erratum::Install' OR label = 'Actions::Katello::Host::Erratum::ApplicableErrataInstall')"
217
+ select += ',NULL AS template_invocation_id'
217
218
  end
218
219
 
220
+ search = [search_up_to, search_since, search_result, "state = stopped", labels].compact.join(' and ')
221
+
219
222
  tasks = load_resource(klass: ForemanTasks::Task,
220
- where: condition,
221
223
  permission: 'view_foreman_tasks',
222
- joins: 'LEFT OUTER JOIN template_invocations ON foreman_tasks_tasks.id = template_invocations.run_host_job_task_id LEFT OUTER JOIN templates ON template_invocations.template_id = templates.id',
223
- select: 'foreman_tasks_tasks.*,template_invocations.id AS template_invocation_id',
224
+ select: select,
224
225
  search: search)
225
226
  only_host_ids = ::Host.search_for(host_filter).pluck(:id) if host_filter
226
227
 
@@ -325,9 +326,21 @@ module Katello
325
326
  # Pick katello agent errata if present
326
327
  # Otherwise pick rex errata. There are multiple template inputs, such as errata, pre_script and post_script we only need the
327
328
  # errata input here.
328
- @_tasks_errata_cache[task.id] ||= agent_input.presence || TemplateInvocationInputValue.joins(:template_input)
329
- .where("template_invocation_id = ? AND template_inputs.name = ?", task.template_invocation_id, 'errata')
330
- .first.value.split(',')
329
+ @_tasks_errata_cache[task.id] ||= agent_input.presence || errata_ids_from_template_invocation(task, task_input)
330
+ end
331
+
332
+ def errata_ids_from_template_invocation(task, task_input)
333
+ if task_input.key?('job_features') && task_input['job_features'].include?('katello_errata_install_by_search')
334
+ # This may give wrong results if the template is not rendered yet
335
+ # This also will not work for jobs run before we started storing
336
+ # resolved ids in the template
337
+ script = task.execution_plan.actions[1].try(:input).try(:[], 'script') || ''
338
+ found = script.lines.find { |line| line.start_with? '# RESOLVED_ERRATA_IDS=' } || ''
339
+ (found.chomp.split('=', 2).last || '').split(',')
340
+ else
341
+ TemplateInvocationInputValue.joins(:template_input).where("template_invocation_id = ? AND template_inputs.name = ?", task.template_invocation_id, 'errata')
342
+ .first.value.split(',')
343
+ end
331
344
  end
332
345
  end
333
346
  end
@@ -5,11 +5,13 @@ module Katello
5
5
  delegate :editable?, to: :product
6
6
 
7
7
  def deletable?(remove_from_content_view_versions = true)
8
- product.editable? && (remove_from_content_view_versions || !promoted? || !self.content_views.generated_for_none.exists?)
8
+ return false unless product.editable?
9
+ remove_from_content_view_versions || !promoted? || (self.content_views.exists? && !self.content_views.generated_for_none.exists?)
9
10
  end
10
11
 
11
12
  def redhat_deletable?(remove_from_content_view_versions = false)
12
- (remove_from_content_view_versions || !self.promoted? || !self.content_views.generated_for_none.exists?) && self.product.editable?
13
+ return false unless product.editable?
14
+ remove_from_content_view_versions || !self.promoted? || (self.content_views.exists? && !self.content_views.generated_for_none.exists?)
13
15
  end
14
16
 
15
17
  def readable?
@@ -246,7 +246,6 @@ module Katello
246
246
  streams = {}
247
247
  module_streams.each do |module_stream|
248
248
  stream = AvailableModuleStream.where(name: module_stream["name"],
249
- context: module_stream["context"],
250
249
  stream: module_stream["stream"]).first_or_create!
251
250
  streams[stream.id] = module_stream
252
251
  end
@@ -42,11 +42,14 @@ module Katello
42
42
  # In other words if metadata had repos {label:foo, product: bar}
43
43
  # this would match it to the repo with the label foo and product bar
44
44
  # in the library.
45
-
46
45
  queries = metadata_map.repositories.map do |repo|
47
- if repo.redhat && repo.product.cp_id
46
+ if repo.redhat && repo.product.cp_id && repo.content&.id
48
47
  library_repositories.where("#{Katello::Product.table_name}.cp_id": repo.product.cp_id,
49
- "#{Katello::RootRepository.table_name}.label": repo.label)
48
+ "#{::Katello::RootRepository.table_name}" => {
49
+ content_id: repo.content.id,
50
+ arch: repo.arch,
51
+ major: repo.major,
52
+ minor: repo.minor })
50
53
  else
51
54
  library_repositories.where("#{Katello::Product.table_name}.label": repo.product.label,
52
55
  "#{Katello::RootRepository.table_name}.label": repo.label)
@@ -84,9 +87,13 @@ module Katello
84
87
  relation = content_view_version.importable_repositories.joins(:root, :product)
85
88
 
86
89
  metadata_map.repositories.each do |metadata_repo|
87
- if metadata_repo.redhat && metadata_repo.product.cp_id
90
+ if metadata_repo.redhat && metadata_repo.product.cp_id && metadata_repo.content&.id
88
91
  repo = relation.where("#{::Katello::Product.table_name}" => {cp_id: metadata_repo.product.cp_id},
89
- "#{::Katello::RootRepository.table_name}" => {label: metadata_repo.label}).first
92
+ "#{::Katello::RootRepository.table_name}" => {
93
+ content_id: metadata_repo.content.id,
94
+ arch: metadata_repo.arch,
95
+ major: metadata_repo.major,
96
+ minor: metadata_repo.minor}).first
90
97
  else
91
98
  repo = relation.where("#{::Katello::Product.table_name}" => {label: metadata_repo.product.label},
92
99
  "#{::Katello::RootRepository.table_name}" => {label: metadata_repo.label}).first
@@ -22,12 +22,21 @@ module Katello
22
22
  product = product_for_metadata_repo(repo)
23
23
  fail _("Unable to find product '%s' in organization '%s'" % [repo.product.label, @organization.name]) if product.blank?
24
24
 
25
- root = product.root_repositories.find { |r| r.label == repo.label }
25
+ root = product.root_repositories.find do |r|
26
+ if repo.content&.id && repo.redhat
27
+ r.content.cp_content_id == repo.content.id &&
28
+ r.arch == repo.arch &&
29
+ r.major == repo.major &&
30
+ r.minor == repo.minor
31
+ else
32
+ r.label == repo.label
33
+ end
34
+ end
35
+
26
36
  if root
27
37
  updatable << { repository: root, options: update_repo_params(repo) }
28
38
  elsif repo.redhat
29
- content = repo.content
30
- product_content = product_content_by_label(content.label)
39
+ product_content = fetch_product_content(repo.content, product)
31
40
  substitutions = {
32
41
  basearch: repo.arch,
33
42
  releasever: repo.minor
@@ -49,8 +58,14 @@ module Katello
49
58
  end
50
59
  end
51
60
 
52
- def product_content_by_label(content_label)
53
- ::Katello::Content.find_by_label(content_label)
61
+ def fetch_product_content(content_metadata, product)
62
+ query = ::Katello::Content.joins(:product_contents).where("#{Katello::ProductContent.table_name}.product_id": product.id)
63
+ table_name = Katello::Content.table_name
64
+ if content_metadata&.id
65
+ query.find_by("#{table_name}.cp_content_id": content_metadata.id)
66
+ else
67
+ query.find_by("#{table_name}.label": content_metadata.label)
68
+ end
54
69
  end
55
70
 
56
71
  def gpg_key_id(metadata_repo)
@@ -15,11 +15,12 @@ foreign_input_sets:
15
15
  exclude: action,package
16
16
  %>
17
17
 
18
+ <% advisory_ids = @host.advisory_ids(search: input("Errata search query")) %>
19
+ # RESOLVED_ERRATA_IDS=<%= advisory_ids.join(',') %>
20
+
18
21
  <% if @host.operatingsystem.family == 'Suse' -%>
19
- <% advisories = @host.advisory_ids(search: input("Errata search query")).join(' ') %>
20
- <%= render_template('Package Action - Script Default', :action => 'install -n -t patch', :package => advisories) %>
22
+ <%= render_template('Package Action - Script Default', :action => 'install -n -t patch', :package => advisory_ids.join(' ')) %>
21
23
  <% else %>
22
- <% advisory_ids = @host.advisory_ids(search: input("Errata search query")) %>
23
24
  <% raise "No errata matching given search query" if !input("Errata search query").blank? && advisory_ids.empty? %>
24
25
 
25
26
  <% advisories = advisory_ids.map { |e| "--advisory=#{e}" }.join(' ') %>
@@ -115,7 +115,7 @@ angular.module('Bastion.activation-keys').config(['$stateProvider', function ($s
115
115
  })
116
116
  .state('activation-key.copy', {
117
117
  url: '/copy',
118
- permission: 'create_activation_key',
118
+ permission: 'create_activation_keys',
119
119
  controller: 'ActivationKeyCopyController',
120
120
  templateUrl: 'activation-keys/details/views/activation-key-copy.html',
121
121
  ncyBreadcrumb: {
@@ -8,7 +8,7 @@
8
8
  <div data-block="item-actions" bst-feature-flag="custom_products">
9
9
  <span select-action-dropdown>
10
10
  <ul class="dropdown-menu dropdown-menu-right" uib-dropdown-menu role="menu">
11
- <li role="menuitem" ng-hide="denied('create_activation_key')">
11
+ <li role="menuitem" ng-hide="denied('create_activation_keys')">
12
12
  <a ui-sref="activation-key.copy" translate>
13
13
  Copy Activation Key
14
14
  </a>
@@ -45,7 +45,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostPackagesControlle
45
45
 
46
46
  $scope.updateAll = function () {
47
47
  $scope.working = true;
48
- HostPackage.updateAll({id: $scope.host.id}, $scope.openEventInfo, $scope.errorHandler);
48
+ $scope.performPackageAction('packageUpdate', '');
49
49
  };
50
50
 
51
51
  $scope.performPackageAction = function (actionType, term) {
@@ -57,9 +57,14 @@ angular.module('Bastion.content-hosts').controller('ContentHostPackagesControlle
57
57
  };
58
58
 
59
59
  $scope.performViaKatelloAgent = function (actionType, term) {
60
- var terms = term.split(/ *, */);
60
+ var terms = [];
61
+ if (term === '') {
62
+ packageActions.updateAll();
63
+ } else {
64
+ terms = term.split(/ *, */);
65
+ packageActions[actionType](terms);
66
+ }
61
67
  $scope.working = true;
62
- packageActions[actionType](terms);
63
68
  };
64
69
 
65
70
  $scope.performViaRemoteExecution = function(actionType, term, customize) {
@@ -76,6 +81,9 @@ angular.module('Bastion.content-hosts').controller('ContentHostPackagesControlle
76
81
  };
77
82
 
78
83
  packageActions = {
84
+ updateAll: function () {
85
+ HostPackage.updateAll({id: $scope.host.id}, $scope.openEventInfo, $scope.errorHandler);
86
+ },
79
87
  packageInstall: function (termList) {
80
88
  HostPackage.install({id: $scope.host.id, packages: termList}, $scope.openEventInfo, $scope.errorHandler);
81
89
  },
@@ -60,7 +60,7 @@
60
60
  <div class="form-group">
61
61
  <button class="btn btn-default" type="button"
62
62
  translate
63
- ng-disabled="remoteExecutionByDefault || !katelloAgentPresent || working"
63
+ ng-disabled="working || (!remoteExecutionPresent && !katelloAgentPresent)"
64
64
  ng-click="updateAll()">
65
65
  Update All Packages
66
66
  </button>
@@ -49,7 +49,7 @@
49
49
  <button class="btn btn-default"
50
50
  type="button"
51
51
  translate
52
- ng-disabled="remoteExecutionByDefault || working || !katelloAgentPresent"
52
+ ng-disabled="working || (!remoteExecutionPresent && !katelloAgentPresent)"
53
53
  ng-click="updateAll()">
54
54
  Update All Packages
55
55
  </button>
@@ -255,9 +255,6 @@
255
255
  </dd>
256
256
  </span>
257
257
 
258
- <dt translate>Publish via HTTPS</dt>
259
- <dd translate>Yes</dd>
260
-
261
258
  <span ng-hide="repository.content_type === 'docker' || repository.content_type === 'ansible_collection'">
262
259
  <dt translate>Unprotected</dt>
263
260
  <dd bst-edit-checkbox="repository.unprotected"
@@ -2,9 +2,14 @@ namespace :katello do
2
2
  desc 'Refresh all alternate content sources'
3
3
  task :refresh_alternate_content_sources => ["dynflow:client"] do
4
4
  User.current = User.anonymous_admin
5
- ::ForemanTasks.async_task(::Actions::BulkAction,
6
- ::Actions::Katello::AlternateContentSource::Refresh,
7
- ::Katello::AlternateContentSource.all)
8
- puts _("Alternate content source refreshing started in the background.")
5
+ alternate_content_sources = ::Katello::AlternateContentSource.all
6
+ if alternate_content_sources.present?
7
+ ::ForemanTasks.async_task(::Actions::BulkAction,
8
+ ::Actions::Katello::AlternateContentSource::Refresh,
9
+ alternate_content_sources)
10
+ puts _("Alternate content source refreshing started in the background.")
11
+ else
12
+ puts _("No alternate content sources to refresh.")
13
+ end
9
14
  end
10
15
  end
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "4.5.0.rc2".freeze
2
+ VERSION = "4.5.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katello
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0.rc2
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-09 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: 7.1.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: 7.1.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: dynflow
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -328,20 +328,20 @@ dependencies:
328
328
  requirements:
329
329
  - - ">="
330
330
  - !ruby/object:Gem::Version
331
- version: 0.12.1
331
+ version: 0.13.1
332
332
  - - "<"
333
333
  - !ruby/object:Gem::Version
334
- version: '0.13'
334
+ version: '0.14'
335
335
  type: :runtime
336
336
  prerelease: false
337
337
  version_requirements: !ruby/object:Gem::Requirement
338
338
  requirements:
339
339
  - - ">="
340
340
  - !ruby/object:Gem::Version
341
- version: 0.12.1
341
+ version: 0.13.1
342
342
  - - "<"
343
343
  - !ruby/object:Gem::Version
344
- version: '0.13'
344
+ version: '0.14'
345
345
  - !ruby/object:Gem::Dependency
346
346
  name: pulp_container_client
347
347
  requirement: !ruby/object:Gem::Requirement
@@ -5518,7 +5518,7 @@ homepage: http://www.katello.org
5518
5518
  licenses:
5519
5519
  - GPL-2.0
5520
5520
  metadata: {}
5521
- post_install_message:
5521
+ post_install_message:
5522
5522
  rdoc_options: []
5523
5523
  require_paths:
5524
5524
  - lib
@@ -5529,12 +5529,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
5529
5529
  version: '2.5'
5530
5530
  required_rubygems_version: !ruby/object:Gem::Requirement
5531
5531
  requirements:
5532
- - - ">"
5532
+ - - ">="
5533
5533
  - !ruby/object:Gem::Version
5534
- version: 1.3.1
5534
+ version: '0'
5535
5535
  requirements: []
5536
- rubygems_version: 3.1.6
5537
- signing_key:
5536
+ rubygems_version: 3.2.33
5537
+ signing_key:
5538
5538
  specification_version: 4
5539
5539
  summary: Content and Subscription Management plugin for Foreman
5540
5540
  test_files: []