smart_proxy_pulp 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/Gemfile +3 -0
- data/lib/smart_proxy_pulp_plugin/pulp_api.rb +9 -4
- data/lib/smart_proxy_pulp_plugin/pulp_client.rb +3 -2
- data/lib/smart_proxy_pulp_plugin/pulp_node_plugin.rb +2 -1
- data/lib/smart_proxy_pulp_plugin/pulp_plugin.rb +1 -0
- data/lib/smart_proxy_pulp_plugin/settings.rb +12 -0
- data/lib/smart_proxy_pulp_plugin/version.rb +1 -1
- data/settings.d/pulp.yml.example +1 -0
- data/settings.d/pulpnode.yml.example +1 -0
- metadata +88 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d466a8b14430625f9d636f3324f5a617ce5ff96f
|
4
|
+
data.tar.gz: adc6fa1e589b56a2504b374b4d880a52a4f2105f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0d5b5abc4b048205f9347745651d5ead876475b0eb24ed5ea8667240b407141eb9e2ca9042c5f73777e12ee7b0c54797eb9dc65084d7dc8cc42b2cdfbe1a36b
|
7
|
+
data.tar.gz: 72d174734b54cf88d1d0d39221ccf225a3cdb846d1e716c2cd9e81af61ed32d2439fb443b928ece14b57243ad24ef882b64c644cb73df0138496fec5564cdf60
|
data/Gemfile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'sinatra'
|
2
2
|
require 'smart_proxy_pulp_plugin/pulp_client'
|
3
3
|
require 'smart_proxy_pulp_plugin/disk_usage'
|
4
|
+
require 'smart_proxy_pulp_plugin/settings'
|
4
5
|
|
5
6
|
module PulpProxy
|
6
7
|
class Api < Sinatra::Base
|
@@ -11,24 +12,28 @@ module PulpProxy
|
|
11
12
|
begin
|
12
13
|
result = PulpClient.get("/api/v2/status/")
|
13
14
|
return result.body if result.is_a?(Net::HTTPSuccess)
|
14
|
-
log_halt result.code, "Pulp server at #{::PulpProxy::
|
15
|
+
log_halt result.code, "Pulp server at #{::PulpProxy::Settings.settings.pulp_url} returned an error: '#{result.message}'"
|
15
16
|
rescue Errno::ECONNREFUSED => e
|
16
|
-
log_halt 503, "Pulp server at #{::PulpProxy::
|
17
|
+
log_halt 503, "Pulp server at #{::PulpProxy::Settings.settings.pulp_url} is not responding"
|
17
18
|
rescue SocketError => e
|
18
|
-
log_halt 503, "Pulp server '#{URI.parse(::PulpProxy::
|
19
|
+
log_halt 503, "Pulp server '#{URI.parse(::PulpProxy::Settings.settings.pulp_url.to_s).host}' is unknown"
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
get '/status/disk_usage' do
|
23
24
|
size = (params[:size] && DiskUsage::SIZE.keys.include?(params[:size].to_sym)) ? params[:size].to_sym : :kilobyte
|
24
|
-
monitor_dirs = Hash[::PulpProxy::
|
25
|
+
monitor_dirs = Hash[::PulpProxy::Settings.settings.marshal_dump.select { |key, _| key == :pulp_dir || key == :pulp_content_dir || key == :mongodb_dir }]
|
25
26
|
begin
|
26
27
|
pulp_disk = DiskUsage.new({:path => monitor_dirs, :size => size})
|
27
28
|
pulp_disk.to_json
|
28
29
|
rescue ::Proxy::Error::ConfigurationError
|
29
30
|
log_halt 500, 'Could not find df command to evaluate disk space'
|
30
31
|
end
|
32
|
+
end
|
31
33
|
|
34
|
+
get '/status/puppet' do
|
35
|
+
content_type :json
|
36
|
+
{:puppet_content_dir => ::PulpProxy::Settings.settings.puppet_content_dir}.to_json
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'net/https'
|
3
3
|
require 'uri'
|
4
|
+
require 'smart_proxy_pulp_plugin/settings'
|
4
5
|
|
5
6
|
module PulpProxy
|
6
7
|
class PulpClient
|
7
8
|
def self.get(path)
|
8
|
-
uri = URI.parse(::PulpProxy::
|
9
|
+
uri = URI.parse(::PulpProxy::Settings.settings.pulp_url.to_s)
|
9
10
|
path = [uri.path, path].join('/') unless uri.path.empty?
|
10
11
|
req = Net::HTTP::Get.new(URI.join(uri.to_s, path).path)
|
11
12
|
req.add_field('Accept', 'application/json')
|
@@ -14,7 +15,7 @@ module PulpProxy
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.http
|
17
|
-
uri = URI.parse(::PulpProxy::
|
18
|
+
uri = URI.parse(::PulpProxy::Settings.settings.pulp_url.to_s)
|
18
19
|
http = Net::HTTP.new(uri.host, uri.port)
|
19
20
|
http.use_ssl = uri.scheme == 'https'
|
20
21
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -1,9 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module PulpNodeProxy
|
2
2
|
class Plugin < ::Proxy::Plugin
|
3
3
|
plugin "pulpnode", ::PulpProxy::VERSION
|
4
4
|
default_settings :pulp_url => 'https://localhost/pulp',
|
5
5
|
:pulp_dir => '/var/lib/pulp',
|
6
6
|
:pulp_content_dir => '/var/lib/pulp/content',
|
7
|
+
:puppet_content_dir => '/etc/puppet/environments',
|
7
8
|
:mongodb_dir => '/var/lib/mongodb'
|
8
9
|
|
9
10
|
http_rackup_path File.expand_path("pulp_node_http_config.ru", File.expand_path("../", __FILE__))
|
@@ -4,6 +4,7 @@ module PulpProxy
|
|
4
4
|
default_settings :pulp_url => 'https://localhost/pulp',
|
5
5
|
:pulp_dir => '/var/lib/pulp',
|
6
6
|
:pulp_content_dir => '/var/lib/pulp/content',
|
7
|
+
:puppet_content_dir => '/etc/puppet/environments',
|
7
8
|
:mongodb_dir => '/var/lib/mongodb'
|
8
9
|
|
9
10
|
http_rackup_path File.expand_path("pulp_http_config.ru", File.expand_path("../", __FILE__))
|
@@ -0,0 +1,12 @@
|
|
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
|
data/settings.d/pulp.yml.example
CHANGED
metadata
CHANGED
@@ -1,115 +1,129 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_pulp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Dmitri Dolguikh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2016-09-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: test-unit
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
version: "2"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
22
20
|
type: :development
|
23
|
-
version_requirements: *id001
|
24
|
-
- !ruby/object:Gem::Dependency
|
25
|
-
name: mocha
|
26
21
|
prerelease: false
|
27
|
-
|
28
|
-
requirements:
|
29
|
-
- - ~>
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
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'
|
32
34
|
type: :development
|
33
|
-
version_requirements: *id002
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: webmock
|
36
35
|
prerelease: false
|
37
|
-
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version:
|
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: '1'
|
42
48
|
type: :development
|
43
|
-
version_requirements: *id003
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: rack-test
|
46
49
|
prerelease: false
|
47
|
-
|
48
|
-
requirements:
|
49
|
-
- - ~>
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1'
|
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'
|
52
62
|
type: :development
|
53
|
-
version_requirements: *id004
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: rake
|
56
63
|
prerelease: false
|
57
|
-
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version:
|
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: '10'
|
62
76
|
type: :development
|
63
|
-
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10'
|
64
83
|
description: " Basic Pulp support for Foreman Smart-Proxy\n"
|
65
|
-
email:
|
84
|
+
email:
|
66
85
|
- dmitri@redhat.com
|
67
86
|
executables: []
|
68
|
-
|
69
87
|
extensions: []
|
70
|
-
|
71
88
|
extra_rdoc_files: []
|
72
|
-
|
73
|
-
|
89
|
+
files:
|
90
|
+
- Gemfile
|
91
|
+
- LICENSE
|
74
92
|
- bundler.d/pulp.rb
|
75
93
|
- lib/smart_proxy_pulp.rb
|
94
|
+
- lib/smart_proxy_pulp_plugin/disk_usage.rb
|
95
|
+
- lib/smart_proxy_pulp_plugin/pulp_api.rb
|
76
96
|
- lib/smart_proxy_pulp_plugin/pulp_client.rb
|
77
|
-
- lib/smart_proxy_pulp_plugin/pulp_node_plugin.rb
|
78
|
-
- lib/smart_proxy_pulp_plugin/version.rb
|
79
97
|
- lib/smart_proxy_pulp_plugin/pulp_http_config.ru
|
80
98
|
- lib/smart_proxy_pulp_plugin/pulp_node_http_config.ru
|
81
|
-
- lib/smart_proxy_pulp_plugin/
|
99
|
+
- lib/smart_proxy_pulp_plugin/pulp_node_plugin.rb
|
82
100
|
- lib/smart_proxy_pulp_plugin/pulp_plugin.rb
|
83
|
-
- lib/smart_proxy_pulp_plugin/
|
101
|
+
- lib/smart_proxy_pulp_plugin/settings.rb
|
102
|
+
- lib/smart_proxy_pulp_plugin/version.rb
|
84
103
|
- settings.d/pulp.yml.example
|
85
104
|
- settings.d/pulpnode.yml.example
|
86
|
-
- LICENSE
|
87
|
-
- Gemfile
|
88
105
|
homepage: https://github.com/theforeman/smart-proxy-pulp-plugin
|
89
|
-
licenses:
|
106
|
+
licenses:
|
90
107
|
- GPLv3
|
91
108
|
metadata: {}
|
92
|
-
|
93
109
|
post_install_message:
|
94
110
|
rdoc_options: []
|
95
|
-
|
96
|
-
require_paths:
|
111
|
+
require_paths:
|
97
112
|
- lib
|
98
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
-
|
101
|
-
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
107
123
|
requirements: []
|
108
|
-
|
109
124
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.5.1
|
111
126
|
signing_key:
|
112
127
|
specification_version: 4
|
113
128
|
summary: Basic Pulp support for Foreman Smart-Proxy
|
114
129
|
test_files: []
|
115
|
-
|