Skip to content

Commit

Permalink
Add a content_app_url setting to expose
Browse files Browse the repository at this point in the history
This allows Katello to autodetect the content app URL which is used for
content such as container images.
  • Loading branch information
ekohl committed Aug 19, 2019
1 parent 2b9f9c1 commit 1c8e953
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/smart_proxy_pulp_plugin/pulp3_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ module PulpProxy
class Pulp3Plugin < ::Proxy::Plugin
plugin "pulp3", ::PulpProxy::VERSION
default_settings :pulp_url => 'https://localhost/pulp/',
:content_app_url => 'https://localhost:24816/',
:pulp_dir => '/var/lib/pulp',
:pulp_content_dir => '/var/lib/pulp/content',
:mirror => false

load_validators :url => ::PulpProxy::Validators::PulpUrlValidator
validate :pulp_url, :url => true
validate :content_app_url, :url => true

expose_setting :pulp_url
expose_setting :mirror
expose_setting :content_app_url
capability( lambda do ||
Pulp3Client.capabilities
end)
Expand Down
1 change: 1 addition & 0 deletions settings.d/pulp3.yml.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
:enabled: true
#:pulp_url: https://localhost/pulp/
#:content_app_url: https://localhost:24816/
#:pulp_dir: /var/lib/pulp
#:pulp_content_dir: /var/lib/pulp/content
#:mirror: false
8 changes: 6 additions & 2 deletions test/pulp3_plugin_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def app
def test_features
Proxy::DefaultModuleLoader.any_instance.expects(:load_configuration_file).with('pulp.yml').returns(enabled: true, pulp_url: 'http://pulp.example.com/foo')
Proxy::DefaultModuleLoader.any_instance.expects(:load_configuration_file).with('pulpnode.yml').returns(enabled: true, pulp_url: 'http://pulpnode.example.com/foo')
Proxy::DefaultModuleLoader.any_instance.expects(:load_configuration_file).with('pulp3.yml').returns(enabled: true, pulp_url: 'http://pulp3.example.com/foo')
Proxy::DefaultModuleLoader.any_instance.expects(:load_configuration_file).with('pulp3.yml').returns(enabled: true, pulp_url: 'http://pulp3.example.com/foo', content_app_url: 'http://pulp3.example.com:24816/')
PulpProxy::Pulp3Client.stubs(:capabilities).returns(['foo'])

get '/features'
Expand All @@ -24,7 +24,11 @@ def test_features

assert_equal 'running', pulp3['state']

expected_settings = {'pulp_url' => 'http://pulp3.example.com/foo', 'mirror' => false}
expected_settings = {
'pulp_url' => 'http://pulp3.example.com/foo',
'content_app_url' => 'http://pulp3.example.com:24816/',
'mirror' => false
}
assert_equal(expected_settings, pulp3['settings'])
assert_equal(['foo'], pulp3['capabilities'])
end
Expand Down

0 comments on commit 1c8e953

Please sign in to comment.