Project

General

Profile

« Previous | Next » 

Revision f5d4e70a

Added by Jeremy Kitchen over 10 years ago

fixes #1745 - make puppetmaster hostname/domain stripping behaviour configurable

View differences:

app/models/setting/puppet.rb
self.set('update_environment_from_facts', N_("Should Foreman update a host's environment from its facts"), false),
self.set('remove_classes_not_in_environment', N_("When host and host group have different environments should all classes be included (regardless if they exists or not in the other environment)"), false),
self.set('host_group_matchers_inheritance', N_("Should Foreman use host group ancestors matchers to set puppet classes parameters values"), true),
self.set('create_new_host_when_facts_are_uploaded', N_("Foreman will create the host when new facts are received"), true)
self.set('create_new_host_when_facts_are_uploaded', N_("Foreman will create the host when new facts are received"), true),
self.set('legacy_puppet_hostname', N_("Foreman will truncate hostname to 'puppet' if it starts with puppet"), false)
].compact.each { |s| self.create s.update(:category => "Setting::Puppet")}
true
app/models/smart_proxy.rb
end
def to_s
hostname =~ /^puppet\./ ? "puppet" : hostname
if Setting[:legacy_puppet_hostname]
hostname =~ /^puppet\./ ? "puppet" : hostname
else
hostname
end
end
def to_param
test/fixtures/settings.yml
category: Setting::Provisioning
default: "true"
description: "Should we use the originating IP of the built request to update the Host's IP?"
attribute39:
name: legacy_puppet_hostname
category: Setting::Puppet
default: "false"
description: "Foreman will truncate hostname to 'puppet' if it starts with puppet"
test/unit/smart_proxy_test.rb
end
assert_equal proxy.url, "http://some.proxy:4568"
end
def test_should_honor_legacy_puppet_hostname_true_setting
Setting[:legacy_puppet_hostname] = true
proxy = SmartProxy.new
proxy.name = "test proxy"
proxy.url = "http://puppet.example.com:4568"
assert_equal proxy.to_s, "puppet"
end
def test_should_honor_legacy_puppet_hostname_false_setting
Setting[:legacy_puppet_hostname] = false
proxy = SmartProxy.new
proxy.name = "test proxy"
proxy.url = "http://puppet.example.com:4568"
assert_equal proxy.to_s, "puppet.example.com"
end
end

Also available in: Unified diff