smart_proxy_container_gateway 1.0.5 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7f64eda929055e1dbf8e33f6f25797f5f01eaec99fc44c68b48cdbb54e3ac24
4
- data.tar.gz: 3b82489df2523cc112474f8f88925959123db0ea34848462dcaa3a15aa2f01f0
3
+ metadata.gz: a8a19a855d3c656839dd81438ead966b638156c97a46ea09b450ba793936267d
4
+ data.tar.gz: 88aa70dba7e9cc07697e5bc1e6b0424037f32cf8f168eaf36f2794fef7021bac
5
5
  SHA512:
6
- metadata.gz: 7275b37d4d4e2de7be47377f45790277df201752f429a3d1bea719a7f644b9a59e7b39a312f75d4b6c75d66c2ada8a21970cab2b6ee665ee11c45dfd739d2905
7
- data.tar.gz: 0f12062658a3840ddccb627e1e2ef2602e3e53b03b218684ff2f6a733504107a49329237d56f6a0b5ed6669509b422622459f84dc2c66484ddb99f5ec10bfa71
6
+ metadata.gz: f0d9dedcf24be6bfb3e1137ab99560a036d72ef795cafdcd1de0ccac18ccc60e98404edad4ef77784daca290ed9d8b70e69d1167f52b615a147f7958424b2b0b
7
+ data.tar.gz: cf2b684b36369d5f3b8213d2d57289b2ce91c2870bf5e72711ec0ede30506cbf618cf09c63e6b289a1a413dfa955b3b43a77f3f00be9961862482e36bd705bd8
@@ -25,18 +25,28 @@ module Proxy
25
25
  end
26
26
  end
27
27
 
28
- get '/v2/:repository/manifests/:tag/?' do
29
- handle_repo_auth(params, auth_header, request)
30
- redirection_location = Proxy::ContainerGateway.manifests(params[:repository], params[:tag])
28
+ get '/v2/*/manifests/*/?' do
29
+ repository = params[:splat][0]
30
+ tag = params[:splat][1]
31
+ handle_repo_auth(repository, auth_header, request)
32
+ redirection_location = Proxy::ContainerGateway.manifests(repository, tag)
31
33
  redirect to(redirection_location)
32
34
  end
33
35
 
34
- get '/v2/:repository/blobs/:digest/?' do
35
- handle_repo_auth(params, auth_header, request)
36
- redirection_location = Proxy::ContainerGateway.blobs(params[:repository], params[:digest])
36
+ get '/v2/*/blobs/*/?' do
37
+ repository = params[:splat][0]
38
+ digest = params[:splat][1]
39
+ handle_repo_auth(repository, auth_header, request)
40
+ redirection_location = Proxy::ContainerGateway.blobs(repository, digest)
37
41
  redirect to(redirection_location)
38
42
  end
39
43
 
44
+ get '/v2/*/tags/list/?' do
45
+ repository = params[:splat][0]
46
+ handle_repo_auth(repository, auth_header, request)
47
+ Proxy::ContainerGateway.tags(repository)
48
+ end
49
+
40
50
  get '/v1/search/?' do
41
51
  # Checks for podman client and issues a 404 in that case. Podman
42
52
  # examines the response from a /v1/search request. If the result
@@ -130,7 +140,7 @@ module Proxy
130
140
 
131
141
  private
132
142
 
133
- def handle_repo_auth(params, auth_header, request)
143
+ def handle_repo_auth(repository, auth_header, request)
134
144
  user_token_is_valid = false
135
145
  # FIXME: Getting unauthenticated token here...
136
146
  if auth_header.present? && auth_header.valid_user_token?
@@ -139,7 +149,7 @@ module Proxy
139
149
  end
140
150
  username = request.params['account'] if username.nil?
141
151
 
142
- return if Proxy::ContainerGateway.authorized_for_repo?(params[:repository], user_token_is_valid, username)
152
+ return if Proxy::ContainerGateway.authorized_for_repo?(repository, user_token_is_valid, username)
143
153
 
144
154
  redirect_authorization_headers
145
155
  halt 401, "unauthorized"
@@ -41,6 +41,13 @@ module Proxy
41
41
  pulp_registry_request(uri)['location']
42
42
  end
43
43
 
44
+ def tags(repository)
45
+ uri = URI.parse(
46
+ "#{Proxy::ContainerGateway::Plugin.settings.pulp_endpoint}/pulpcore_registry/v2/#{repository}/tags/list"
47
+ )
48
+ pulp_registry_request(uri).body
49
+ end
50
+
44
51
  def v1_search(params = {})
45
52
  if params[:n].nil? || params[:n] == ""
46
53
  params[:n] = 25
@@ -92,6 +99,8 @@ module Proxy
92
99
  RepositoryUser.dataset.delete
93
100
  user_repo_maps['users'].each do |user_repo_map|
94
101
  user_repo_map.each do |user, repos|
102
+ next if repos.nil?
103
+
95
104
  repos.each do |repo|
96
105
  found_repo = Repository.find(name: repo['repository'],
97
106
  auth_required: repo['auth_required'].to_s.downcase == "true")
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module ContainerGateway
3
- VERSION = '1.0.5'.freeze
3
+ VERSION = '1.0.7'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_container_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ballou
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-14 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -64,7 +64,7 @@ homepage: http://github.com/ianballou/smart_proxy_container_gateway
64
64
  licenses:
65
65
  - GPLv3
66
66
  metadata: {}
67
- post_install_message:
67
+ post_install_message:
68
68
  rdoc_options: []
69
69
  require_paths:
70
70
  - lib
@@ -79,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.0.3
83
- signing_key:
82
+ rubygems_version: 3.3.7
83
+ signing_key:
84
84
  specification_version: 4
85
85
  summary: Pulp 3 container registry support for Foreman/Katello Smart-Proxy
86
86
  test_files: []