Skip to content

Instantly share code, notes, and snippets.

@jasperla
Last active December 20, 2015 04:49
Show Gist options
  • Save jasperla/6073805 to your computer and use it in GitHub Desktop.
Save jasperla/6073805 to your computer and use it in GitHub Desktop.
# Calls like this:
# Facter::Util::Resolution.exec("sysctl hw.physmem | cut -d'=' -f2")
# can now be made with:
# Facter::Util::BSD.sysctl("hw.physmem")
module Facter
module Util
module BSD
# Provides a consistent way of invoking sysctl(8) across various BSD platforms
#
# @param mib [String] the sysctl(8) MIB name
#
# @api private
def sysctl(mib)
Facter::Util::Resolution.exec("/sbin/sysctl -n #{mib}")
end
module_function :sysctl
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment