katello 3.12.0.rc2 → 3.12.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: d0a559345d7e312acbfda66d5aabecce6e5660d1b483939c8bcc7d5aa997c080
4
- data.tar.gz: 877fa0b949c590d3264b4d9504a03572d6831d0debdd83f968320d39c3c13bde
3
+ metadata.gz: 1014f15535a58f5e1728c5a9bb6c564a9b9a095b1efa80efa6a9f4249d56824c
4
+ data.tar.gz: f655e1161eb1767cc87b8e9de5883befe95968202ade0a29eae5912c2436e9d4
5
5
  SHA512:
6
- metadata.gz: f4b0220844a897184e3c24a8e95216500842aa73388a5207cd396f02a91a0e08fb1fc2b4084eae2f1c3acbc4ccccafb626fc319c430d80d3243a1077cee29c99
7
- data.tar.gz: 6f1187da5a113f91e04acb2c25334923bd2db31f97bc106bd8e5668fe8511def1ddf5acb827cc362603c1045f6393a2bd217917642d150af5fe7b78f305965f8
6
+ metadata.gz: 9295f9e67103e6913e61ed365389c705113ca12638a413d21020f7d596fc0ffd0063652fcd7435fa496facc62122d1f948cb713bc7f375c0b96e642002d8e204
7
+ data.tar.gz: 84f9ad06abe7182a733551da25fecfdea1857927f77b98670fc54fbe832c2455e3d5701912bb6b15e9d3d9889d675d460e159a18ea73f277d2cb4f1f8702a2bc
@@ -9,6 +9,7 @@ module Katello
9
9
  param :content_view_id, :number, :desc => N_("content view identifier"), :required => true
10
10
  param :name, String, :desc => N_("name of the puppet module")
11
11
  param :author, String, :desc => N_("author of the puppet module")
12
+ param :uuid, String, :desc => N_("uuid of the puppet module"), :deprecated => true
12
13
  param_group :search, ::Katello::Api::V2::ApiController
13
14
  def index
14
15
  respond(:collection => scoped_search(index_relation.distinct, :name, :asc))
@@ -10,7 +10,8 @@ module Actions
10
10
  organization = ::Organization.find(input[:organization_id])
11
11
  ::Katello::Product.without_auditing do
12
12
  User.as_anonymous_admin do
13
- organization.redhat_provider.import_products_from_cp
13
+ updated_content = organization.redhat_provider.import_products_from_cp.content_url_updated
14
+ ForemanTasks.async_task(Katello::Repository::UpdateContentUrls, updated_content) if updated_content.present?
14
15
  end
15
16
  end
16
17
  end
@@ -0,0 +1,17 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class UpdateContentUrls < Actions::EntryAction
5
+ def plan(content_to_update)
6
+ concurrence do
7
+ content_to_update.each do |content|
8
+ content.repositories.each do |repo|
9
+ plan_action(Katello::Repository::UpdateRedhatRepository, repo)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class UpdateMetadataSync < Actions::Base
5
+ def plan(repository)
6
+ sequence do
7
+ plan_action(Katello::Repository::MetadataGenerate, repository)
8
+ concurrence do
9
+ ::SmartProxy.with_repo(repository).each do |capsule|
10
+ next if capsule.pulp_master?
11
+ plan_action(Katello::CapsuleContent::Sync, capsule, repository_id: repository.id)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class UpdateRedhatRepository < Actions::EntryAction
5
+ def plan(repo)
6
+ action_subject repo
7
+ repo.root.update_attributes!(:url => upstream_url(repo)) if repo.library_instance?
8
+ repo.update_attributes!(relative_path: relative_path(repo))
9
+ plan_action(::Actions::Pulp::Repository::Refresh, repo)
10
+ plan_self(:repository_id => repo.id)
11
+ end
12
+
13
+ def run
14
+ repository = ::Katello::Repository.find(input[:repository_id])
15
+ ForemanTasks.async_task(Katello::Repository::UpdateMetadataSync, repository)
16
+ end
17
+
18
+ private
19
+
20
+ def relative_path(repo)
21
+ repo.generate_repo_path(repo.generate_content_path)
22
+ end
23
+
24
+ def upstream_url(repo)
25
+ repo.product.repo_url(repo.generate_content_path)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -16,16 +16,10 @@ module Actions
16
16
  add_missing_task_group(sync_plan)
17
17
  action_subject(sync_plan)
18
18
  User.as_anonymous_admin do
19
- fail _("No products in sync plan") unless sync_plan.products
20
-
21
19
  syncable_products = sync_plan.products.syncable
22
20
  syncable_roots = ::Katello::RootRepository.where(:product_id => syncable_products).has_url
23
21
 
24
- fail _("No syncable repositories found for selected products and options.") if syncable_roots.empty?
25
-
26
- plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync,
27
- syncable_roots.map(&:library_instance))
28
-
22
+ plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync, syncable_roots.map(&:library_instance)) unless syncable_roots.empty?
29
23
  plan_self(:sync_plan_name => sync_plan.name)
30
24
  end
31
25
  end
@@ -56,6 +56,11 @@ module Katello
56
56
  }
57
57
  scope :with_content, -> { with_features(PULP_FEATURE, PULP_NODE_FEATURE) }
58
58
 
59
+ def self.with_repo(repo)
60
+ joins(:capsule_lifecycle_environments).
61
+ where("#{Katello::CapsuleLifecycleEnvironment.table_name}.lifecycle_environment_id" => repo.environment_id)
62
+ end
63
+
59
64
  def self.pulp_master
60
65
  unscoped.with_features(PULP_FEATURE).first
61
66
  end
@@ -54,5 +54,13 @@ module Katello
54
54
  prod_content_importer.import
55
55
  end
56
56
  end
57
+
58
+ def can_update_to_url?(new_url)
59
+ # We need to match the substitutable variables from
60
+ # current content_url and new_url
61
+ current_subs = content_url&.scan(/\$\w+/)&.sort
62
+ new_url_subs = new_url&.scan(/\$\w+/)&.sort
63
+ current_subs == new_url_subs
64
+ end
57
65
  end
58
66
  end
@@ -136,6 +136,7 @@ module Katello
136
136
  end
137
137
  prod_content_importer.import
138
138
  self.index_subscriptions(self.organization)
139
+ prod_content_importer
139
140
  end
140
141
 
141
142
  def import_product(product_json)
@@ -117,7 +117,9 @@ module Katello
117
117
  if self.provider.provider_type == Provider::CUSTOM
118
118
  content_url.dup
119
119
  else
120
- self.provider.repository_url + content_url
120
+ path = content_url.sub(%r{^/}, '')
121
+ repo_url = self.provider.repository_url&.sub(%r{/$}, '')
122
+ "#{repo_url}/#{path}"
121
123
  end
122
124
  end
123
125
 
@@ -345,9 +345,17 @@ module Katello
345
345
  return task && task.main_action.pulp_task_id == pulp_task_id
346
346
  end
347
347
 
348
- def generate_repo_path
349
- _org, _content, content_path = (self.library_instance || self).relative_path.split("/", 3)
348
+ def generate_content_path
349
+ path = content.content_url
350
+ root.substitutions.each do |key, value|
351
+ path = path.gsub("$#{key}", value) if value
352
+ end
353
+ path
354
+ end
350
355
 
356
+ def generate_repo_path(content_path = nil)
357
+ _org, _content, content_path = (self.library_instance || self).relative_path.split("/", 3) if content_path.blank?
358
+ content_path = content_path.sub(%r|^/|, '')
351
359
  if self.environment
352
360
  cve = ContentViewEnvironment.where(:environment_id => self.environment,
353
361
  :content_view_id => self.content_view).first
@@ -20,11 +20,13 @@ module Katello
20
20
  # },
21
21
  # "enabled":false
22
22
  # }
23
+ attr_reader :content_url_updated
23
24
 
24
25
  def initialize
25
26
  @contents_to_create = []
26
27
  @product_contents_to_create = []
27
28
  @product_mapping = {}
29
+ @content_url_updated = []
28
30
  end
29
31
 
30
32
  def add_product_content(product, product_content_json)
@@ -98,8 +100,21 @@ module Katello
98
100
 
99
101
  #cannot use activerecord-improt to update content, as we rely on after_update callback
100
102
  private def update_content(content, prod_content_json)
103
+ attrs_to_update = {}
101
104
  new_name = prod_content_json[:content][:name]
102
- content.update_attributes!(:name => new_name) if content.name != new_name
105
+ attrs_to_update[:name] = new_name if content.name != new_name
106
+
107
+ new_url = prod_content_json[:content][:contentUrl]
108
+ if content.content_url != new_url
109
+ if content.can_update_to_url?(new_url)
110
+ attrs_to_update[:content_url] = new_url
111
+ @content_url_updated << content
112
+ else
113
+ Rails.logger.warn(_("Substitution Mismatch. Unable to update for content: (%{content}). From [%{content_url}] To [%{new_url}].") %
114
+ { content: content.inspect, content_url: content.content_url, new_url: new_url })
115
+ end
116
+ end
117
+ content.update_attributes!(attrs_to_update) unless attrs_to_update.blank?
103
118
  end
104
119
 
105
120
  private def update_product_content(product_content, new_enabled_value)
@@ -7,7 +7,7 @@ UpgradeTask.define_tasks(:katello) do
7
7
  {:name => 'katello:upgrades:3.10:clear_invalid_repo_credentials'},
8
8
  {:name => 'katello:upgrades:3.11:import_yum_metadata'},
9
9
  {:name => 'katello:upgrades:3.11:update_puppet_repos'},
10
- {:name => 'katello:upgrades:3.11:clear_checksum_type', :task_name => 'katello:upgrades:3.8:clear_checksum_type'}
11
-
10
+ {:name => 'katello:upgrades:3.11:clear_checksum_type', :task_name => 'katello:upgrades:3.8:clear_checksum_type'},
11
+ {:name => 'katello:upgrades:3.12:remove_pulp2_notifier'}
12
12
  ]
13
13
  end
@@ -183,7 +183,7 @@ td.row-select {
183
183
 
184
184
  .info-paragraph {
185
185
  padding-left: 0px;
186
- white-space: pre;
186
+ white-space: pre-wrap;
187
187
  }
188
188
 
189
189
  .detail:not(:last-child) {
@@ -32,7 +32,6 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
32
32
  $scope.defaultRoles = ['Red Hat Enterprise Linux Server', 'Red Hat Enterprise Linux Workstation', 'Red Hat Enterprise Linux Compute Node'];
33
33
  $scope.defaultServiceLevels = ['Self-Support', 'Standard', 'Premium'];
34
34
 
35
- $scope.purposeAddonsList = [];
36
35
  $scope.purposeAddonsCount = 0;
37
36
 
38
37
  $scope.panel = {
@@ -64,24 +63,24 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
64
63
 
65
64
  $scope.saveSubscriptionFacet = function (host) {
66
65
  var newHost = {id: host.id};
67
- var addOns = [];
68
-
69
- angular.forEach($scope.purposeAddonsList, function (addOn) {
70
- if (addOn.selected) {
71
- addOns.push(addOn.name);
72
- }
73
- });
74
66
 
75
67
  newHost['subscription_facet_attributes'] = {
76
68
  id: host.subscription_facet_attributes.id,
77
69
  autoheal: host.subscription_facet_attributes.autoheal,
78
70
  'purpose_role': host.subscription_facet_attributes.purpose_role,
79
71
  'purpose_usage': host.subscription_facet_attributes.purpose_usage,
80
- 'purpose_addons': addOns,
81
72
  'service_level': host.subscription_facet_attributes.service_level,
82
73
  'release_version': host.subscription_facet_attributes.release_version
83
74
  };
84
75
 
76
+ if ($scope.purposeAddonsList) {
77
+ newHost['subscription_facet_attributes']['purpose_addons'] = _.chain($scope.purposeAddonsList).filter(function(addOn) {
78
+ return addOn.selected;
79
+ }).map(function(addOn) {
80
+ return addOn.name;
81
+ }).value();
82
+ }
83
+
85
84
  return $scope.save(newHost, true);
86
85
  };
87
86
  // @TODO end hack
@@ -186,7 +185,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
186
185
  });
187
186
 
188
187
  angular.forEach(addOns, function (addOn) {
189
- $scope.purposeAddonsList.push({"name": addOn, "selected": $scope.host.subscription_facet_attributes.purpose_addons.indexOf(addOn) > -1});
188
+ $scope.purposeAddonsList.push({"name": addOn, "selected": purposeAddons.indexOf(addOn) > -1});
190
189
  });
191
190
 
192
191
  return $scope.purposeAddonsList;
@@ -0,0 +1,13 @@
1
+ namespace :katello do
2
+ namespace :upgrades do
3
+ namespace '3.12' do
4
+ desc "removes the unused pulp2 notifier"
5
+ task :remove_pulp2_notifier => %w(environment) do
6
+ SmartProxy.pulp_master!.pulp_api.resources.event_notifier.list.each do |notifier|
7
+ Rails.logger.info("Deleting notifier #{notifier['id']}")
8
+ SmartProxy.pulp_master!.pulp_api.resources.event_notifier.delete(notifier['id'])
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.12.0.rc2".freeze
2
+ VERSION = "3.12.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: 3.12.0.rc2
4
+ version: 3.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -745,6 +745,9 @@ files:
745
745
  - app/lib/actions/katello/repository/sync.rb
746
746
  - app/lib/actions/katello/repository/sync_hook.rb
747
747
  - app/lib/actions/katello/repository/update.rb
748
+ - app/lib/actions/katello/repository/update_content_urls.rb
749
+ - app/lib/actions/katello/repository/update_metadata_sync.rb
750
+ - app/lib/actions/katello/repository/update_redhat_repository.rb
748
751
  - app/lib/actions/katello/repository/upload_errata.rb
749
752
  - app/lib/actions/katello/repository/upload_files.rb
750
753
  - app/lib/actions/katello/repository/upload_package_group.rb
@@ -3918,6 +3921,7 @@ files:
3918
3921
  - lib/katello/tasks/upgrades/3.10/clear_invalid_repo_credentials.rake
3919
3922
  - lib/katello/tasks/upgrades/3.11/import_yum_metadata_file.rake
3920
3923
  - lib/katello/tasks/upgrades/3.11/update_puppet_repos.rake
3924
+ - lib/katello/tasks/upgrades/3.12/remove_pulp2_notifier.rake
3921
3925
  - lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake
3922
3926
  - lib/katello/tasks/virt_who_report.rake
3923
3927
  - lib/katello/url_constrained_cookie_store.rb
@@ -4348,9 +4352,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
4348
4352
  version: '0'
4349
4353
  required_rubygems_version: !ruby/object:Gem::Requirement
4350
4354
  requirements:
4351
- - - ">"
4355
+ - - ">="
4352
4356
  - !ruby/object:Gem::Version
4353
- version: 1.3.1
4357
+ version: '0'
4354
4358
  requirements: []
4355
4359
  rubyforge_project:
4356
4360
  rubygems_version: 2.7.6.2