Skip to content

Commit 88fbc8e

Browse files
ekohlehelms
authored andcommitted
Fixes #30951 - Provide a rackup_path plugin DSL
Currently there's http_rackup_path and https_rackup_path. In practice all built in modules and most (all?) plugins that I know define the same rackup config for both HTTP and HTTPS. Having a DSL method to do this simplifies code.
1 parent 774fb1d commit 88fbc8e

File tree

14 files changed

+27
-24
lines changed

14 files changed

+27
-24
lines changed

lib/proxy/plugin.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class ::Proxy::Plugin
3737
class << self
3838
attr_reader :get_http_rackup_path, :get_https_rackup_path, :get_uses_provider
3939

40+
def rackup_path(path)
41+
http_rackup_path(path)
42+
https_rackup_path(path)
43+
end
44+
4045
def http_rackup_path(path)
4146
@get_http_rackup_path = path
4247
end

modules/bmc/bmc_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Proxy::BMC
22
class Plugin < Proxy::Plugin
3-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
4-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3+
rackup_path File.expand_path("http_config.ru", __dir__)
54

65
plugin :bmc, ::Proxy::VERSION
76
end

modules/dhcp/dhcp_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
class Proxy::DhcpPlugin < ::Proxy::Plugin
2-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
2+
rackup_path File.expand_path("http_config.ru", __dir__)
43

54
uses_provider
65
default_settings :use_provider => 'dhcp_isc', :server => '127.0.0.1', :subnets => [], :ping_free_ip => true

modules/dns/dns_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Proxy::Dns
22
class Plugin < ::Proxy::Plugin
3-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
4-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3+
rackup_path File.expand_path("http_config.ru", __dir__)
54

65
uses_provider
76
default_settings :use_provider => 'dns_nsupdate', :dns_ttl => 86_400

modules/facts/facts_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
class Proxy::FactsPlugin < ::Proxy::Plugin
2-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
2+
rackup_path File.expand_path("http_config.ru", __dir__)
43

54
default_settings :enabled => false
65
plugin :facts, ::Proxy::VERSION

modules/httpboot/httpboot_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Proxy::Httpboot
22
class Plugin < ::Proxy::Plugin
3-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
4-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3+
rackup_path File.expand_path("http_config.ru", __dir__)
54

65
plugin :httpboot, ::Proxy::VERSION
76

modules/logs/logs_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
class ::Proxy::LogsPlugin < ::Proxy::Plugin
2-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
2+
rackup_path File.expand_path("http_config.ru", __dir__)
43

54
plugin :logs, ::Proxy::VERSION
65
default_settings :enabled => true

modules/puppet_proxy/puppet_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Proxy::Puppet
22
class Plugin < Proxy::Plugin
3-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
4-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3+
rackup_path File.expand_path("http_config.ru", __dir__)
54

65
plugin :puppet, ::Proxy::VERSION
76

modules/puppetca/puppetca_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Proxy::PuppetCa
22
class Plugin < ::Proxy::Plugin
3-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
4-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3+
rackup_path File.expand_path("http_config.ru", __dir__)
54

65
uses_provider
76
default_settings :use_provider => 'puppetca_hostname_whitelisting'

modules/realm/realm_plugin.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Proxy::Realm
22
class Plugin < ::Proxy::Plugin
3-
http_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
4-
https_rackup_path File.expand_path("http_config.ru", File.expand_path(__dir__))
3+
rackup_path File.expand_path("http_config.ru", __dir__)
54

65
default_settings :use_provider => 'realm_freeipa'
76

0 commit comments

Comments
 (0)