smart_proxy_container_gateway 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18efc25667d7b93246b04af0253ff987efa2baca6d20f6b1ca7ee65f3e94dbe5
|
4
|
+
data.tar.gz: a080fe48ebe31b22c4e16df541b42f3799dbd9f555b10bdff6a5254fd7f303b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d574b549219ebe60652ae47f6af6438cb0727fb61d6063cca939295fea68d598f83f50c5d70996d8a1c208ccdec77251bdb2aac68768dd81e62def245fe884be
|
7
|
+
data.tar.gz: c9daa667b3af3337bdea2cfb7fcba4042fd8f0d8a2eb7351d71194b12e05f546f331e113ba289d8b3e0c1ab8537eb5efcf4bb59b3a2e5c44e35c7ae3d0ec27a9
|
@@ -195,29 +195,40 @@ module Proxy
|
|
195
195
|
# Insert all in a single transaction
|
196
196
|
database.connection.transaction(isolation: :serializable, retry_on: [Sequel::SerializationFailure]) do
|
197
197
|
hosts_repositories.delete
|
198
|
-
hosts_repositories.import(%i[repository_id host_id], entries)
|
198
|
+
hosts_repositories.import(%i[repository_id host_id], entries) unless entries.nil? || entries.empty?
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
202
202
|
def build_host_repository_mapping(host_repo_maps)
|
203
|
+
return [] if host_repo_maps['hosts'].nil?
|
204
|
+
|
203
205
|
hosts = database.connection[:hosts]
|
204
206
|
repositories = database.connection[:repositories]
|
207
|
+
|
205
208
|
entries = host_repo_maps['hosts'].flat_map do |host_map|
|
206
209
|
host_map.filter_map do |host_uuid, repos|
|
207
|
-
|
208
|
-
next unless host
|
209
|
-
|
210
|
-
repo_names = repos
|
211
|
-
.select { |repo| repo['auth_required'].to_s.downcase == "true" }
|
212
|
-
.map { |repo| repo['repository'] }
|
213
|
-
|
214
|
-
repositories
|
215
|
-
.where(name: repo_names, auth_required: true)
|
216
|
-
.select(:id)
|
217
|
-
.map { |repo| [repo[:id], host[:id]] }
|
210
|
+
build_host_entries(hosts, repositories, host_uuid, repos)
|
218
211
|
end
|
219
212
|
end
|
220
|
-
entries
|
213
|
+
entries&.flatten(1)&.compact
|
214
|
+
end
|
215
|
+
|
216
|
+
def build_host_entries(hosts, repositories, host_uuid, repos)
|
217
|
+
host = hosts[{ uuid: host_uuid }]
|
218
|
+
return unless host
|
219
|
+
return if repos.nil? || repos.empty?
|
220
|
+
|
221
|
+
repo_names = extract_auth_required_repo_names(repos)
|
222
|
+
repositories
|
223
|
+
.where(name: repo_names, auth_required: true)
|
224
|
+
.select(:id)
|
225
|
+
.map { |repo| [repo[:id], host[:id]] }
|
226
|
+
end
|
227
|
+
|
228
|
+
def extract_auth_required_repo_names(repos)
|
229
|
+
repos
|
230
|
+
.select { |repo| repo['auth_required'].to_s.downcase == "true" }
|
231
|
+
.map { |repo| repo['repository'] }
|
221
232
|
end
|
222
233
|
|
223
234
|
def update_host_repositories(uuid, repositories)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_container_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ballou
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
rubygems_version: 3.6.
|
119
|
+
rubygems_version: 3.6.9
|
120
120
|
specification_version: 4
|
121
121
|
summary: Pulp 3 container registry support for Foreman/Katello Smart-Proxy
|
122
122
|
test_files: []
|