smart_proxy_pulp 3.2.0 → 3.4.0

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: 8ed75491dd5597b9032d38132676920c2d1ddfc5e52b9462bec134a8188719f4
4
- data.tar.gz: a7994ef607521731efa8e2c815825fb3b68227bb0439cd755bf0119d5f59e4bc
3
+ metadata.gz: 0dc738e9e4af81c22244e4daef6f5f9bc0b46ff8365e80b55013b7adadddb823
4
+ data.tar.gz: e2cb04bedb9fed3c5dbd180c7f90d0782dc47b6e9f56c501941a78b54b3046cf
5
5
  SHA512:
6
- metadata.gz: 90a817e0ee2c6b583e907c048ea6f1178777532463a6df2fc4ef3a8fc050e3f119f8711cd23e0a69672f274d811a896d6791556dcd6fdfc53a9a2b1383b9af6b
7
- data.tar.gz: 3781082d3bf8644f9cb32c777bcf88d1642a4d77d3acb4ec3fa137cc6ec4a7493c66b2be758c4b19b8e7afefe94af21f0b8b50887796fa0f970f8b6e69ac6178
6
+ metadata.gz: 4556a56d00efc823d3a149510021c1e52da6cb1aab0225cae0ad90055edf38084ea5903f8873ed1676bac8a0c814b57ac9b6add83edebe87eef4180237384c98
7
+ data.tar.gz: 7c37ab16f56ab8cb74305fd43434de35a675e8e00d47262835141001c31727a358e269502541aed98717485dd91b561b92f79e91836e5c8414f8e9eeff29147e
data/Gemfile CHANGED
@@ -1,9 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  gemspec
3
5
 
4
- group :development do
5
- gem 'smart_proxy', :git => 'https://github.com/theforeman/smart-proxy', :branch => 'develop'
6
+ group :rubocop do
7
+ gem 'rubocop', '~> 1.28.0'
8
+ gem 'rubocop-performance'
9
+ gem 'rubocop-rake'
6
10
  end
7
11
 
8
- gem 'sinatra'
9
- gem 'rack', '>= 1.1'
12
+ group :test do
13
+ gem 'ci_reporter_test_unit'
14
+ gem 'mocha', '~> 1'
15
+ gem 'rack-test'
16
+ gem 'rake', '~> 13'
17
+ gem 'smart_proxy', :git => 'https://github.com/theforeman/smart-proxy', :branch => 'develop'
18
+ gem 'test-unit', '~> 3'
19
+ gem 'webmock', '~> 3'
20
+ end
data/bundler.d/pulp.rb CHANGED
@@ -1 +1,3 @@
1
- gem 'smart_proxy_pulp'
1
+ # frozen_string_literal: true
2
+
3
+ gem 'smart_proxy_pulp'
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_pulp_plugin/version'
2
4
  require 'smart_proxy_pulp_plugin/pulpcore_plugin'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sinatra'
2
4
  require 'smart_proxy_pulp_plugin/pulpcore_client'
3
5
 
@@ -10,6 +12,7 @@ module PulpProxy
10
12
  begin
11
13
  result = PulpcoreClient.get("/pulp/api/v3/status/")
12
14
  return result.body if result.is_a?(Net::HTTPSuccess)
15
+
13
16
  log_halt result.code, "Pulp server at #{PulpcoreClient.pulp_url} returned an error: '#{result.message}'"
14
17
  rescue SocketError, Errno::ECONNREFUSED => e
15
18
  log_halt 503, "Communication error with '#{URI.parse(PulpcoreClient.pulp_url).host}': #{e.message}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'net/http'
2
4
  require 'net/https'
3
5
  require 'uri'
@@ -7,15 +9,15 @@ module PulpProxy
7
9
  class PulpcoreClient
8
10
  def self.get(path)
9
11
  uri = URI.parse(pulp_url)
10
- req = Net::HTTP::Get.new(URI.join(uri.to_s.chomp('/') + '/', path))
12
+ req = Net::HTTP::Get.new(URI.join("#{uri.to_s.chomp('/')}/", path))
11
13
  req.add_field('Accept', 'application/json')
12
- self.http.request(req)
14
+ http.request(req)
13
15
  end
14
16
 
15
17
  def self.capabilities
16
18
  body = JSON.parse(get("/pulp/api/v3/status/").body)
17
- body['versions'].map{|item| item['component'] }
18
- rescue => e
19
+ body['versions'].map { |item| item['component'] }
20
+ rescue StandardError => e
19
21
  logger.error("Could not fetch capabilities: #{e.message}")
20
22
  []
21
23
  end
@@ -25,9 +27,13 @@ module PulpProxy
25
27
  end
26
28
 
27
29
  def self.http
30
+ ssl_ca = ::PulpProxy::PulpcorePlugin.settings.ssl_ca ||
31
+ ::Proxy::SETTINGS.foreman_ssl_ca ||
32
+ ::Proxy::SETTINGS.ssl_ca_file
28
33
  uri = URI.parse(pulp_url)
29
34
  http = Net::HTTP.new(uri.host, uri.port)
30
35
  http.use_ssl = uri.scheme == 'https'
36
+ http.ca_file = ssl_ca if http.use_ssl? && ssl_ca && !ssl_ca.empty?
31
37
  http
32
38
  end
33
39
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_pulp_plugin/pulpcore_api'
2
4
 
3
5
  map "/pulpcore" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'smart_proxy_pulp_plugin/validators'
2
4
 
3
5
  module PulpProxy
@@ -16,6 +18,7 @@ module PulpProxy
16
18
  validate :content_app_url, :url => true
17
19
  validate :client_authentication, :include => AUTH_TYPES
18
20
  validate :rhsm_url, :url => true
21
+ validate :ssl_ca, :file_readable => true
19
22
 
20
23
  expose_setting :pulp_url
21
24
  expose_setting :mirror
@@ -1,14 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PulpProxy
2
4
  module Validators
3
5
  class Include < ::Proxy::PluginValidators::Base
4
6
  def validate!(settings)
5
7
  setting_value = settings[@setting_name]
8
+ return true if (setting_value - @params).empty?
6
9
 
7
- unless (setting_value - @params).empty?
8
- raise ::Proxy::Error::ConfigurationError, "Parameter '#{@setting_name}' is expected to be one or more of #{@params}"
9
- else
10
- true
11
- end
10
+ # rubocop:disable Layout/LineLength
11
+ raise ::Proxy::Error::ConfigurationError, "Parameter '#{@setting_name}' is expected to be one or more of #{@params}"
12
+ # rubocop:enable Layout/LineLength
12
13
  end
13
14
  end
14
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PulpProxy
2
- VERSION = "3.2.0"
4
+ VERSION = "3.4.0"
3
5
  end
@@ -7,3 +7,4 @@
7
7
  #:mirror: false
8
8
  #:client_authentication: ['password', 'client_certificate']
9
9
  #:rhsm_url: https://localhost/rhsm
10
+ #:ssl_ca: /etc/ssl/certs/custom_ca.crt
metadata CHANGED
@@ -1,86 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_pulp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Dolguikh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-02 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: test-unit
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '3'
27
- - !ruby/object:Gem::Dependency
28
- name: mocha
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1'
41
- - !ruby/object:Gem::Dependency
42
- name: webmock
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3'
55
- - !ruby/object:Gem::Dependency
56
- name: rack-test
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '13'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '13'
83
- description: " Basic Pulp support for Foreman Smart-Proxy\n"
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Basic Pulp support for Foreman Smart-Proxy
84
14
  email:
85
15
  - dmitri@redhat.com
86
16
  executables: []
@@ -108,16 +38,19 @@ require_paths:
108
38
  - lib
109
39
  required_ruby_version: !ruby/object:Gem::Requirement
110
40
  requirements:
111
- - - "~>"
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '2.7'
44
+ - - "<"
112
45
  - !ruby/object:Gem::Version
113
- version: '2.5'
46
+ version: '4'
114
47
  required_rubygems_version: !ruby/object:Gem::Requirement
115
48
  requirements:
116
49
  - - ">="
117
50
  - !ruby/object:Gem::Version
118
51
  version: '0'
119
52
  requirements: []
120
- rubygems_version: 3.1.6
53
+ rubygems_version: 3.5.16
121
54
  signing_key:
122
55
  specification_version: 4
123
56
  summary: Basic Pulp support for Foreman Smart-Proxy