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 CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA512:
3
- data.tar.gz: 9715773f6848f17c6cc187e45216f691d2ca409880e6c6517ccded0fd93212085cd3609608caeb32e860e0fd415c8e82cc444e0afa574d3ecc45ec4fef3a4ba6
4
- metadata.gz: ce1c540879134ec42f46b8fffa3b5fb741045d50d4d3af5537b084d2d42a4e972640afb6e1a29cf8e91b57e90172e876b1c7a6937866c0c8dc842ea84ba7bf66
5
- SHA1:
6
- data.tar.gz: acfcc667bd6786b91f23002e369e21616a572b9a
7
- metadata.gz: f0d4f3cc1953e3a7078578ec6c05ab4d62c3b233
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
@@ -4,3 +4,6 @@ gemspec
4
4
  group :development do
5
5
  gem 'smart_proxy', :git => 'https://github.com/theforeman/smart-proxy', :branch => 'develop'
6
6
  end
7
+
8
+ gem 'addressable', '< 2.4.0', :platforms => :ruby_18
9
+ gem 'json', '~> 1.0', :platforms => [:ruby_18, :ruby_19]
@@ -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::Plugin.settings.pulp_url} returned an error: '#{result.message}'"
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::Plugin.settings.pulp_url} is not responding"
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::Plugin.settings.pulp_url.to_s).host}' is unknown"
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::Plugin.settings.marshal_dump.select { |key, _| key == :pulp_dir || key == :pulp_content_dir || key == :mongodb_dir }]
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::Plugin.settings.pulp_url.to_s)
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::Plugin.settings.pulp_url.to_s)
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 PulpMasterProxy
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
@@ -1,3 +1,3 @@
1
1
  module PulpProxy
2
- VERSION = "1.2.2"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -4,4 +4,5 @@
4
4
  # Path to pulp, pulp content and mongodb directories
5
5
  #:pulp_dir: /var/lib/pulp
6
6
  #:pulp_content_dir: /var/lib/pulp/content
7
+ #:puppet_content_dir: /etc/pupppet/environments
7
8
  #:mongodb_dir: /var/lib/mongodb
@@ -4,4 +4,5 @@
4
4
  # Path to pulp, pulp content and mongodb directories
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
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.2.2
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
- date: 2016-07-15 00:00:00 Z
13
- dependencies:
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
- prerelease: false
17
- requirement: &id001 !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
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
- requirement: &id002 !ruby/object:Gem::Requirement
28
- requirements:
29
- - - ~>
30
- - !ruby/object:Gem::Version
31
- version: "1"
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
- requirement: &id003 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- version: "1"
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
- requirement: &id004 !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ~>
50
- - !ruby/object:Gem::Version
51
- version: "0"
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
- requirement: &id005 !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: "10"
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
- version_requirements: *id005
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
- files:
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/disk_usage.rb
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/pulp_api.rb
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
- - &id006
101
- - ">="
102
- - !ruby/object:Gem::Version
103
- version: "0"
104
- required_rubygems_version: !ruby/object:Gem::Requirement
105
- requirements:
106
- - *id006
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.0.14
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
-