Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dc99d1d
enable management of facter blocking caching
Sep 1, 2025
9ee1f6c
Test parameter location to try to remove top scope depeendcy
Sep 1, 2025
8e3f814
corrected fact formatting inline with style guide
ikonia Sep 1, 2025
15f6331
set variables back to parameters
ikonia Sep 1, 2025
b4aa199
change variable root to params.pp
ikonia Sep 1, 2025
15253e8
define facter parameters for use
ikonia Sep 1, 2025
557c88c
strip trailing parameter comma
ikonia Sep 1, 2025
b7fec5b
includ hocon module as dependency
ikonia Sep 1, 2025
65c4943
formatting and linting tidy
ikonia Sep 1, 2025
3323c41
declare variables directly in facter.pp
ikonia Sep 2, 2025
04439aa
remove facter_blocklist parameters from class scope
ikonia Sep 2, 2025
5b11968
syntax tidy up
ikonia Sep 2, 2025
fe715e5
add missing comma to new dependency definition
ikonia Sep 2, 2025
57a59e4
syntax clean up
ikonia Sep 2, 2025
33439fd
strip empty line, style compliance
ikonia Sep 2, 2025
6ecd129
correct additional white space, style compliance
ikonia Sep 2, 2025
da167fd
removed top scope test value for lint testing
ikonia Sep 2, 2025
d14d800
reformat whitespaces, style guide
ikonia Sep 2, 2025
5be11e3
strip trailing i of facter.conf value
ikonia Sep 2, 2025
212a699
test-suit linter style update
ikonia Sep 2, 2025
8cf1db8
Functionally Complete
Sep 3, 2025
cc85a18
fix missed linting of parameter ordering
Sep 3, 2025
ae857e5
fix additional parameter ordering error
Sep 3, 2025
db5be24
remove conditional puppet version check and brace tidy
Sep 3, 2025
3d03342
refactor identing post if statement removeal
Sep 3, 2025
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
3 changes: 2 additions & 1 deletion manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
class puppet::agent {
contain puppet::agent::install
contain puppet::agent::config
contain puppet::agent::facter
contain puppet::agent::service

Class['puppet::agent::install'] ~> Class['puppet::agent::config', 'puppet::agent::service']
Class['puppet::agent::install'] ~> Class['puppet::agent::config', 'puppet::agent::facter', 'puppet::agent::service']
Class['puppet::config', 'puppet::agent::config'] ~> Class['puppet::agent::service']
}
66 changes: 66 additions & 0 deletions manifests/agent/facter.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Puppet agent facter configuration
# @api private
class puppet::agent::facter (
Optional[Array[String]] $blocklist = undef,
Optional[Array[String]] $cachelist = undef,
String $cache_ttl = '1 day',
) {

Check failure on line 8 in manifests/agent/facter.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

there should be a single space or single newline after an opening brace (check: manifest_whitespace_opening_brace_after)
if versioncmp(fact('aio_agent_version'),'7') >= 0 {
file { '/etc/puppetlabs/facter':
ensure => directory,
}

hocon_setting { 'facter.conf':
path => '/etc/puppetlabs/facter/facter.conf',
require => File['/etc/puppetlabs/facter'],
}

if $blocklist {
hocon_setting { 'blocklist facts group':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we also write json to the facter conf? Then we don't need a dependency to the hocon module.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functionality completed - now moving out of hocon

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure if JSON works, but it's worth a try.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first few tests sort of worked, but added complexity, more work required before discounting

ensure => present,
setting => 'fact-groups.blocked-facts',
value => $blocklist,
type => 'array',
}
-> hocon_setting { 'blocklist facts':
ensure => present,
setting => 'facts.blocklist',
value => ['blocked-facts'],
type => 'array',
}
} else {
hocon_setting { 'blocklist facts group':
ensure => absent,
setting => 'fact-groups.blocked-facts',
}
hocon_setting { 'blocklist facts':
ensure => absent,
setting => 'facts.blocklist',
}
}
if $cachelist {
hocon_setting { 'cachelist facts group':
ensure => present,
setting => 'fact-groups.cached-facts',
value => $cachelist,
type => 'array',
}
-> hocon_setting { 'cachelist facts':
ensure => present,
setting => 'facts.ttls',
value => [{'cached-facts' => $cache_ttl }],

Check failure on line 52 in manifests/agent/facter.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

there should be a single space or single newline after an opening brace (check: manifest_whitespace_opening_brace_after)
type => 'array',
}
} else {
hocon_setting { 'cachelist facts group':
ensure => absent,
setting => 'fact-groups.cached-facts',
}
hocon_setting { 'cachelist facts':
ensure => absent,
setting => 'facts.ttls',
}
}
}
}
4 changes: 4 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
{
"name": "puppet/systemd",
"version_requirement": ">= 2.9.0 < 9.0.0"
},
{
"name": "puppetlabs/hocon",
"version_requirement": ">= 1.1.0 < 2.0.0"
}
],
"requirements": [
Expand Down
Loading