katello 3.15.0.1 → 3.15.1
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 +4 -4
- data/app/controllers/katello/api/v2/docker_tags_controller.rb +17 -0
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +4 -0
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +13 -0
- data/app/lib/actions/katello/pulp_selector.rb +1 -0
- data/app/lib/katello/errors.rb +6 -0
- data/app/models/katello/concerns/host_managed_extensions.rb +8 -3
- data/app/models/katello/concerns/smart_proxy_extensions.rb +13 -0
- data/app/models/katello/docker_meta_tag.rb +1 -1
- data/app/models/katello/installed_package.rb +1 -1
- data/app/services/katello/pulp/simple_package.rb +2 -2
- data/app/views/foreman/job_templates/install_errata_-_katello_ansible_default.erb +1 -1
- data/app/views/foreman/job_templates/install_group_-_katello_ansible_default.erb +1 -1
- data/app/views/foreman/job_templates/remove_group_-_katello_ansible_default.erb +1 -1
- data/app/views/foreman/job_templates/update_group_-_katello_ansible_default.erb +1 -1
- data/app/views/foreman/job_templates/update_package_-_katello_ansible_default.erb +1 -1
- data/app/views/katello/api/v2/docker_tags/_base.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +8 -0
- data/config/routes/api/v2.rb +3 -0
- data/db/migrate/20200429153103_installed_package_bad_nvrea.rb +14 -0
- data/db/migrate/20200501155054_installed_package_unique_nvrea.rb +64 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/docker-tag-environments.controller.js +10 -22
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tag-environments.html +6 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/docker-tags.controller.js +8 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/docker-tags.factory.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/views/docker-tags.html +1 -1
- data/lib/katello/permission_creator.rb +6 -1
- data/lib/katello/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0e59e380081b85056d0babdeff1cc1bf1922da00e775bf2636c8d77217a1056
|
4
|
+
data.tar.gz: 23b423ff8b50a973affd765cd9f44c5ca2ae9581539dfb5858918f16b8962092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73817fdabb0fdb4d47dd1f295858b38778dad330ad29e1b54a06c0365916217a88f421ed2cf9fa24e4f6d4ea62314a554428029879cb3b3201e38c5d7c2a957e
|
7
|
+
data.tar.gz: 210ad0aa94dfc1d1528d4430051f7d43642b85882761ebc9016eb24c81ef1b4170934f411635dccfa2f2fd2ee100e1878089267519af013353291406e1397357
|
@@ -25,6 +25,23 @@ module Katello
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
api :GET, "/docker_tags/:id/repositories", N_("List of repositories for a docker meta tag")
|
29
|
+
def repositories
|
30
|
+
tag = DockerMetaTag.find(params[:id])
|
31
|
+
|
32
|
+
if tag.repositories.size > 1 #pulp3
|
33
|
+
repos = tag.repositories.non_archived
|
34
|
+
else
|
35
|
+
repos = []
|
36
|
+
tag.related_tags.each do |related|
|
37
|
+
repos << related.repositories.non_archived
|
38
|
+
end
|
39
|
+
repos.flatten!
|
40
|
+
end
|
41
|
+
|
42
|
+
respond_with_template_collection('index', 'repositories', collection: full_result_response(repos))
|
43
|
+
end
|
44
|
+
|
28
45
|
private
|
29
46
|
|
30
47
|
def find_repositories
|
@@ -13,6 +13,19 @@ module Actions
|
|
13
13
|
Actions::Pulp3::Orchestration::OrphanCleanup::RemoveOrphans,
|
14
14
|
proxy)
|
15
15
|
end
|
16
|
+
plan_self
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
models = []
|
22
|
+
::Katello::RepositoryTypeManager.repository_types.each_value do |repo_type|
|
23
|
+
indexable_types = repo_type.content_types_to_index
|
24
|
+
models += indexable_types&.map(&:model_class)
|
25
|
+
models.select! { |model| model.many_repository_associations }
|
26
|
+
end
|
27
|
+
models.each do |model|
|
28
|
+
model.joins("left join katello_#{model.repository_association} on #{model.table_name}.id = katello_#{model.repository_association}.#{model.unit_id_field}").where("katello_#{model.repository_association}.#{model.unit_id_field} IS NULL").destroy_all
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
@@ -3,6 +3,7 @@ module Actions
|
|
3
3
|
module PulpSelector
|
4
4
|
def plan_pulp_action(backend_actions, repository, smart_proxy, *args)
|
5
5
|
fail "nil smart_proxy passed to PulpSelector" if smart_proxy.nil?
|
6
|
+
smart_proxy.fix_pulp3_capabilities(repository.content_type)
|
6
7
|
planned = plan_optional_pulp_action(backend_actions, repository, smart_proxy, *args)
|
7
8
|
fail "Could not locate an action for type #{smart_proxy.backend_service_type(repository)}" unless planned
|
8
9
|
planned
|
data/app/lib/katello/errors.rb
CHANGED
@@ -45,6 +45,12 @@ module Katello
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
class PulpcoreMissingCapabilities < StandardError
|
49
|
+
def message
|
50
|
+
_("A smart proxy seems to have been refreshed without pulpcore being running. You may want to ")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
48
54
|
class ConnectionRefusedException < StandardError; end
|
49
55
|
|
50
56
|
class MaxHostsReachedException < StandardError; end
|
@@ -106,7 +106,7 @@ module Katello
|
|
106
106
|
|
107
107
|
def import_package_profile(simple_packages)
|
108
108
|
found = import_package_profile_in_bulk(simple_packages)
|
109
|
-
sync_package_associations(found.map(&:id))
|
109
|
+
sync_package_associations(found.map(&:id).uniq)
|
110
110
|
end
|
111
111
|
|
112
112
|
def import_package_profile_in_bulk(simple_packages)
|
@@ -127,9 +127,14 @@ module Katello
|
|
127
127
|
:arch => simple_package.arch)
|
128
128
|
end
|
129
129
|
InstalledPackage.import(installed_packages, validate: false, on_duplicate_key_ignore: true)
|
130
|
+
#re-lookup all imported to pickup any duplicates/conflicts
|
131
|
+
imported = InstalledPackage.where(:nvrea => installed_packages.map(&:nvrea)).select(:id).to_a
|
130
132
|
|
131
|
-
|
132
|
-
|
133
|
+
if imported.count != installed_packages.count
|
134
|
+
Rails.logger.warn("Mismatch found in installed package insertion, expected #{installed_packages.count} but only could find #{imported.count}. This is most likley a bug.")
|
135
|
+
end
|
136
|
+
|
137
|
+
(found + imported).flatten
|
133
138
|
end
|
134
139
|
|
135
140
|
def import_enabled_repositories(repos)
|
@@ -152,6 +152,19 @@ module Katello
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
def missing_pulp3_capabilities?
|
156
|
+
pulp3_enabled? && self.capabilities(PULP3_FEATURE).empty?
|
157
|
+
end
|
158
|
+
|
159
|
+
def fix_pulp3_capabilities(type)
|
160
|
+
if missing_pulp3_capabilities? && !pulp2_preferred_for_type?(type)
|
161
|
+
self.refresh
|
162
|
+
if self.capabilities(::SmartProxy::PULP3_FEATURE).empty?
|
163
|
+
fail Katello::Errors::PulpcoreMissingCapabilities
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
155
168
|
def pulp3_repository_type_support?(repository_type, check_pulp2_preferred = true)
|
156
169
|
repository_type_obj = repository_type.is_a?(String) ? Katello::RepositoryTypeManager.repository_types[repository_type] : repository_type
|
157
170
|
fail "Cannot find repository type #{repository_type}, is it enabled?" unless repository_type_obj
|
@@ -107,7 +107,7 @@ module Katello
|
|
107
107
|
if grouped
|
108
108
|
grouped_fields = "#{table_name}.name, katello_repositories.root_id"
|
109
109
|
ids = distinct.select("ON (#{grouped_fields}) #{table_name}.id").joins(:repositories)
|
110
|
-
where(:id => ids)
|
110
|
+
self.where(:id => ids)
|
111
111
|
else
|
112
112
|
self.where("#{self.table_name}.schema1_id in (#{sql}) or #{self.table_name}.schema2_id in (#{sql})")
|
113
113
|
end
|
@@ -4,8 +4,8 @@ module Katello
|
|
4
4
|
allow :nvra, :nvrea, :name
|
5
5
|
end
|
6
6
|
|
7
|
-
has_many :hosts, :through => :host_installed_packages, :class_name => "::Host"
|
8
7
|
has_many :host_installed_packages, :class_name => "Katello::HostInstalledPackage", :dependent => :destroy, :inverse_of => :installed_package
|
8
|
+
has_many :hosts, :through => :host_installed_packages, :class_name => "::Host"
|
9
9
|
|
10
10
|
scoped_search :on => :name, :complete_value => true
|
11
11
|
scoped_search :on => :nvrea
|
@@ -15,4 +15,4 @@ kind: job_template
|
|
15
15
|
%>
|
16
16
|
|
17
17
|
<% advisories = input(:errata).split(',').map { |e| "--advisory=#{e}" }.join(' ') %>
|
18
|
-
<%= render_template('Run Command - Ansible Default', :command => "yum update-minimal #{advisories}") %>
|
18
|
+
<%= render_template('Run Command - Ansible Default', :command => "yum -y update-minimal #{advisories}") %>
|
@@ -13,4 +13,4 @@ provider_type: Ansible
|
|
13
13
|
kind: job_template
|
14
14
|
%>
|
15
15
|
|
16
|
-
<%= render_template('Run Command - Ansible Default', :command => "yum group install #{input('package')}") %>
|
16
|
+
<%= render_template('Run Command - Ansible Default', :command => "yum -y group install #{input('package')}") %>
|
@@ -13,4 +13,4 @@ provider_type: Ansible
|
|
13
13
|
kind: job_template
|
14
14
|
%>
|
15
15
|
|
16
|
-
<%= render_template('Run Command - Ansible Default', :command => "yum group remove #{input('package')}") %>
|
16
|
+
<%= render_template('Run Command - Ansible Default', :command => "yum -y group remove #{input('package')}") %>
|
@@ -13,4 +13,4 @@ provider_type: Ansible
|
|
13
13
|
kind: job_template
|
14
14
|
%>
|
15
15
|
|
16
|
-
<%= render_template('Run Command - Ansible Default', :command => "yum group update #{input('package')}") %>
|
16
|
+
<%= render_template('Run Command - Ansible Default', :command => "yum -y group update #{input('package')}") %>
|
data/config/routes/api/v2.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
class InstalledPackageBadNvrea < ActiveRecord::Migration[5.2]
|
2
|
+
def up
|
3
|
+
Katello::InstalledPackage.where(:epoch => "0").find_each do |pkg|
|
4
|
+
simple = Katello::Pulp::SimplePackage.new(pkg.attributes)
|
5
|
+
if pkg.nvrea != simple.nvrea
|
6
|
+
pkg.update_column(:nvrea, simple.nvrea)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
#noop
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
class InstalledPackageUniqueNvrea < ActiveRecord::Migration[5.2]
|
2
|
+
def fix_missing_attributes
|
3
|
+
#bug in dynflow may have resulted in old code running and not properly populating fields
|
4
|
+
# This block is basically copied from 20200129172534_add_epoch_version_release_arch_to_katello_installed_packages.rb
|
5
|
+
epoch_non_0 = ::Katello::Rpm.where.not(epoch: [0, nil]).pluck(:nvra, :epoch).to_h
|
6
|
+
installed_packages = []
|
7
|
+
::Katello::InstalledPackage.where(:nvrea => nil).each do |pkg|
|
8
|
+
epoch = epoch_non_0[pkg.nvra] || "0"
|
9
|
+
|
10
|
+
attributes_hash = ::Katello::Util::Package.parse_nvrea(pkg.nvra)
|
11
|
+
attributes_hash[:epoch] = epoch
|
12
|
+
attributes_hash[:nvra] = pkg.nvra
|
13
|
+
if epoch == "0"
|
14
|
+
attributes_hash[:nvrea] = pkg.nvra
|
15
|
+
else
|
16
|
+
attributes_hash[:nvrea] = "#{pkg.name}-#{epoch}:#{attributes_hash[:version]}-"\
|
17
|
+
"#{attributes_hash[:release]}.#{attributes_hash[:arch]}"
|
18
|
+
end
|
19
|
+
|
20
|
+
installed_packages << ::Katello::InstalledPackage.new(attributes_hash)
|
21
|
+
end
|
22
|
+
::Katello::InstalledPackage.import(installed_packages, validate: false, batch_size: 50_000,
|
23
|
+
on_duplicate_key_update: {conflict_target: [:nvra],
|
24
|
+
columns: [:nvrea, :epoch, :version, :release, :arch]})
|
25
|
+
end
|
26
|
+
|
27
|
+
def consolidate_duplicate_nvreas
|
28
|
+
host_installed_packages = []
|
29
|
+
deletable_installed_package_ids = []
|
30
|
+
Katello::InstalledPackage.having('count(nvrea) > 1').group(:nvrea).pluck(:nvrea).each do |nvrea|
|
31
|
+
found = Katello::InstalledPackage.includes(:host_installed_packages).where(:nvrea => nvrea).to_a
|
32
|
+
to_keep = found.pop
|
33
|
+
found.each do |duplicate|
|
34
|
+
duplicate.host_ids.each do |host_id|
|
35
|
+
host_installed_packages << {:installed_package_id => to_keep.id, :host_id => host_id}
|
36
|
+
end
|
37
|
+
deletable_installed_package_ids << duplicate.id
|
38
|
+
end
|
39
|
+
end
|
40
|
+
if host_installed_packages.any?
|
41
|
+
Katello::HostInstalledPackage.import(host_installed_packages, validate: false, on_duplicate_key_ignore: true)
|
42
|
+
end
|
43
|
+
if deletable_installed_package_ids.any?
|
44
|
+
Katello::HostInstalledPackage.where(installed_package_id: deletable_installed_package_ids).delete_all
|
45
|
+
Katello::InstalledPackage.where(id: deletable_installed_package_ids).delete_all
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def up
|
50
|
+
fix_missing_attributes
|
51
|
+
#now there should be no NULL nvreas
|
52
|
+
change_column :katello_installed_packages, :nvrea, :string, :null => false
|
53
|
+
|
54
|
+
consolidate_duplicate_nvreas
|
55
|
+
add_index "katello_installed_packages", [:nvrea], :unique => true
|
56
|
+
remove_index "katello_installed_packages", [:nvra]
|
57
|
+
end
|
58
|
+
|
59
|
+
def down
|
60
|
+
remove_index "katello_installed_packages", [:nvrea]
|
61
|
+
add_index "katello_installed_packages", [:nvra], :unique => true
|
62
|
+
change_column :katello_installed_packages, :nvrea, :string, :null => true
|
63
|
+
end
|
64
|
+
end
|
@@ -20,36 +20,24 @@ angular.module('Bastion.docker-tags').controller('DockerTagEnvironmentsControlle
|
|
20
20
|
'sort_order': 'ASC',
|
21
21
|
'paged': false
|
22
22
|
};
|
23
|
+
|
23
24
|
var nutupane = new Nutupane(DockerTag, params, null, {disableAutoLoad: true});
|
24
25
|
|
25
26
|
var renderTable = function () {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
'sort_order': 'ASC',
|
32
|
-
'paged': false,
|
33
|
-
'ids[]': ids
|
34
|
-
};
|
35
|
-
$scope.table = nutupane.table;
|
36
|
-
nutupane.setParams(newParams);
|
37
|
-
$scope.panel.loading = false;
|
38
|
-
if (!_.isEmpty(ids)) {
|
39
|
-
nutupane.refresh();
|
40
|
-
}
|
27
|
+
params.action = 'repositories';
|
28
|
+
params.id = $scope.tag.id;
|
29
|
+
|
30
|
+
nutupane.setParams(params);
|
31
|
+
nutupane.refresh();
|
41
32
|
};
|
42
33
|
|
34
|
+
$scope.table = nutupane.table;
|
35
|
+
|
43
36
|
$scope.controllerName = 'katello_docker_tags';
|
44
37
|
|
45
|
-
|
38
|
+
$scope.tag.$promise.then(function() {
|
46
39
|
$scope.panel.loading = false;
|
47
|
-
}
|
48
|
-
|
49
|
-
if ($scope.tag && $scope.tag.related_tags) {
|
50
40
|
renderTable();
|
51
|
-
}
|
52
|
-
$scope.tag.$promise.then(renderTable);
|
53
|
-
}
|
41
|
+
});
|
54
42
|
}
|
55
43
|
]);
|
@@ -27,19 +27,19 @@
|
|
27
27
|
|
28
28
|
<tbody>
|
29
29
|
<tr bst-table-row
|
30
|
-
ng-repeat="
|
30
|
+
ng-repeat="repo in table.rows | filter:dockerTagFilter">
|
31
31
|
<td bst-table-cell>
|
32
|
-
<a ui-sref="environment.details({environmentId:
|
33
|
-
{{
|
32
|
+
<a ui-sref="environment.details({environmentId: repo.kt_environment.id})">
|
33
|
+
{{ repo.kt_environment.name }}
|
34
34
|
</a>
|
35
35
|
</td>
|
36
36
|
<td bst-table-cell>
|
37
|
-
<a ui-sref="content-view.version.docker({contentViewId:
|
38
|
-
{{
|
37
|
+
<a ui-sref="content-view.version.docker({contentViewId: repo.content_view_version.content_view_id, versionId: repo.content_view_version.id})">
|
38
|
+
{{ repo.content_view_version.name }}
|
39
39
|
</a>
|
40
40
|
</td>
|
41
41
|
<td bst-table-cell>
|
42
|
-
{{
|
42
|
+
{{ repo.full_path }}:{{ tag.name }}
|
43
43
|
</td>
|
44
44
|
</tr>
|
45
45
|
</tbody>
|
@@ -44,5 +44,13 @@ angular.module('Bastion.docker-tags').controller('DockerTagsController',
|
|
44
44
|
}
|
45
45
|
return versions.join(", ");
|
46
46
|
};
|
47
|
+
|
48
|
+
$scope.getRepositoryNames = function (tag) {
|
49
|
+
return tag.repositories.map(function(repo) {
|
50
|
+
return repo.name;
|
51
|
+
}).filter(function(item, index, names) {
|
52
|
+
return names.indexOf(item) >= index;
|
53
|
+
}).sort().join(', ');
|
54
|
+
};
|
47
55
|
}]
|
48
56
|
);
|
@@ -10,7 +10,7 @@
|
|
10
10
|
angular.module('Bastion.docker-tags').factory('DockerTag',
|
11
11
|
['BastionResource', function (BastionResource) {
|
12
12
|
|
13
|
-
return BastionResource('katello/api/v2/docker_tags/:id/',
|
13
|
+
return BastionResource('katello/api/v2/docker_tags/:id/:action/',
|
14
14
|
{id: '@id'},
|
15
15
|
{
|
16
16
|
autocomplete: {method: 'GET', isArray: true, params: {id: 'auto_complete_search'}},
|
@@ -258,7 +258,12 @@ module Katello
|
|
258
258
|
'katello/api/v2/package_groups' => [:index, :show, :auto_complete_search, :compare],
|
259
259
|
'katello/api/v2/docker_manifests' => [:index, :show, :auto_complete_search, :compare],
|
260
260
|
'katello/api/v2/docker_manifest_lists' => [:index, :show, :auto_complete_search, :compare],
|
261
|
-
'katello/api/v2/docker_tags' => [:index,
|
261
|
+
'katello/api/v2/docker_tags' => [:index,
|
262
|
+
:show,
|
263
|
+
:auto_complete_search,
|
264
|
+
:auto_complete_name,
|
265
|
+
:compare,
|
266
|
+
:repositories],
|
262
267
|
'katello/api/v2/file_units' => [:index, :show, :auto_complete_search, :compare],
|
263
268
|
'katello/api/v2/ostree_branches' => [:index, :show, :auto_complete_search, :compare],
|
264
269
|
'katello/api/v2/errata' => [:index, :show, :auto_complete_search, :compare],
|
data/lib/katello/version.rb
CHANGED
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.15.
|
4
|
+
version: 3.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- N/A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -1894,6 +1894,8 @@ files:
|
|
1894
1894
|
- db/migrate/20200121213430_katello_repository_rpms_id_big_int.rb
|
1895
1895
|
- db/migrate/20200129172534_add_epoch_version_release_arch_to_katello_installed_packages.rb
|
1896
1896
|
- db/migrate/20200402130013_add_repsoitory_docker_meta_tag_f_key.rb
|
1897
|
+
- db/migrate/20200429153103_installed_package_bad_nvrea.rb
|
1898
|
+
- db/migrate/20200501155054_installed_package_unique_nvrea.rb
|
1897
1899
|
- db/seeds.d/101-locations.rb
|
1898
1900
|
- db/seeds.d/102-organizations.rb
|
1899
1901
|
- db/seeds.d/104-proxy.rb
|