Skip to content

Commit 8607626

Browse files
authored
Merge pull request #26 from reidmv/127-cleanup
Remove 127.0.0.1 special case naming
2 parents efa644f + 33fc095 commit 8607626

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

functions/hosts_with_pe_profile.pp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#
1212
# $hosts: an array of certnames.
1313
#
14-
# Replaces the certname with '127.0.0.1' when the certname matches the localhost.
1514
# Returns ['127.0.0.1'] when PuppetDB returns no hosts.
1615

1716
function puppet_metrics_collector::hosts_with_pe_profile($profile) {
@@ -21,19 +20,16 @@ function puppet_metrics_collector::hosts_with_pe_profile($profile) {
2120
type = 'Class' and
2221
title = 'Puppet_enterprise::Profile::${_profile}' and
2322
nodes { deactivated is null and expired is null }
24-
}").map |$nodes| {
25-
if $nodes['certname'] == $settings::certname {
26-
'127.0.0.1'
27-
} else {
28-
$nodes['certname']
29-
}
30-
}
31-
} else {
23+
}").map |$nodes| { $nodes['certname'] }
24+
}
25+
else {
3226
$hosts = []
3327
}
28+
3429
if empty($hosts) {
3530
['127.0.0.1']
36-
} else {
31+
}
32+
else {
3733
sort($hosts)
3834
}
3935
}

0 commit comments

Comments
 (0)