Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
* Wed Jul 29 2026 Steven Pritchard <steve@sicura.us> - 9.0.0
- Replace legacy facts with structured facts (fixes #329)
- `simp::puppetdb` computes percentage-based Java heap sizes from
`$facts['memory']['system']['total_bytes']` in native Puppet instead
of an inline ERB template using the legacy `memorysize_mb` fact
- Acceptance tests query `networking.*` structured facts instead of
the flat `fqdn`, `domain`, `ipaddress_eth1`, and `macaddress_eth1`
facts

* Wed Jul 29 2026 Hazel Caballero <hazel@sicura.us> - 9.0.0
- (#374) Remove all references to the archived pupmod-simp-ntpd module: drop
the `simp/ntpd` metadata dependency and fixture, consolidate the kickstart
Expand Down
10 changes: 9 additions & 1 deletion manifests/puppetdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@

$_simp_manage_firewall = ($manage_firewall and $firewall)

$_java_max_memory = inline_template('<% if @java_max_memory[-1].chr == "%" %><%= (@memorysize_mb.to_f * (@java_max_memory[0..-2].to_f/100.0)).round.to_s + "m" %><% else %><%= @java_max_memory %><% end %>')
# A percentage is converted to megabytes of system memory; anything else is
# passed to Java verbatim
if $java_max_memory =~ /^(\d+(?:\.\d+)?)%$/ {
$_system_memory_mb = Float($facts['memory']['system']['total_bytes']) / 1048576
$_java_max_memory = "${round($_system_memory_mb * Float($1) / 100.0)}m"
}
else {
$_java_max_memory = $java_max_memory
}

if !defined('puppetdb::java_args') or empty($puppetdb::java_args) {
$_java_heapdump_on_oom = $java_heapdump_on_oom ? {
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/suites/netconsole/netconsole_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
describe 'simp::netconsole class' do
let(:shipper) { only_host_with_role(hosts, 'shipper') }
let(:receiver) { only_host_with_role(hosts, 'receiver') }
let(:receiver_ip) { fact_on(receiver, 'ipaddress_eth1') }
let(:receiver_mac) { fact_on(receiver, 'macaddress_eth1') }
let(:receiver_ip) { fact_on(receiver, 'networking.interfaces.eth1.ip') }
let(:receiver_mac) { fact_on(receiver, 'networking.interfaces.eth1.mac') }

context 'should send logs' do
let(:manifest) do
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/suites/scenario_one_shot/00_simp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def wait_for_finalize(host, timeout = 500)
end

hosts.each do |host|
let(:host_fqdn) { fact_on(host, 'fqdn') }
let(:host_fqdn) { fact_on(host, 'networking.fqdn') }
let(:ssh_authorized_key) do
on(host, 'cat ~/.ssh/authorized_keys').stdout.strip.lines.first.split(%r{\s+})[1]
end
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/suites/scenario_poss/00_simp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

hosts.each do |host|
let(:host_fqdn) { fact_on(host, 'fqdn') }
let(:host_fqdn) { fact_on(host, 'networking.fqdn') }
let(:ssh_authorized_key) do
on(host, 'cat ~/.ssh/authorized_keys').stdout.strip.lines.first.split(%r{\s+})[1]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
# Both client and server need these
hosts_with_role(hosts, 'ldap_server').each do |ldap_server|
context 'Test running on current LDAP server #{ldap_server}' do
let(:server_fqdn) { fact_on(ldap_server, 'fqdn') }
let(:base_dn) { fact_on(ldap_server, 'domain').split('.').map { |d| "dc=#{d}" }.join(',') }
let(:server_fqdn) { fact_on(ldap_server, 'networking.fqdn') }
let(:base_dn) { fact_on(ldap_server, 'networking.domain').split('.').map { |d| "dc=#{d}" }.join(',') }
# For now default to openldap server until test includes a 389DS server
let(:ldap_type) do
'389ds'
Expand Down Expand Up @@ -75,7 +75,7 @@
let(:common_hieradata) { File.read(File.expand_path('templates/common_hieradata.yaml.erb', File.dirname(__FILE__))) }
let(:client_hieradata) { File.read(File.expand_path('templates/client_hieradata.yaml.erb', File.dirname(__FILE__))) }
let(:cc_hieradata) { common_hieradata.to_s + "\n#{client_hieradata}" }
let(:client_fqdn) { fact_on(client, 'fqdn') }
let(:client_fqdn) { fact_on(client, 'networking.fqdn') }

it 'configures hiera' do
set_hieradata_on(client, ERB.new(cc_hieradata).result(binding))
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/suites/win_client/00_default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# A Linux host has to be in the nodeset for the setup code
hosts_with_role(hosts, 'windows').each do |host|
let(:host_fqdn) { fact_on(host, 'fqdn') }
let(:host_fqdn) { fact_on(host, 'networking.fqdn') }

it 'applies the test manifest' do
set_hieradata_on(host, hieradata)
Expand Down
25 changes: 25 additions & 0 deletions spec/classes/00_classes/puppetdb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,31 @@
}
end

context 'with a percentage java_max_memory' do
let(:hieradata) { 'simp__puppetdb' }
let(:params) { { java_max_memory: '40%' } }
let(:expected_xmx) do
"#{(os_facts[:memory][:system][:total_bytes].to_f / 1_048_576 * 0.40).round}m"
end

it { is_expected.to compile.with_all_deps }
it 'computes -Xmx from the system memory fact' do
java_args = catalogue.resource('Class[puppetdb]')[:java_args]
expect(java_args['-Xmx']).to eq(expected_xmx)
end
end

context 'with an absolute java_max_memory' do
let(:hieradata) { 'simp__puppetdb' }
let(:params) { { java_max_memory: '2g' } }

it { is_expected.to compile.with_all_deps }
it 'passes -Xmx through verbatim' do
java_args = catalogue.resource('Class[puppetdb]')[:java_args]
expect(java_args['-Xmx']).to eq('2g')
end
end

context 'with read_database_ssl = true' do
let(:hieradata) { 'simp__puppetdb' }
let(:params) { { read_database_ssl: true } }
Expand Down
Loading