[Pkg-puppet-devel] [facter] 88/180: Consolidate several queries for hw.physmem on BSD.
Stig Sandbeck Mathisen
ssm at debian.org
Mon Jun 30 15:06:34 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit bd5ee8598eca88e4756996cd6618acb7986f8fc5
Author: Jasper Lievisse Adriaanse <jasper at humppa.nl>
Date: Wed Jul 24 21:08:14 2013 +0200
Consolidate several queries for hw.physmem on BSD.
Conflicts:
lib/facter/util/memory.rb
spec/unit/memory_spec.rb
---
lib/facter/util/memory.rb | 6 +-----
spec/unit/memory_spec.rb | 3 +--
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/facter/util/memory.rb b/lib/facter/util/memory.rb
index 818b0fd..9203919 100644
--- a/lib/facter/util/memory.rb
+++ b/lib/facter/util/memory.rb
@@ -111,14 +111,10 @@ module Facter::Memory
def self.mem_size_info(kernel = Facter.value(:kernel))
case kernel
- when /OpenBSD/i
- Facter::Core::Execution.exec("sysctl hw.physmem | cut -d'=' -f2")
- when /FreeBSD/i
+ when /Dragonfly/i, /FreeBSD/i, /OpenBSD/i
Facter::Core::Execution.exec("sysctl -n hw.physmem")
when /Darwin/i
Facter::Core::Execution.exec("sysctl -n hw.memsize")
- when /Dragonfly/i
- Facter::Core::Execution.exec("sysctl -n hw.physmem")
when /AIX/i
if Facter::Core::Execution.exec("/usr/bin/svmon -O unit=KB") =~ /^memory\s+(\d+)\s+/
$1
diff --git a/spec/unit/memory_spec.rb b/spec/unit/memory_spec.rb
index 53a3198..04dc73c 100755
--- a/spec/unit/memory_spec.rb
+++ b/spec/unit/memory_spec.rb
@@ -230,8 +230,7 @@ SVMON
0 0 0 11048 181028 39 0 0 0 0 0 0 1 3 90 17 0 0 100
EOS
Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat)
-
- Facter::Core::Execution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.physmem').returns('267321344')
Facter.collection.internal_loader.load(:memory)
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list