smart_proxy_container_gateway 4.0.0 → 4.0.2

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: 9fcdcfa36eed1f6e070503c159281e5c72e07cfd2b78c7fd08fc67e852b2eadb
4
- data.tar.gz: 834e6422b299d6e434c0cddd2923c3fa2d548109655221d8f259ff45e3becb0f
3
+ metadata.gz: 271e1e6cb4519a3267a367bcfb454ff673031b470be686f4442906ff8d522326
4
+ data.tar.gz: b7d8d2610a9a7bb307b198bdc8e25e4d476fcee2c5e95e9d5d0aba35612448fa
5
5
  SHA512:
6
- metadata.gz: 7ef2a0fe40e712fa60e3222a707cac996b279efab0410763191cf69e24679f6cfff5ea2c07263bcb5d7bdefc196706e502d67e52c5411411bf7172a446736634
7
- data.tar.gz: 622dacf9d030aec24a60d3581bcb2dbf769bc9beb6d42a2544d0068dd70c10cddc176afe1241df22a8a34cfa29bc6db98b6a8bee650969678af2364c56786e77
6
+ metadata.gz: edadb66c3f7a9633d1e20f423d2d34a23dfac78085b1d23ed0add423bb1d1b564698e24401d3eeacf650a36d25f180d4a10158175f6590b1315d432dcf75c2ae
7
+ data.tar.gz: 880574aea904a3b8fe068b3c35250c47572ef47193be75687efdd4407c4d71dbc00a2e48b964746b5b3295f54f47858ea2c86a6c24ac107a078065690f44d068
@@ -1,27 +1,18 @@
1
- require 'uri'
2
- require 'openssl'
1
+ require 'proxy/request'
3
2
 
4
3
  module Proxy
5
4
  module ContainerGateway
6
- class ForemanApi
5
+ class ForemanApi < ::Proxy::HttpRequest::ForemanRequest
7
6
  def registry_request(auth_header, params, suffix, uuid: '', cert: false)
8
- uri = URI.join(Proxy::SETTINGS.foreman_url, Proxy::ContainerGateway::Plugin.settings.katello_registry_path, suffix)
9
- uri.query = process_params(params)
7
+ path = "#{Proxy::ContainerGateway::Plugin.settings.katello_registry_path}#{suffix}"
8
+ query = params.slice('scope', 'account').compact
10
9
 
11
- req = Net::HTTP::Get.new(uri)
12
- req.add_field('Authorization', auth_header) unless cert
13
- req.add_field('Accept', 'application/json')
14
- req.add_field('HostUUID', uuid) if cert
15
- req.content_type = 'application/json'
16
- http = Net::HTTP.new(uri.hostname, uri.port)
17
- http.use_ssl = true
10
+ headers = {}
11
+ headers['Authorization'] = auth_header unless cert
12
+ headers['HostUUID'] = uuid if cert
18
13
 
19
- http.request(req)
20
- end
21
-
22
- def process_params(params_in)
23
- params = params_in.slice('scope', 'account').compact
24
- URI.encode_www_form(params)
14
+ req = request_factory.create_get(path, query, headers)
15
+ send_request(req)
25
16
  end
26
17
 
27
18
  def fetch_token(auth_header, params)
@@ -0,0 +1,69 @@
1
+ # rubocop:disable Metrics/BlockLength
2
+ Sequel.migration do
3
+ up do
4
+ # SQLite's INTEGER type already supports 64-bit integers, skip for SQLite
5
+ # database_type returns the database adapter type (e.g., :sqlite, :postgres, :mysql)
6
+ unless database_type.to_s.include?('sqlite')
7
+ alter_table(:repositories) do
8
+ set_column_type :id, :bigint
9
+ end
10
+
11
+ alter_table(:users) do
12
+ set_column_type :id, :bigint
13
+ end
14
+
15
+ alter_table(:hosts) do
16
+ set_column_type :id, :bigint
17
+ end
18
+
19
+ alter_table(:authentication_tokens) do
20
+ set_column_type :id, :bigint
21
+ set_column_type :user_id, :bigint
22
+ end
23
+
24
+ alter_table(:repositories_users) do
25
+ set_column_type :repository_id, :bigint
26
+ set_column_type :user_id, :bigint
27
+ end
28
+
29
+ alter_table(:hosts_repositories) do
30
+ set_column_type :host_id, :bigint
31
+ set_column_type :repository_id, :bigint
32
+ end
33
+ end
34
+ end
35
+
36
+ down do
37
+ # SQLite's INTEGER type already supports 64-bit integers, skip for SQLite
38
+ # database_type returns the database adapter type (e.g., :sqlite, :postgres, :mysql)
39
+ unless database_type.to_s.include?('sqlite')
40
+ alter_table(:hosts_repositories) do
41
+ set_column_type :host_id, :integer
42
+ set_column_type :repository_id, :integer
43
+ end
44
+
45
+ alter_table(:repositories_users) do
46
+ set_column_type :repository_id, :integer
47
+ set_column_type :user_id, :integer
48
+ end
49
+
50
+ alter_table(:authentication_tokens) do
51
+ set_column_type :user_id, :integer
52
+ set_column_type :id, :integer
53
+ end
54
+
55
+ alter_table(:hosts) do
56
+ set_column_type :id, :integer
57
+ end
58
+
59
+ alter_table(:users) do
60
+ set_column_type :id, :integer
61
+ end
62
+
63
+ alter_table(:repositories) do
64
+ set_column_type :id, :integer
65
+ end
66
+ end
67
+ end
68
+ end
69
+ # rubocop:enable Metrics/BlockLength
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module ContainerGateway
3
- VERSION = '4.0.0'.freeze
3
+ VERSION = '4.0.2'.freeze
4
4
  end
5
5
  end
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: 4.0.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ballou
@@ -96,6 +96,7 @@ files:
96
96
  - lib/smart_proxy_container_gateway/sequel_migrations/003_authorization_reorg.rb
97
97
  - lib/smart_proxy_container_gateway/sequel_migrations/004_users_repositories_cascade_delete.rb
98
98
  - lib/smart_proxy_container_gateway/sequel_migrations/005_host_repositories.rb
99
+ - lib/smart_proxy_container_gateway/sequel_migrations/006_bigint_ids.rb
99
100
  - lib/smart_proxy_container_gateway/version.rb
100
101
  - settings.d/container_gateway.yml.example
101
102
  homepage: https://github.com/Katello/smart_proxy_container_gateway