smart_proxy_pulp 2.0.0 → 3.2.0
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 +4 -4
- data/Gemfile +2 -21
- data/lib/smart_proxy_pulp.rb +0 -2
- data/lib/smart_proxy_pulp_plugin/pulpcore_api.rb +2 -3
- data/lib/smart_proxy_pulp_plugin/pulpcore_client.rb +6 -3
- data/lib/smart_proxy_pulp_plugin/pulpcore_plugin.rb +16 -8
- data/lib/smart_proxy_pulp_plugin/validators.rb +15 -0
- data/lib/smart_proxy_pulp_plugin/version.rb +1 -1
- data/settings.d/pulpcore.yml.example +4 -0
- metadata +15 -25
- data/lib/smart_proxy_pulp_plugin/disk_usage.rb +0 -120
- data/lib/smart_proxy_pulp_plugin/pulp_api.rb +0 -41
- data/lib/smart_proxy_pulp_plugin/pulp_client.rb +0 -36
- data/lib/smart_proxy_pulp_plugin/pulp_http_config.ru +0 -5
- data/lib/smart_proxy_pulp_plugin/pulp_node_http_config.ru +0 -5
- data/lib/smart_proxy_pulp_plugin/pulp_node_plugin.rb +0 -14
- data/lib/smart_proxy_pulp_plugin/pulp_plugin.rb +0 -15
- data/lib/smart_proxy_pulp_plugin/settings.rb +0 -12
- data/lib/smart_proxy_pulp_plugin/validators/pulp_url_validator.rb +0 -12
- data/settings.d/pulp.yml.example +0 -8
- data/settings.d/pulpnode.yml.example +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ed75491dd5597b9032d38132676920c2d1ddfc5e52b9462bec134a8188719f4
|
4
|
+
data.tar.gz: a7994ef607521731efa8e2c815825fb3b68227bb0439cd755bf0119d5f59e4bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90a817e0ee2c6b583e907c048ea6f1178777532463a6df2fc4ef3a8fc050e3f119f8711cd23e0a69672f274d811a896d6791556dcd6fdfc53a9a2b1383b9af6b
|
7
|
+
data.tar.gz: 3781082d3bf8644f9cb32c777bcf88d1642a4d77d3acb4ec3fa137cc6ec4a7493c66b2be758c4b19b8e7afefe94af21f0b8b50887796fa0f970f8b6e69ac6178
|
data/Gemfile
CHANGED
@@ -5,24 +5,5 @@ group :development do
|
|
5
5
|
gem 'smart_proxy', :git => 'https://github.com/theforeman/smart-proxy', :branch => 'develop'
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
if RUBY_VERSION < '2.1'
|
11
|
-
gem 'public_suffix', '< 3'
|
12
|
-
else
|
13
|
-
gem 'public_suffix'
|
14
|
-
end
|
15
|
-
if RUBY_VERSION < '2.2'
|
16
|
-
gem 'rack-test', '< 0.8'
|
17
|
-
else
|
18
|
-
gem 'rack-test'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
if RUBY_VERSION < '2.2'
|
23
|
-
gem 'sinatra', '< 2'
|
24
|
-
gem 'rack', '>= 1.1', '< 2.0.0'
|
25
|
-
else
|
26
|
-
gem 'sinatra'
|
27
|
-
gem 'rack', '>= 1.1'
|
28
|
-
end
|
8
|
+
gem 'sinatra'
|
9
|
+
gem 'rack', '>= 1.1'
|
data/lib/smart_proxy_pulp.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require 'smart_proxy_pulp_plugin/pulpcore_client'
|
3
|
-
require 'smart_proxy_pulp_plugin/disk_usage'
|
4
3
|
|
5
4
|
module PulpProxy
|
6
5
|
class PulpcoreApi < Sinatra::Base
|
@@ -11,9 +10,9 @@ module PulpProxy
|
|
11
10
|
begin
|
12
11
|
result = PulpcoreClient.get("/pulp/api/v3/status/")
|
13
12
|
return result.body if result.is_a?(Net::HTTPSuccess)
|
14
|
-
log_halt result.code, "Pulp server at #{
|
13
|
+
log_halt result.code, "Pulp server at #{PulpcoreClient.pulp_url} returned an error: '#{result.message}'"
|
15
14
|
rescue SocketError, Errno::ECONNREFUSED => e
|
16
|
-
log_halt 503, "Communication error with '#{URI.parse(
|
15
|
+
log_halt 503, "Communication error with '#{URI.parse(PulpcoreClient.pulp_url).host}': #{e.message}"
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'net/https'
|
3
3
|
require 'uri'
|
4
|
-
require 'smart_proxy_pulp_plugin/settings'
|
5
4
|
require 'proxy/log'
|
6
5
|
|
7
6
|
module PulpProxy
|
8
7
|
class PulpcoreClient
|
9
8
|
def self.get(path)
|
10
|
-
uri = URI.parse(
|
9
|
+
uri = URI.parse(pulp_url)
|
11
10
|
req = Net::HTTP::Get.new(URI.join(uri.to_s.chomp('/') + '/', path))
|
12
11
|
req.add_field('Accept', 'application/json')
|
13
12
|
self.http.request(req)
|
@@ -26,10 +25,14 @@ module PulpProxy
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def self.http
|
29
|
-
uri = URI.parse(
|
28
|
+
uri = URI.parse(pulp_url)
|
30
29
|
http = Net::HTTP.new(uri.host, uri.port)
|
31
30
|
http.use_ssl = uri.scheme == 'https'
|
32
31
|
http
|
33
32
|
end
|
33
|
+
|
34
|
+
def self.pulp_url
|
35
|
+
::PulpProxy::PulpcorePlugin.settings.pulp_url.to_s
|
36
|
+
end
|
34
37
|
end
|
35
38
|
end
|
@@ -1,23 +1,31 @@
|
|
1
|
-
require 'smart_proxy_pulp_plugin/validators
|
1
|
+
require 'smart_proxy_pulp_plugin/validators'
|
2
2
|
|
3
3
|
module PulpProxy
|
4
4
|
class PulpcorePlugin < ::Proxy::Plugin
|
5
5
|
plugin "pulpcore", ::PulpProxy::VERSION
|
6
6
|
default_settings :pulp_url => 'https://localhost',
|
7
7
|
:content_app_url => 'https://localhost:24816/',
|
8
|
-
:mirror => false
|
8
|
+
:mirror => false,
|
9
|
+
:client_authentication => ['password', 'client_certificate'],
|
10
|
+
:rhsm_url => 'https://localhost/rhsm'
|
9
11
|
|
10
|
-
|
12
|
+
AUTH_TYPES = ['password', 'client_certificate', 'client_certificate_admin_only'].freeze
|
13
|
+
|
14
|
+
load_validators include: ::PulpProxy::Validators::Include
|
11
15
|
validate :pulp_url, :url => true
|
12
16
|
validate :content_app_url, :url => true
|
17
|
+
validate :client_authentication, :include => AUTH_TYPES
|
18
|
+
validate :rhsm_url, :url => true
|
13
19
|
|
14
20
|
expose_setting :pulp_url
|
15
21
|
expose_setting :mirror
|
16
22
|
expose_setting :content_app_url
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
expose_setting :username
|
24
|
+
expose_setting :password
|
25
|
+
expose_setting :client_authentication
|
26
|
+
expose_setting :rhsm_url
|
27
|
+
|
28
|
+
capability -> { PulpcoreClient.capabilities }
|
29
|
+
rackup_path File.expand_path('pulpcore_http_config.ru', __dir__)
|
22
30
|
end
|
23
31
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module PulpProxy
|
2
|
+
module Validators
|
3
|
+
class Include < ::Proxy::PluginValidators::Base
|
4
|
+
def validate!(settings)
|
5
|
+
setting_value = settings[@setting_name]
|
6
|
+
|
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
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_pulp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Dolguikh
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mocha
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack-test
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '13'
|
83
83
|
description: " Basic Pulp support for Foreman Smart-Proxy\n"
|
84
84
|
email:
|
85
85
|
- dmitri@redhat.com
|
@@ -91,44 +91,34 @@ files:
|
|
91
91
|
- LICENSE
|
92
92
|
- bundler.d/pulp.rb
|
93
93
|
- lib/smart_proxy_pulp.rb
|
94
|
-
- lib/smart_proxy_pulp_plugin/disk_usage.rb
|
95
|
-
- lib/smart_proxy_pulp_plugin/pulp_api.rb
|
96
|
-
- lib/smart_proxy_pulp_plugin/pulp_client.rb
|
97
|
-
- lib/smart_proxy_pulp_plugin/pulp_http_config.ru
|
98
|
-
- lib/smart_proxy_pulp_plugin/pulp_node_http_config.ru
|
99
|
-
- lib/smart_proxy_pulp_plugin/pulp_node_plugin.rb
|
100
|
-
- lib/smart_proxy_pulp_plugin/pulp_plugin.rb
|
101
94
|
- lib/smart_proxy_pulp_plugin/pulpcore_api.rb
|
102
95
|
- lib/smart_proxy_pulp_plugin/pulpcore_client.rb
|
103
96
|
- lib/smart_proxy_pulp_plugin/pulpcore_http_config.ru
|
104
97
|
- lib/smart_proxy_pulp_plugin/pulpcore_plugin.rb
|
105
|
-
- lib/smart_proxy_pulp_plugin/
|
106
|
-
- lib/smart_proxy_pulp_plugin/validators/pulp_url_validator.rb
|
98
|
+
- lib/smart_proxy_pulp_plugin/validators.rb
|
107
99
|
- lib/smart_proxy_pulp_plugin/version.rb
|
108
|
-
- settings.d/pulp.yml.example
|
109
100
|
- settings.d/pulpcore.yml.example
|
110
|
-
- settings.d/pulpnode.yml.example
|
111
101
|
homepage: https://github.com/theforeman/smart-proxy-pulp-plugin
|
112
102
|
licenses:
|
113
103
|
- GPL-3.0
|
114
104
|
metadata: {}
|
115
|
-
post_install_message:
|
105
|
+
post_install_message:
|
116
106
|
rdoc_options: []
|
117
107
|
require_paths:
|
118
108
|
- lib
|
119
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
110
|
requirements:
|
121
|
-
- - "
|
111
|
+
- - "~>"
|
122
112
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
113
|
+
version: '2.5'
|
124
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
115
|
requirements:
|
126
116
|
- - ">="
|
127
117
|
- !ruby/object:Gem::Version
|
128
118
|
version: '0'
|
129
119
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
131
|
-
signing_key:
|
120
|
+
rubygems_version: 3.1.6
|
121
|
+
signing_key:
|
132
122
|
specification_version: 4
|
133
123
|
summary: Basic Pulp support for Foreman Smart-Proxy
|
134
124
|
test_files: []
|
@@ -1,120 +0,0 @@
|
|
1
|
-
module PulpProxy
|
2
|
-
class DiskUsage
|
3
|
-
include ::Proxy::Util
|
4
|
-
include ::Proxy::Log
|
5
|
-
SIZE = { :byte => 1, :kilobyte => 1_024, :megabyte => 1_048_576, :gigabyte => 1_073_741_824, :terabyte => 1_099_511_627_776 }
|
6
|
-
|
7
|
-
attr_reader :path, :stat, :size
|
8
|
-
|
9
|
-
def initialize(opts ={})
|
10
|
-
raise(::Proxy::Error::ConfigurationError, 'Unable to continue - must provide a path.') if opts[:path].nil?
|
11
|
-
@paths_hash = validate_path(path_hash(opts[:path]))
|
12
|
-
@path = @paths_hash.values
|
13
|
-
@size_format = opts[:size] || :kilobyte
|
14
|
-
@size = SIZE[@size_format]
|
15
|
-
@stat = {}
|
16
|
-
find_df
|
17
|
-
get_stat
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_json
|
21
|
-
stat.to_json
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
attr_reader :command_path
|
27
|
-
|
28
|
-
def find_df
|
29
|
-
@command_path = which('df') || raise(::Proxy::Error::ConfigurationError, 'df command was not found unable to retrieve usage information.')
|
30
|
-
end
|
31
|
-
|
32
|
-
def command
|
33
|
-
[command_path, "-P", "-B", "#{size}", *path]
|
34
|
-
end
|
35
|
-
|
36
|
-
# Inspired and copied from Facter
|
37
|
-
# @ https://github.com/puppetlabs/facter/blob/2.x/lib/facter/core/execution/base.rb
|
38
|
-
# @TODO: Refactor http://projects.theforeman.org/issues/15235 when removing support for 1.8.7
|
39
|
-
def with_env(values)
|
40
|
-
old = {}
|
41
|
-
values.each do |var, value|
|
42
|
-
# save the old value if it exists
|
43
|
-
if old_val = ENV[var]
|
44
|
-
old[var] = old_val
|
45
|
-
end
|
46
|
-
# set the new (temporary) value for the environment variable
|
47
|
-
ENV[var] = value
|
48
|
-
end
|
49
|
-
# execute the caller's block, capture the return value
|
50
|
-
rv = yield
|
51
|
-
# use an ensure block to make absolutely sure we restore the variables
|
52
|
-
ensure
|
53
|
-
# restore the old values
|
54
|
-
values.each do |var, value|
|
55
|
-
if old.include?(var)
|
56
|
-
ENV[var] = old[var]
|
57
|
-
else
|
58
|
-
# if there was no old value, delete the key from the current environment variables hash
|
59
|
-
ENV.delete(var)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
# return the captured return value
|
63
|
-
rv
|
64
|
-
end
|
65
|
-
|
66
|
-
def get_stat
|
67
|
-
with_env 'LC_ALL' => 'C' do
|
68
|
-
raw = Open3::popen3(*command) do |stdin, stdout, stderr, thread|
|
69
|
-
unless stderr.read.empty?
|
70
|
-
error_line = stderr.read
|
71
|
-
logger.error "[#{command_path}] #{error_line}"
|
72
|
-
raise(::Proxy::Error::ConfigurationError, "#{command_path} raised an error: #{error_line}")
|
73
|
-
end
|
74
|
-
stdout.read.split("\n")
|
75
|
-
end
|
76
|
-
|
77
|
-
logger.debug "[#{command_path}] #{raw.to_s}"
|
78
|
-
|
79
|
-
titles = normalize_titles(raw)
|
80
|
-
raw.each_with_index do |line, index|
|
81
|
-
mount_path = path[index]
|
82
|
-
values = normalize_values(line.split)
|
83
|
-
@stat[hash_key_for(mount_path)] = Hash[titles.zip(values)].merge({:path => mount_path, :size => @size_format})
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def path_hash(path)
|
89
|
-
path.is_a?(Hash) ? path : Hash[path, path]
|
90
|
-
end
|
91
|
-
|
92
|
-
def hash_key_for(path)
|
93
|
-
@paths_hash.select { |k,v| v == path}.first[0]
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
def normalize_titles(raw)
|
98
|
-
replacers = {"mounted on" => :mounted, "capacity" => :percent, "1024-blocks" => :"1k-blocks" }
|
99
|
-
raw.shift.downcase.gsub(/(capacity|mounted on|1024-blocks)/) { |m| replacers.fetch(m,m)}.split.map(&:to_sym)
|
100
|
-
end
|
101
|
-
|
102
|
-
def normalize_values(values)
|
103
|
-
values.each_with_index do |value, index|
|
104
|
-
is_int = Integer(value) rescue false
|
105
|
-
values[index] = is_int if is_int
|
106
|
-
end
|
107
|
-
values
|
108
|
-
end
|
109
|
-
|
110
|
-
def validate_path(path_hash)
|
111
|
-
path_hash.each do |key, value|
|
112
|
-
unless File.readable?(value)
|
113
|
-
logger.warn "File at #{value} defined in #{key} parameter doesn't exist or is unreadable"
|
114
|
-
path_hash.delete(key)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
path_hash
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'sinatra'
|
2
|
-
require 'smart_proxy_pulp_plugin/pulp_client'
|
3
|
-
require 'smart_proxy_pulp_plugin/disk_usage'
|
4
|
-
require 'smart_proxy_pulp_plugin/settings'
|
5
|
-
|
6
|
-
module PulpProxy
|
7
|
-
class Api < Sinatra::Base
|
8
|
-
helpers ::Proxy::Helpers
|
9
|
-
authorize_with_trusted_hosts
|
10
|
-
authorize_with_ssl_client
|
11
|
-
|
12
|
-
get "/status" do
|
13
|
-
content_type :json
|
14
|
-
begin
|
15
|
-
result = PulpClient.get("api/v2/status/")
|
16
|
-
return result.body if result.is_a?(Net::HTTPSuccess)
|
17
|
-
log_halt result.code, "Pulp server at #{::PulpProxy::Settings.settings.pulp_url} returned an error: '#{result.message}'"
|
18
|
-
rescue Errno::ECONNREFUSED => e
|
19
|
-
log_halt 503, "Pulp server at #{::PulpProxy::Settings.settings.pulp_url} is not responding"
|
20
|
-
rescue SocketError => e
|
21
|
-
log_halt 503, "Pulp server '#{URI.parse(::PulpProxy::Settings.settings.pulp_url.to_s).host}' is unknown"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
get '/status/disk_usage' do
|
26
|
-
size = (params[:size] && DiskUsage::SIZE.keys.include?(params[:size].to_sym)) ? params[:size].to_sym : :kilobyte
|
27
|
-
monitor_dirs = Hash[::PulpProxy::Settings.settings.marshal_dump.select { |key, _| key == :pulp_dir || key == :pulp_content_dir || key == :mongodb_dir }]
|
28
|
-
begin
|
29
|
-
pulp_disk = DiskUsage.new({:path => monitor_dirs, :size => size})
|
30
|
-
pulp_disk.to_json
|
31
|
-
rescue ::Proxy::Error::ConfigurationError
|
32
|
-
log_halt 500, 'Could not find df command to evaluate disk space'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
get '/status/puppet' do
|
37
|
-
content_type :json
|
38
|
-
{:puppet_content_dir => ::PulpProxy::Settings.settings.puppet_content_dir}.to_json
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'net/https'
|
3
|
-
require 'uri'
|
4
|
-
require 'smart_proxy_pulp_plugin/settings'
|
5
|
-
|
6
|
-
module PulpProxy
|
7
|
-
class PulpClient
|
8
|
-
def self.get(path)
|
9
|
-
uri = URI.parse(::PulpProxy::Settings.settings.pulp_url.to_s)
|
10
|
-
req = Net::HTTP::Get.new(URI.join(uri.to_s.chomp('/') + '/', path))
|
11
|
-
req.add_field('Accept', 'application/json')
|
12
|
-
req.content_type = 'application/json'
|
13
|
-
response = self.http.request(req)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.http
|
17
|
-
uri = URI.parse(::PulpProxy::Settings.settings.pulp_url.to_s)
|
18
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
19
|
-
http.use_ssl = uri.scheme == 'https'
|
20
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
21
|
-
|
22
|
-
if http.use_ssl?
|
23
|
-
if Proxy::SETTINGS.ssl_ca_file && !Proxy::SETTINGS.ssl_ca_file.to_s.empty?
|
24
|
-
http.ca_file = Proxy::SETTINGS.ssl_ca_file
|
25
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
26
|
-
end
|
27
|
-
|
28
|
-
if Proxy::SETTINGS.ssl_certificate && !Proxy::SETTINGS.ssl_certificate.to_s.empty? && Proxy::SETTINGS.ssl_private_key && !Proxy::SETTINGS.ssl_private_key.to_s.empty?
|
29
|
-
http.cert = OpenSSL::X509::Certificate.new(File.read(Proxy::SETTINGS.ssl_certificate))
|
30
|
-
http.key = OpenSSL::PKey::RSA.new(File.read(Proxy::SETTINGS.ssl_private_key), nil)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
http
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module PulpNodeProxy
|
2
|
-
class Plugin < ::Proxy::Plugin
|
3
|
-
plugin "pulpnode", ::PulpProxy::VERSION
|
4
|
-
default_settings :pulp_url => 'https://localhost/pulp',
|
5
|
-
:pulp_dir => '/var/lib/pulp',
|
6
|
-
:pulp_content_dir => '/var/lib/pulp/content',
|
7
|
-
:puppet_content_dir => '/etc/puppet/environments',
|
8
|
-
:mongodb_dir => '/var/lib/mongodb'
|
9
|
-
|
10
|
-
expose_setting :pulp_url
|
11
|
-
http_rackup_path File.expand_path("pulp_node_http_config.ru", File.expand_path("../", __FILE__))
|
12
|
-
https_rackup_path File.expand_path("pulp_node_http_config.ru", File.expand_path("../", __FILE__))
|
13
|
-
end
|
14
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module PulpProxy
|
2
|
-
class Plugin < ::Proxy::Plugin
|
3
|
-
plugin "pulp", ::PulpProxy::VERSION
|
4
|
-
default_settings :pulp_url => 'https://localhost/pulp',
|
5
|
-
:pulp_dir => '/var/lib/pulp',
|
6
|
-
:pulp_content_dir => '/var/lib/pulp/content',
|
7
|
-
:puppet_content_dir => '/etc/puppet/environments',
|
8
|
-
:mongodb_dir => '/var/lib/mongodb'
|
9
|
-
|
10
|
-
expose_setting :pulp_url
|
11
|
-
|
12
|
-
http_rackup_path File.expand_path("pulp_http_config.ru", File.expand_path("../", __FILE__))
|
13
|
-
https_rackup_path File.expand_path("pulp_http_config.ru", File.expand_path("../", __FILE__))
|
14
|
-
end
|
15
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'sinatra'
|
2
|
-
require 'smart_proxy_pulp_plugin/pulp_node_plugin'
|
3
|
-
require 'smart_proxy_pulp_plugin/pulp_plugin'
|
4
|
-
|
5
|
-
module PulpProxy
|
6
|
-
class Settings
|
7
|
-
def self.settings
|
8
|
-
# work around until pulp node settings are no longer needed by foreman proxy, as pulp nodes have been removed
|
9
|
-
::PulpProxy::Plugin.settings.pulp_url ? ::PulpProxy::Plugin.settings : ::PulpNodeProxy::Plugin.settings
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module PulpProxy
|
2
|
-
module Validators
|
3
|
-
class PulpUrlValidator < ::Proxy::PluginValidators::Base
|
4
|
-
def validate!(settings)
|
5
|
-
raise ::Proxy::Error::ConfigurationError, "Setting 'pulp_url' is expected to contain a url for pulp server" if settings[:pulp_url].to_s.empty?
|
6
|
-
URI.parse(settings[:pulp_url])
|
7
|
-
rescue URI::InvalidURIError
|
8
|
-
raise ::Proxy::Error::ConfigurationError.new("Setting 'pulp_url' contains an invalid url for pulp server")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/settings.d/pulp.yml.example
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:enabled: true
|
3
|
-
#:pulp_url: https://localhost/pulp
|
4
|
-
# Path to pulp, pulp content and mongodb directories
|
5
|
-
#:pulp_dir: /var/lib/pulp
|
6
|
-
#:pulp_content_dir: /var/lib/pulp/content
|
7
|
-
#:puppet_content_dir: /etc/pupppet/environments
|
8
|
-
#:mongodb_dir: /var/lib/mongodb
|
@@ -1,8 +0,0 @@
|
|
1
|
-
---
|
2
|
-
:enabled: true
|
3
|
-
#:pulp_url: https://localhost/pulp
|
4
|
-
# Path to pulp, pulp content and mongodb directories
|
5
|
-
#:pulp_dir: /var/lib/pulp
|
6
|
-
#:pulp_content_dir: /var/lib/pulp/content
|
7
|
-
#:puppet_content_dir: /etc/puppet/environments
|
8
|
-
#:mongodb_dir: /var/lib/mongodb
|