Skip to content

Commit

Permalink
FreeBSD: skip read-only MIB data (#48)
Browse files Browse the repository at this point in the history
we will not handle read-only parameters, which are mostly statistics.
In some cases, this significantly reduces the modules operating time.
While Im here, lets get rid of the separate delimiter - FreeBSD allows
you to adjust this with an argument. Issue #47
  • Loading branch information
olevole authored Jan 21, 2021
1 parent aaa98a2 commit 0cb9772
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/puppet/provider/sysctl/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ def self.instances(reference_resource = nil)
# Grab everything else
resources ||= []

sysctl_all_args = '-a'
sep = '='

if Facter.value(:kernel) == 'FreeBSD'
sep = ':'
sysctl_all_args = '-aeW'
end

sysctl('-a').each_line do |line|
sysctl(sysctl_all_args).each_line do |line|
line = line.force_encoding("US-ASCII").scrub("")
value = line.split(sep)

Expand Down

0 comments on commit 0cb9772

Please sign in to comment.