ekohl
September 5, 2019, 9:41am
1
In Foreman 1.22 the Proxy registration protocol changed. This blog takes a look at how it was, how it’ll be and why this is an improvement.
This is a companion discussion topic for the original entry at https://theforeman.org/2019/04/smart-proxy-capabilities-explained.html
Dirk
September 6, 2019, 10:15am
2
Are there already some functions to access the providers, exposed settings and capabilities in Foreman? My idea would be to expose some settings in the Monitoring Smart Proxy and show them in the Service overview for the Smart proxy in Foreman.
ekohl
September 6, 2019, 10:35am
3
There are 2 methods on the SmartProxy model:
def capabilities(feature)
self.smart_proxy_features.find_by(:feature_id => Feature.find_by(:name => feature)).try(:capabilities)
end
def setting(feature, setting)
self.smart_proxy_features.find_by(:feature_id => Feature.find_by(:name => feature)).try(:settings).try(:[], setting)
end
For some examples, we can look at the Puppet module which exposes the the puppet_url
setting:
default_settings :puppet_ssl_ca => '/var/lib/puppet/ssl/certs/ca.pem', :api_timeout => 30
plugin :puppet_proxy_puppet_api, ::Proxy::VERSION
load_validators :url => ::Proxy::Puppet::Validators::UrlValidator
load_programmable_settings ::Proxy::PuppetApi::PluginConfiguration
load_classes ::Proxy::PuppetApi::PluginConfiguration
load_dependency_injection_wirings ::Proxy::PuppetApi::PluginConfiguration
validate :puppet_url, :url => true
expose_setting :puppet_url
validate_readable :puppet_ssl_ca, :puppet_ssl_cert, :puppet_ssl_key
start_services :class_cache_initializer
end
end
I’ve opened a PR to use this:
theforeman:develop
← ekohl:puppet-multi-homing
opened 02:58PM - 26 Feb 19 UTC
When the proxy exposes the puppet_url setting for the Puppet or Puppet CA featur… es this can be used to provide multi homing.
WIP for now since it includes https://github.com/theforeman/foreman/pull/6314. Will also need a proxy component.
Other examples are in the smart_proxy_pulp plugin:
These are used in https://github.com/Katello/katello/blob/master/app/models/katello/concerns/smart_proxy_extensions.rb
I’ll gladly help with patches to the monitoring.
1 Like