katello 3.10.0.rc1.1 → 3.10.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: 1684a0dc74546bf1ae0268fec4e40a5359bb3e2b9852ecefb78b65d8d9e76ce2
4
- data.tar.gz: ead5ba3429716c8fbf2fad95040a1a4542f7d5e2b8a6b75dcacbd557c4aaef13
3
+ metadata.gz: 549f4d68cf5b318cdd905af9f64484b4b9e72c47a63e97c9762eb8d1a9bfd727
4
+ data.tar.gz: e3ffb0fc087a2af96c68197dfde40416216d0d63c89e34106b89c6bf5d4282c7
5
5
  SHA512:
6
- metadata.gz: 26f6eb57a2d9dd32ca9be6e7065d7dcd224b44ea9c765384d8ab4860e066fae4aa7dbbc8c4c49e07a9fd11ae7f733fb101cae68213a0d031612d6a266eee5f0d
7
- data.tar.gz: 31bb715ce69dd9fcb055d279fec29d1a0c3d0b327d0b0b5ea5b7501552fbd7f153247847ba794f640ad94fb2f2e720dc7bd221c7da9aec659dd3ecf79deca375
6
+ metadata.gz: 0d0d88d495d52f78327a79dc19ece1997275474e3ee33049b681540eb18242a75b0a097c272d7d61e602d4c1cb400fb86b170727b74501bfeb9595eecbdb3fe9
7
+ data.tar.gz: 9362b8d400c5424c60de7b58f99c538fe45dcba35c280204243045e110d1086fee3159e853234365d07214fcb60ba7d3c95429695f4056b87da57fa7bba21083
@@ -25,7 +25,7 @@ module Actions
25
25
  when /pool\.created/
26
26
  message_handler.import_pool
27
27
  when /pool\.deleted/
28
- message_handler.import_pool
28
+ message_handler.delete_pool
29
29
  when /^compliance\.created/
30
30
  reindex_subscription_status
31
31
  when /system_purpose_compliance\.created/
@@ -3,7 +3,7 @@ module Katello
3
3
  module Candlepin
4
4
  class Job < CandlepinResource
5
5
  class << self
6
- NOT_FINISHED_STATES = %w(CREATED PENDING RUNNING).freeze unless defined? NOT_FINISHED_STATES
6
+ NOT_FINISHED_STATES = %w(CREATED WAITING PENDING RUNNING).freeze unless defined? NOT_FINISHED_STATES
7
7
 
8
8
  def not_finished?(job)
9
9
  NOT_FINISHED_STATES.include?(job[:state])
@@ -85,6 +85,13 @@ module Katello
85
85
  ::Katello::Pool.import_pool(pool_id, index_hosts)
86
86
  end
87
87
  end
88
+
89
+ def delete_pool
90
+ if pool
91
+ Rails.logger.info "deleting pool #{pool.id} from Katello"
92
+ pool.destroy!
93
+ end
94
+ end
88
95
  end
89
96
  end
90
97
  end
@@ -19,7 +19,7 @@ child :products => :gpg_key_products do
19
19
  end
20
20
  end
21
21
 
22
- child :repositories => :gpg_key_repos do
22
+ child :root_repositories => :gpg_key_repos do
23
23
  attribute :id
24
24
  attribute :name
25
25
  attribute :content_type
@@ -40,7 +40,7 @@ child :ssl_ca_products => :ssl_ca_products do
40
40
  end
41
41
  end
42
42
 
43
- child :ssl_ca_repos => :ssl_ca_repos do
43
+ child :ssl_ca_root_repos => :ssl_ca_root_repos do
44
44
  attribute :id
45
45
  attribute :name
46
46
  attribute :content_type
@@ -61,7 +61,7 @@ child :ssl_client_products => :ssl_client_products do
61
61
  end
62
62
  end
63
63
 
64
- child :ssl_client_repos => :ssl_client_repos do
64
+ child :ssl_client_root_repos => :ssl_client_root_repos do
65
65
  attribute :id
66
66
  attribute :name
67
67
  attribute :content_type
@@ -82,7 +82,7 @@ child :ssl_key_products => :ssl_key_products do
82
82
  end
83
83
  end
84
84
 
85
- child :ssl_key_repos => :ssl_key_repos do
85
+ child :ssl_key_root_repos => :ssl_key_root_repos do
86
86
  attribute :id
87
87
  attribute :name
88
88
  attribute :content_type
@@ -4,6 +4,7 @@ UpgradeTask.define_tasks(:katello) do
4
4
  {:name => 'katello:correct_puppet_environments', :long_running => true, :skip_failure => true, :always_run => true},
5
5
  {:name => 'katello:clean_backend_objects', :long_running => true, :skip_failure => true, :always_run => true},
6
6
  {:name => 'katello:upgrades:3.8:clear_checksum_type'},
7
- {:name => 'katello:upgrades:3.9:migrate_sync_plans'}
7
+ {:name => 'katello:upgrades:3.9:migrate_sync_plans'},
8
+ {:name => 'katello:upgrades:3.10:clear_invalid_repo_credentials'}
8
9
  ]
9
10
  end
@@ -7,77 +7,75 @@
7
7
  * @description
8
8
  * Provides a BastionResource for Content Credentials.
9
9
  */
10
- angular.module('Bastion.content-credentials').factory('ContentCredential',
11
- ['BastionResource', 'CurrentOrganization',
12
- function (BastionResource, CurrentOrganization) {
10
+ angular.module("Bastion.content-credentials").factory("ContentCredential", [
11
+ "BastionResource",
12
+ "CurrentOrganization",
13
+ function(BastionResource, CurrentOrganization) {
14
+ var repoTypeMap = {
15
+ "gpg_key_repos": "GPG Key",
16
+ "ssl_ca_root_repos": "SSL CA Cert",
17
+ "ssl_client_root_repos": "SSL Client Cert",
18
+ "ssl_key_root_repos": "SSL Client Key"
19
+ };
13
20
 
14
- return BastionResource('katello/api/v2/content_credentials/:id/:action',
15
- {id: '@id', 'organization_id': CurrentOrganization},
16
- {
17
- autocomplete: {method: 'GET', isArray: true, params: {id: 'auto_complete_search'}},
18
- update: {method: 'PUT'},
19
- products: {method: 'GET', transformResponse:
20
- function (data) {
21
- var contentCredential = angular.fromJson(data);
22
- var allProducts = {};
23
- allProducts.length = 0;
24
- allProducts.products = {};
21
+ var productTypeMap = {
22
+ "gpg_key_products": "GPG Key",
23
+ "ssl_ca_products": "SSL CA Cert",
24
+ "ssl_client_products": "SSL Client Cert",
25
+ "ssl_key_products": "SSL Client Key"
26
+ };
25
27
 
26
- function collectProducts(allP, thisP, usedAs) {
27
- var key;
28
- for (key in thisP) {
29
- if (thisP.hasOwnProperty(key)) {
30
- thisP[key]["used_as"] = usedAs;
31
- allP.products[allP.length] = thisP[key];
32
- allP.length++;
33
- }
34
- }
35
- }
28
+ function appendData(allData, fullCredential, usedAs) {
29
+ angular.forEach(fullCredential, function(data) {
30
+ data.usedAs = usedAs;
31
+ allData.push(data);
32
+ });
33
+ }
36
34
 
37
- collectProducts(allProducts, contentCredential.gpg_key_products, "GPG Key");
38
- collectProducts(allProducts, contentCredential.ssl_ca_products, "SSL CA Cert");
39
- collectProducts(allProducts, contentCredential.ssl_client_products, "SSL Client Cert");
40
- collectProducts(allProducts, contentCredential.ssl_key_products, "SSL Client Key");
35
+ function parseContentCredentialData(data, typeMap) {
36
+ var contentCredential = angular.fromJson(data);
37
+ var allData = [];
38
+ _.forOwn(contentCredential, function(value, key) {
39
+ if (typeMap.hasOwnProperty(key)) {
40
+ appendData(allData, value, typeMap[key]);
41
+ }
42
+ });
43
+ return allData;
44
+ }
41
45
 
46
+ return BastionResource(
47
+ "katello/api/v2/content_credentials/:id/:action",
48
+ { "id": "@id", "organization_id": CurrentOrganization },
49
+ {
50
+ autocomplete: {
51
+ method: "GET",
52
+ isArray: true,
53
+ params: { id: "auto_complete_search" }
54
+ },
55
+ update: { method: "PUT" },
56
+ products: {
57
+ method: "GET",
58
+ transformResponse: function(data) {
59
+ var allProducts = parseContentCredentialData(data, productTypeMap);
42
60
  return {
43
61
  total: allProducts.length,
44
62
  subtotal: allProducts.length,
45
- results: allProducts.products
63
+ results: allProducts
46
64
  };
47
65
  }
48
66
  },
49
- repositories: {method: 'GET', transformResponse:
50
- function (data) {
51
- var contentCredential = angular.fromJson(data);
52
- var allRepos = {};
53
- allRepos.length = 0;
54
- allRepos.repositories = {};
55
-
56
- function collectRepos(allR, thisR, usedAs) {
57
- var key;
58
- for (key in thisR) {
59
- if (thisR.hasOwnProperty(key)) {
60
- thisR[key]["used_as"] = usedAs;
61
- allR.repositories[allR.length] = thisR[key];
62
- allR.length++;
63
- }
64
- }
65
- }
66
-
67
- collectRepos(allRepos, contentCredential.gpg_key_repos, "GPG Key");
68
- collectRepos(allRepos, contentCredential.ssl_ca_repos, "SSL CA Cert");
69
- collectRepos(allRepos, contentCredential.ssl_client_repos, "SSL Client Cert");
70
- collectRepos(allRepos, contentCredential.ssl_key_repos, "SSL Client Key");
71
-
67
+ repositories: {
68
+ method: "GET",
69
+ transformResponse: function(data) {
70
+ var allRepos = parseContentCredentialData(data, repoTypeMap);
72
71
  return {
73
72
  total: allRepos.length,
74
73
  subtotal: allRepos.length,
75
- results: allRepos.repositories
74
+ results: allRepos
76
75
  };
77
76
  }
78
77
  }
79
78
  }
80
79
  );
81
-
82
- }]
83
- );
80
+ }
81
+ ]);
@@ -5,25 +5,32 @@
5
5
  You currently don't have any Products associated with this Content Credential.
6
6
  </span>
7
7
 
8
+ <div data-block="search">
9
+ <input type="text" class="form-control" stop-event="click"
10
+ placeholder="{{ 'Filter...' | translate }}"
11
+ ng-model="contentCredentialProductFilter"/>
12
+ </div>
13
+
14
+
8
15
  <div data-block="table">
9
16
  <table bst-table="table" class="table table-striped table-bordered">
10
17
  <thead>
11
18
  <tr bst-table-head>
12
19
  <th bst-table-column="name" sortable><span translate>Name</span></th>
13
- <th bst-table-column="used_as" sortable><span translate>Used as</span></th>
20
+ <th bst-table-column="usedAs" sortable><span translate>Used as</span></th>
14
21
  <th bst-table-column class="number-cell" translate>Repositories</th>
15
22
  </tr>
16
23
  </thead>
17
24
 
18
25
  <tbody>
19
- <tr bst-table-row ng-repeat="product in table.rows">
26
+ <tr bst-table-row ng-repeat="product in table.rows | filter:contentCredentialProductFilter">
20
27
  <td bst-table-cell>
21
28
  <a ui-sref="product.info({productId: product.id})">
22
29
  {{ product.name }}
23
30
  </a>
24
31
  </td>
25
32
  <td bst-table-cell>
26
- {{ product.used_as }}
33
+ {{ product.usedAs }}
27
34
  </td>
28
35
  <td bst-table-cell class="number-cell">
29
36
  <a ui-sref="product.repositories({productId: product.id})">
@@ -5,6 +5,12 @@
5
5
  You currently don't have any Repositories associated with this Content Credential.
6
6
  </span>
7
7
 
8
+ <div data-block="search">
9
+ <input type="text" class="form-control" stop-event="click"
10
+ placeholder="{{ 'Filter...' | translate }}"
11
+ ng-model="contentCredentialRepositoryFilter"/>
12
+ </div>
13
+
8
14
  <div data-block="table">
9
15
  <table class="table table-striped table-bordered">
10
16
  <thead>
@@ -17,7 +23,7 @@
17
23
  </thead>
18
24
 
19
25
  <tbody>
20
- <tr ng-repeat="repository in table.rows">
26
+ <tr ng-repeat="repository in table.rows | filter:contentCredentialRepositoryFilter">
21
27
  <td>
22
28
  <a ui-sref="product.repository.info({productId: repository.product.id, repositoryId: repository.id})">{{ repository.name }}</a>
23
29
  </td>
@@ -27,7 +33,7 @@
27
33
  </a>
28
34
  </td>
29
35
  <td>{{ repository.content_type }}</td>
30
- <td>{{ repository.used_as }}</td>
36
+ <td>{{ repository.usedAs }}</td>
31
37
  </tr>
32
38
  </tbody>
33
39
  </table>
@@ -146,7 +146,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostDetailsController
146
146
  var deferred = $q.defer();
147
147
 
148
148
  Organization.get({id: CurrentOrganization}, function (organization) {
149
- deferred.resolve(organization.system_purposes.role);
149
+ deferred.resolve(organization.system_purposes.roles);
150
150
  });
151
151
 
152
152
  return deferred.promise;
@@ -0,0 +1,27 @@
1
+ # Before 3.8, you could successfully edit only the username, or only the
2
+ # password, but since we added a validation now those old repos are now
3
+ # invalid. This finds those repos and clears their credentials.
4
+
5
+ namespace :katello do
6
+ namespace :upgrades do
7
+ namespace '3.10' do
8
+ desc "Clear invalid credentials for repositories"
9
+ task :clear_invalid_repo_credentials => %w(environment) do
10
+ User.current = User.anonymous_admin
11
+
12
+ # Where one, but not both, is set
13
+ root_repos = Katello::RootRepository.where('(upstream_username IS NULL AND upstream_password is NOT NULL) OR (upstream_username IS NOT NULL AND upstream_password is NULL)')
14
+
15
+ root_repos.each do |root_repo|
16
+ puts "Clearing invalid credentials for #{root_repo.label} (#{root_repo.id})"
17
+ root_repo.update_attributes(upstream_username: nil, upstream_password: nil)
18
+
19
+ root_repo.repositories.each do |repo|
20
+ puts "Refreshing repository #{repo.label} (#{repo.id})"
21
+ ForemanTasks.sync_task(::Actions::Pulp::Repository::Refresh, repo)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,24 +1,44 @@
1
1
  namespace :katello do
2
2
  namespace :upgrades do
3
3
  namespace '3.9' do
4
+ def importer_type(repo)
5
+ case repo.content_type
6
+ when Katello::Repository::YUM_TYPE
7
+ Runcible::Models::YumImporter::ID
8
+ when Katello::Repository::FILE_TYPE
9
+ Runcible::Models::IsoImporter::ID
10
+ when Katello::Repository::PUPPET_TYPE
11
+ Runcible::Models::PuppetImporter::ID
12
+ when Katello::Repository::DOCKER_TYPE
13
+ Runcible::Models::DockerImporter::ID
14
+ when Katello::Repository::OSTREE_TYPE
15
+ Runcible::Models::OstreeImporter::ID
16
+ when Katello::Repository::DEB_TYPE
17
+ Runcible::Models::DebImporter::ID
18
+ else
19
+ fail _("Unexpected repo type %s") % repo.content_type
20
+ end
21
+ end
22
+
4
23
  desc "Migrate Pulp Sync Plans to new recurring logics"
5
24
  task :migrate_sync_plans => ["environment"] do
6
25
  User.current = User.anonymous_admin
7
26
  puts "Starting recurring logic for migrated sync plans and deleting Pulp schedules"
8
27
 
9
28
  Katello::SyncPlan.find_each do |sync_plan|
10
- sync_plan.associate_recurring_logic
11
- sync_plan.save!
12
- if sync_plan.foreman_tasks_recurring_logic.state.nil?
13
- sync_plan.start_recurring_logic
14
- sync_plan.foreman_tasks_recurring_logic.enabled = false unless sync_plan.enabled
29
+ if sync_plan.foreman_tasks_recurring_logic.nil?
30
+ sync_plan.associate_recurring_logic
31
+ sync_plan.save!
32
+ if sync_plan.foreman_tasks_recurring_logic.state.nil?
33
+ sync_plan.start_recurring_logic
34
+ sync_plan.foreman_tasks_recurring_logic.enabled = false unless sync_plan.enabled
35
+ end
15
36
  end
16
-
17
37
  sync_plan.products.each do |product|
18
38
  product.repos(product.library).each do |repo_k|
19
39
  repo = ::Katello::Repository.find(repo_k.id)
20
40
  begin
21
- Katello.pulp_server.extensions.repository.remove_schedules(repo.pulp_id, repo.importer_type)
41
+ Katello.pulp_server.extensions.repository.remove_schedules(repo.pulp_id, importer_type(repo))
22
42
  rescue RestClient::ResourceNotFound
23
43
  puts "Could not update repository #{repo.id}, missing in pulp."
24
44
  end
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.10.0.rc1.1".freeze
2
+ VERSION = "3.10.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.10.0.rc1.1
4
+ version: 3.10.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: 2018-12-05 00:00:00.000000000 Z
11
+ date: 2018-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -2228,6 +2228,7 @@ files:
2228
2228
  - lib/katello/tasks/unify_hosts.rake
2229
2229
  - lib/katello/tasks/update_subscription_facet_backend_data.rake
2230
2230
  - lib/katello/tasks/upgrade_check.rake
2231
+ - lib/katello/tasks/upgrades/3.10/clear_invalid_repo_credentials.rake
2231
2232
  - lib/katello/tasks/upgrades/3.8/clear_checksum_type.rake
2232
2233
  - lib/katello/tasks/upgrades/3.9/migrate_sync_plans.rake
2233
2234
  - lib/katello/tasks/virt_who_report.rake
@@ -2655,9 +2656,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2655
2656
  version: '0'
2656
2657
  required_rubygems_version: !ruby/object:Gem::Requirement
2657
2658
  requirements:
2658
- - - ">"
2659
+ - - ">="
2659
2660
  - !ruby/object:Gem::Version
2660
- version: 1.3.1
2661
+ version: '0'
2661
2662
  requirements: []
2662
2663
  rubyforge_project:
2663
2664
  rubygems_version: 2.7.6