diff --git a/lib/proxy/plugin.rb b/lib/proxy/plugin.rb index 76fdd7f1f..5b52f76c8 100644 --- a/lib/proxy/plugin.rb +++ b/lib/proxy/plugin.rb @@ -37,6 +37,11 @@ class ::Proxy::Plugin class << self attr_reader :get_http_rackup_path, :get_https_rackup_path, :get_uses_provider + def rackup_path(path) + http_rackup_path(path) + https_rackup_path(path) + end + def http_rackup_path(path) @get_http_rackup_path = path end diff --git a/modules/bmc/bmc_plugin.rb b/modules/bmc/bmc_plugin.rb index 8df040ba8..d36b8ae37 100644 --- a/modules/bmc/bmc_plugin.rb +++ b/modules/bmc/bmc_plugin.rb @@ -1,7 +1,6 @@ module Proxy::BMC class Plugin < Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) plugin :bmc, ::Proxy::VERSION end diff --git a/modules/dhcp/dhcp_plugin.rb b/modules/dhcp/dhcp_plugin.rb index 3bd285542..a37d2e91a 100644 --- a/modules/dhcp/dhcp_plugin.rb +++ b/modules/dhcp/dhcp_plugin.rb @@ -1,6 +1,5 @@ class Proxy::DhcpPlugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) uses_provider default_settings :use_provider => 'dhcp_isc', :server => '127.0.0.1', :subnets => [], :ping_free_ip => true diff --git a/modules/dns/dns_plugin.rb b/modules/dns/dns_plugin.rb index c145723e0..ec3dc80c4 100644 --- a/modules/dns/dns_plugin.rb +++ b/modules/dns/dns_plugin.rb @@ -1,7 +1,6 @@ module Proxy::Dns class Plugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) uses_provider default_settings :use_provider => 'dns_nsupdate', :dns_ttl => 86_400 diff --git a/modules/facts/facts_plugin.rb b/modules/facts/facts_plugin.rb index 2e01508a7..7c798718a 100644 --- a/modules/facts/facts_plugin.rb +++ b/modules/facts/facts_plugin.rb @@ -1,6 +1,5 @@ class Proxy::FactsPlugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) default_settings :enabled => false plugin :facts, ::Proxy::VERSION diff --git a/modules/httpboot/httpboot_plugin.rb b/modules/httpboot/httpboot_plugin.rb index 50a519b19..7d99d3c0d 100644 --- a/modules/httpboot/httpboot_plugin.rb +++ b/modules/httpboot/httpboot_plugin.rb @@ -1,7 +1,6 @@ module Proxy::Httpboot class Plugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) plugin :httpboot, ::Proxy::VERSION diff --git a/modules/logs/logs_plugin.rb b/modules/logs/logs_plugin.rb index 0fc5ffa66..31a3ea12c 100644 --- a/modules/logs/logs_plugin.rb +++ b/modules/logs/logs_plugin.rb @@ -1,6 +1,5 @@ class ::Proxy::LogsPlugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) plugin :logs, ::Proxy::VERSION default_settings :enabled => true diff --git a/modules/puppet_proxy/puppet_plugin.rb b/modules/puppet_proxy/puppet_plugin.rb index 864426564..eb15a698b 100644 --- a/modules/puppet_proxy/puppet_plugin.rb +++ b/modules/puppet_proxy/puppet_plugin.rb @@ -1,7 +1,6 @@ module Proxy::Puppet class Plugin < Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) plugin :puppet, ::Proxy::VERSION diff --git a/modules/puppetca/puppetca_plugin.rb b/modules/puppetca/puppetca_plugin.rb index 96a5bec25..98f9add23 100644 --- a/modules/puppetca/puppetca_plugin.rb +++ b/modules/puppetca/puppetca_plugin.rb @@ -1,7 +1,6 @@ module Proxy::PuppetCa class Plugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) uses_provider default_settings :use_provider => 'puppetca_hostname_whitelisting' diff --git a/modules/realm/realm_plugin.rb b/modules/realm/realm_plugin.rb index 495935785..6e7fb884d 100644 --- a/modules/realm/realm_plugin.rb +++ b/modules/realm/realm_plugin.rb @@ -1,7 +1,6 @@ module Proxy::Realm class Plugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) default_settings :use_provider => 'realm_freeipa' diff --git a/modules/root/root_plugin.rb b/modules/root/root_plugin.rb index 8c794abee..d2c7b43e6 100644 --- a/modules/root/root_plugin.rb +++ b/modules/root/root_plugin.rb @@ -2,8 +2,7 @@ class ::Proxy::RootPlugin < ::Proxy::Plugin plugin :foreman_proxy, ::Proxy::VERSION default_settings :enabled => true - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) override_module_loader_class ::Proxy::RootPluginLoader end diff --git a/modules/templates/templates_plugin.rb b/modules/templates/templates_plugin.rb index bbf4d31ea..1910ff399 100644 --- a/modules/templates/templates_plugin.rb +++ b/modules/templates/templates_plugin.rb @@ -1,7 +1,6 @@ module Proxy::Templates class Plugin < ::Proxy::Plugin - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) plugin :templates, ::Proxy::VERSION diff --git a/modules/tftp/tftp_plugin.rb b/modules/tftp/tftp_plugin.rb index 5f1b197af..96589d037 100644 --- a/modules/tftp/tftp_plugin.rb +++ b/modules/tftp/tftp_plugin.rb @@ -2,8 +2,7 @@ module Proxy::TFTP class Plugin < ::Proxy::Plugin plugin :tftp, ::Proxy::VERSION - http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) - https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__)) + rackup_path File.expand_path("http_config.ru", __dir__) default_settings :tftproot => '/var/lib/tftpboot', :tftp_read_timeout => 60, diff --git a/test/plugins/plugin_test.rb b/test/plugins/plugin_test.rb index eb1f5c6e4..796f3f136 100644 --- a/test/plugins/plugin_test.rb +++ b/test/plugins/plugin_test.rb @@ -7,6 +7,16 @@ def test_http_rackup_returns_empty_string_with_missing_rackup_path assert_equal "", TestPlugin2.https_rackup end + class TestPluginSingleRackupPath < Proxy::Plugin + plugin :test2, '1.0' + rackup_path '/dev/null' + end + + def test_combined_rackup_path_returns_http_and_https + assert_equal '/dev/null', TestPluginSingleRackupPath.get_http_rackup_path + assert_equal '/dev/null', TestPluginSingleRackupPath.get_https_rackup_path + end + class TestBundlerGroupPlugin < ::Proxy::Plugin plugin :test_bundler_group, '1.0' bundler_group :test_group