[Pkg-puppet-devel] [facter] 252/352: (maint) Update facts to use Facter::Core::Execution
Stig Sandbeck Mathisen
ssm at debian.org
Sun Apr 6 22:21:50 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 1edaea5ff6eea4c14c24290b19c1ba4cbaed2538
Author: Adrien Thebo <git at somethingsinistral.net>
Date: Thu Feb 13 11:27:46 2014 -0800
(maint) Update facts to use Facter::Core::Execution
When Facter::Core::Execution was extracted, aliases were added from
Facter::Util::Resolution to Facter::Core::Execution for compatibility.
This commit updates all facts using execution methods to use the new
code directly instead of relying on an alias.
---
lib/facter/domain.rb | 4 +-
lib/facter/filesystems.rb | 2 +-
lib/facter/hardwaremodel.rb | 2 +-
lib/facter/hostname.rb | 4 +-
lib/facter/ipaddress.rb | 2 +-
lib/facter/kernel.rb | 2 +-
lib/facter/kernelrelease.rb | 2 +-
lib/facter/ldom.rb | 2 +-
lib/facter/lsbdistcodename.rb | 2 +-
lib/facter/lsbdistdescription.rb | 2 +-
lib/facter/lsbdistid.rb | 2 +-
lib/facter/lsbdistrelease.rb | 2 +-
lib/facter/lsbrelease.rb | 2 +-
lib/facter/macaddress.rb | 2 +-
lib/facter/memory.rb | 16 +++----
lib/facter/operatingsystem.rb | 2 +-
lib/facter/operatingsystemrelease.rb | 2 +-
lib/facter/physicalprocessorcount.rb | 8 ++--
lib/facter/processor.rb | 14 +++---
lib/facter/selinux.rb | 8 ++--
lib/facter/util/architecture.rb | 4 +-
lib/facter/util/ec2.rb | 2 +-
lib/facter/util/file_read.rb | 2 +-
lib/facter/util/ip.rb | 6 +--
lib/facter/util/macosx.rb | 4 +-
lib/facter/util/manufacturer.rb | 6 +--
lib/facter/util/memory.rb | 26 +++++------
lib/facter/util/parser.rb | 4 +-
lib/facter/util/processor.rb | 30 ++++++------
lib/facter/util/resolution.rb | 2 +-
lib/facter/util/solaris_zones.rb | 2 +-
lib/facter/util/uptime.rb | 6 +--
lib/facter/util/virtual.rb | 20 ++++----
lib/facter/util/xendomains.rb | 2 +-
lib/facter/virtual.rb | 8 ++--
lib/facter/zfs_version.rb | 4 +-
lib/facter/zpool_version.rb | 4 +-
spec/unit/domain_spec.rb | 10 ++--
spec/unit/filesystems_spec.rb | 2 +-
spec/unit/hardwareisa_spec.rb | 10 ++--
spec/unit/hardwaremodel_spec.rb | 2 +-
spec/unit/hostname_spec.rb | 8 ++--
spec/unit/id_spec.rb | 6 +--
spec/unit/ipaddress6_spec.rb | 8 ++--
spec/unit/ipaddress_spec.rb | 2 +-
spec/unit/kernel_spec.rb | 2 +-
spec/unit/kernelrelease_spec.rb | 6 +--
spec/unit/kernelversion_spec.rb | 2 +-
spec/unit/ldom_spec.rb | 4 +-
spec/unit/lsbdistcodename_spec.rb | 4 +-
spec/unit/lsbdistdescription_spec.rb | 4 +-
spec/unit/lsbdistid_spec.rb | 4 +-
spec/unit/lsbdistrelease_spec.rb | 4 +-
spec/unit/lsbrelease_spec.rb | 4 +-
spec/unit/memory_spec.rb | 48 ++++++++++----------
spec/unit/operatingsystem_spec.rb | 2 +-
spec/unit/operatingsystemrelease_spec.rb | 2 +-
spec/unit/physicalprocessorcount_spec.rb | 14 +++---
spec/unit/processor_spec.rb | 18 ++++----
spec/unit/selinux_spec.rb | 4 +-
spec/unit/uniqueid_spec.rb | 6 +--
spec/unit/util/ec2_spec.rb | 12 ++---
spec/unit/util/ip_spec.rb | 4 +-
spec/unit/util/macosx_spec.rb | 14 +++---
spec/unit/util/manufacturer_spec.rb | 6 +--
spec/unit/util/parser_spec.rb | 6 +--
spec/unit/util/processor_spec.rb | 4 +-
spec/unit/util/resolution_spec.rb | 6 +--
spec/unit/util/solaris_zones_spec.rb | 10 ++--
spec/unit/util/uptime_spec.rb | 2 +-
spec/unit/util/virtual_spec.rb | 32 ++++++-------
spec/unit/util/xendomains_spec.rb | 4 +-
spec/unit/virtual_spec.rb | 78 ++++++++++++++++----------------
spec/unit/zfs_version_spec.rb | 22 ++++-----
spec/unit/zonename_spec.rb | 2 +-
spec/unit/zones_spec.rb | 2 +-
spec/unit/zpool_version_spec.rb | 22 ++++-----
77 files changed, 308 insertions(+), 308 deletions(-)
diff --git a/lib/facter/domain.rb b/lib/facter/domain.rb
index 9709d92..b8a4ae8 100644
--- a/lib/facter/domain.rb
+++ b/lib/facter/domain.rb
@@ -41,11 +41,11 @@ Facter.add(:domain) do
basic_hostname
end
- if name = Facter::Util::Resolution.exec(hostname_command) \
+ if name = Facter::Core::Execution.exec(hostname_command) \
and name =~ /.*?\.(.+$)/
return_value = $1
- elsif Facter.value(:kernel) != "windows" and domain = Facter::Util::Resolution.exec('dnsdomainname 2> /dev/null') \
+ elsif Facter.value(:kernel) != "windows" and domain = Facter::Core::Execution.exec('dnsdomainname 2> /dev/null') \
and domain =~ /.+/
return_value = domain
diff --git a/lib/facter/filesystems.rb b/lib/facter/filesystems.rb
index a6f028c..6388032 100644
--- a/lib/facter/filesystems.rb
+++ b/lib/facter/filesystems.rb
@@ -18,7 +18,7 @@ Facter.add('filesystems') do
# This is due to some problems with IO#read in Ruby and reading content of
# the "proc" file system that was reported more than once in the past ...
file_systems = []
- Facter::Util::Resolution.exec('cat /proc/filesystems 2> /dev/null').each_line do |line|
+ Facter::Core::Execution.exec('cat /proc/filesystems 2> /dev/null').each_line do |line|
# Remove bloat ...
line.strip!
diff --git a/lib/facter/hardwaremodel.rb b/lib/facter/hardwaremodel.rb
index 48a1b93..7f54ec0 100644
--- a/lib/facter/hardwaremodel.rb
+++ b/lib/facter/hardwaremodel.rb
@@ -18,7 +18,7 @@ end
Facter.add(:hardwaremodel) do
confine :operatingsystem => :aix
setcode do
- model = Facter::Util::Resolution.exec('lsattr -El sys0 -a modelname')
+ model = Facter::Core::Execution.exec('lsattr -El sys0 -a modelname')
if model =~ /modelname\s(\S+)\s/
$1
end
diff --git a/lib/facter/hostname.rb b/lib/facter/hostname.rb
index 4f98b67..8847bfa 100644
--- a/lib/facter/hostname.rb
+++ b/lib/facter/hostname.rb
@@ -14,7 +14,7 @@
Facter.add(:hostname) do
setcode do
hostname = nil
- if name = Facter::Util::Resolution.exec('hostname')
+ if name = Facter::Core::Execution.exec('hostname')
if name =~ /(.*?)\./
hostname = $1
else
@@ -28,6 +28,6 @@ end
Facter.add(:hostname) do
confine :kernel => :darwin, :kernelrelease => "R7"
setcode do
- Facter::Util::Resolution.exec('/usr/sbin/scutil --get LocalHostName')
+ Facter::Core::Execution.exec('/usr/sbin/scutil --get LocalHostName')
end
end
diff --git a/lib/facter/ipaddress.rb b/lib/facter/ipaddress.rb
index 1f8400c..99b2a90 100644
--- a/lib/facter/ipaddress.rb
+++ b/lib/facter/ipaddress.rb
@@ -155,7 +155,7 @@ Facter.add(:ipaddress, :timeout => 2) do
if hostname = Facter.value(:hostname)
# we need Hostname to exist for this to work
host = nil
- if host = Facter::Util::Resolution.exec("host #{hostname}")
+ if host = Facter::Core::Execution.exec("host #{hostname}")
list = host.chomp.split(/\s/)
if defined? list[-1] and
list[-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/
diff --git a/lib/facter/kernel.rb b/lib/facter/kernel.rb
index 31ac22d..d391a24 100644
--- a/lib/facter/kernel.rb
+++ b/lib/facter/kernel.rb
@@ -16,7 +16,7 @@ Facter.add(:kernel) do
if Facter::Util::Config.is_windows?
'windows'
else
- Facter::Util::Resolution.exec("uname -s")
+ Facter::Core::Execution.exec("uname -s")
end
end
end
diff --git a/lib/facter/kernelrelease.rb b/lib/facter/kernelrelease.rb
index 182cfe8..fe7b34b 100644
--- a/lib/facter/kernelrelease.rb
+++ b/lib/facter/kernelrelease.rb
@@ -23,7 +23,7 @@ end
Facter.add(:kernelrelease) do
confine :kernel => "hp-ux"
setcode do
- version = Facter::Util::Resolution.exec('uname -r')
+ version = Facter::Core::Execution.exec('uname -r')
version[2..-1]
end
end
diff --git a/lib/facter/ldom.rb b/lib/facter/ldom.rb
index 3e6f91f..b7cb7bb 100644
--- a/lib/facter/ldom.rb
+++ b/lib/facter/ldom.rb
@@ -1,5 +1,5 @@
if Facter.value(:kernel) == 'SunOS'
- virtinfo = Facter::Util::Resolution.exec('virtinfo -ap')
+ virtinfo = Facter::Core::Execution.exec('virtinfo -ap')
# Convert virtinfo parseable output format to array of arrays.
# DOMAINROLE|impl=LDoms|control=true|io=true|service=true|root=true
diff --git a/lib/facter/lsbdistcodename.rb b/lib/facter/lsbdistcodename.rb
index 0c0f5d9..8b191dd 100644
--- a/lib/facter/lsbdistcodename.rb
+++ b/lib/facter/lsbdistcodename.rb
@@ -13,6 +13,6 @@
Facter.add(:lsbdistcodename) do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
- Facter::Util::Resolution.exec('lsb_release -c -s 2>/dev/null')
+ Facter::Core::Execution.exec('lsb_release -c -s 2>/dev/null')
end
end
diff --git a/lib/facter/lsbdistdescription.rb b/lib/facter/lsbdistdescription.rb
index a4275b2..0250b94 100644
--- a/lib/facter/lsbdistdescription.rb
+++ b/lib/facter/lsbdistdescription.rb
@@ -13,7 +13,7 @@
Facter.add(:lsbdistdescription) do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
- if output = Facter::Util::Resolution.exec('lsb_release -d -s 2>/dev/null')
+ if output = Facter::Core::Execution.exec('lsb_release -d -s 2>/dev/null')
# the output may be quoted (at least it is on gentoo)
output.sub(/^"(.*)"$/,'\1')
end
diff --git a/lib/facter/lsbdistid.rb b/lib/facter/lsbdistid.rb
index 065ef9b..e77ccbc 100644
--- a/lib/facter/lsbdistid.rb
+++ b/lib/facter/lsbdistid.rb
@@ -13,6 +13,6 @@
Facter.add(:lsbdistid) do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
- Facter::Util::Resolution.exec('lsb_release -i -s 2>/dev/null')
+ Facter::Core::Execution.exec('lsb_release -i -s 2>/dev/null')
end
end
diff --git a/lib/facter/lsbdistrelease.rb b/lib/facter/lsbdistrelease.rb
index ae5a9b2..c691b36 100644
--- a/lib/facter/lsbdistrelease.rb
+++ b/lib/facter/lsbdistrelease.rb
@@ -13,6 +13,6 @@
Facter.add(:lsbdistrelease) do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
- Facter::Util::Resolution.exec('lsb_release -r -s 2>/dev/null')
+ Facter::Core::Execution.exec('lsb_release -r -s 2>/dev/null')
end
end
diff --git a/lib/facter/lsbrelease.rb b/lib/facter/lsbrelease.rb
index a1728bb..9b89bc6 100644
--- a/lib/facter/lsbrelease.rb
+++ b/lib/facter/lsbrelease.rb
@@ -13,6 +13,6 @@
Facter.add(:lsbrelease) do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
- Facter::Util::Resolution.exec('lsb_release -v -s 2>/dev/null')
+ Facter::Core::Execution.exec('lsb_release -v -s 2>/dev/null')
end
end
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb
index 3d0dffa..c0b47d5 100644
--- a/lib/facter/macaddress.rb
+++ b/lib/facter/macaddress.rb
@@ -39,7 +39,7 @@ Facter.add(:macaddress) do
confine :osfamily => "Solaris"
setcode do
ether = []
- output = Facter::Util::Resolution.exec("/usr/bin/netstat -np")
+ output = Facter::Core::Execution.exec("/usr/bin/netstat -np")
output.each_line do |s|
ether.push($1) if s =~ /(?:SPLA)\s+(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/
end
diff --git a/lib/facter/memory.rb b/lib/facter/memory.rb
index b9f1d82..8ef0c4f 100644
--- a/lib/facter/memory.rb
+++ b/lib/facter/memory.rb
@@ -86,7 +86,7 @@ if Facter.value(:kernel) == "Darwin"
Facter.add("SwapEncrypted") do
confine :kernel => :Darwin
setcode do
- swap = Facter::Util::Resolution.exec('sysctl vm.swapusage')
+ swap = Facter::Core::Execution.exec('sysctl vm.swapusage')
encrypted = false
if swap =~ /\(encrypted\)/ then encrypted = true; end
encrypted
@@ -99,7 +99,7 @@ if Facter.value(:kernel) == "SunOS"
Facter.add("memorysize_mb") do
confine :kernel => :sunos
# Total memory size available from prtconf
- pconf = Facter::Util::Resolution.exec('/usr/sbin/prtconf 2>/dev/null')
+ pconf = Facter::Core::Execution.exec('/usr/sbin/prtconf 2>/dev/null')
phymem = ""
pconf.each_line do |line|
if line =~ /^Memory size:\s+(\d+) Megabytes/
@@ -143,8 +143,8 @@ end
Facter.add("swapsize_mb") do
confine :kernel => :dragonfly
setcode do
- page_size = Facter::Util::Resolution.exec("/sbin/sysctl -n hw.pagesize").to_f
- swaptotal = Facter::Util::Resolution.exec("/sbin/sysctl -n vm.swap_size").to_f * page_size
+ page_size = Facter::Core::Execution.exec("/sbin/sysctl -n hw.pagesize").to_f
+ swaptotal = Facter::Core::Execution.exec("/sbin/sysctl -n vm.swap_size").to_f * page_size
"%.2f" % [(swaptotal.to_f / 1024.0) / 1024.0]
end
end
@@ -152,10 +152,10 @@ end
Facter.add("swapfree_mb") do
confine :kernel => :dragonfly
setcode do
- page_size = Facter::Util::Resolution.exec("/sbin/sysctl -n hw.pagesize").to_f
- swaptotal = Facter::Util::Resolution.exec("/sbin/sysctl -n vm.swap_size").to_f * page_size
- swap_anon_use = Facter::Util::Resolution.exec("/sbin/sysctl -n vm.swap_anon_use").to_f * page_size
- swap_cache_use = Facter::Util::Resolution.exec("/sbin/sysctl -n vm.swap_cache_use").to_f * page_size
+ page_size = Facter::Core::Execution.exec("/sbin/sysctl -n hw.pagesize").to_f
+ swaptotal = Facter::Core::Execution.exec("/sbin/sysctl -n vm.swap_size").to_f * page_size
+ swap_anon_use = Facter::Core::Execution.exec("/sbin/sysctl -n vm.swap_anon_use").to_f * page_size
+ swap_cache_use = Facter::Core::Execution.exec("/sbin/sysctl -n vm.swap_cache_use").to_f * page_size
swapfree = swaptotal - swap_anon_use - swap_cache_use
"%.2f" % [(swapfree.to_f / 1024.0) / 1024.0]
end
diff --git a/lib/facter/operatingsystem.rb b/lib/facter/operatingsystem.rb
index f8e666e..20f6feb 100644
--- a/lib/facter/operatingsystem.rb
+++ b/lib/facter/operatingsystem.rb
@@ -16,7 +16,7 @@ Facter.add(:operatingsystem) do
setcode do
# Use uname -v because /etc/release can change in zones under SmartOS.
# It's apparently not trustworthy enough to rely on for this fact.
- output = Facter::Util::Resolution.exec('uname -v')
+ output = Facter::Core::Execution.exec('uname -v')
if output =~ /^joyent_/
"SmartOS"
elsif output =~ /^oi_/
diff --git a/lib/facter/operatingsystemrelease.rb b/lib/facter/operatingsystemrelease.rb
index f0d3512..d2adcd9 100644
--- a/lib/facter/operatingsystemrelease.rb
+++ b/lib/facter/operatingsystemrelease.rb
@@ -141,7 +141,7 @@ end
Facter.add(:operatingsystemrelease) do
confine :operatingsystem => %w{VMwareESX}
setcode do
- release = Facter::Util::Resolution.exec('vmware -v')
+ release = Facter::Core::Execution.exec('vmware -v')
if match = /VMware ESX .*?(\d.*)/.match(release)
match[1]
end
diff --git a/lib/facter/physicalprocessorcount.rb b/lib/facter/physicalprocessorcount.rb
index 06a4881..6973545 100644
--- a/lib/facter/physicalprocessorcount.rb
+++ b/lib/facter/physicalprocessorcount.rb
@@ -39,7 +39,7 @@ Facter.add('physicalprocessorcount') do
lookup_pattern = "#{sysfs_cpu_directory}" +
"/cpu*/topology/physical_package_id"
- Dir.glob(lookup_pattern).collect { |f| Facter::Util::Resolution.exec("cat #{f}")}.uniq.size.to_s
+ Dir.glob(lookup_pattern).collect { |f| Facter::Core::Execution.exec("cat #{f}")}.uniq.size.to_s
else
#
@@ -48,7 +48,7 @@ Facter.add('physicalprocessorcount') do
# We assume that /proc/cpuinfo has what we need and is so then we need
# to make sure that we only count unique entries ...
#
- str = Facter::Util::Resolution.exec("grep 'physical.\\+:' /proc/cpuinfo")
+ str = Facter::Core::Execution.exec("grep 'physical.\\+:' /proc/cpuinfo")
if str then str.scan(/\d+/).uniq.size.to_s; end
end
@@ -75,9 +75,9 @@ Facter.add('physicalprocessorcount') do
cmd = "/usr/sbin/psrinfo"
result = nil
if (major_version > 5) or (major_version == 5 and minor_version >= 8) then
- result = Facter::Util::Resolution.exec("#{cmd} -p")
+ result = Facter::Core::Execution.exec("#{cmd} -p")
else
- output = Facter::Util::Resolution.exec(cmd)
+ output = Facter::Core::Execution.exec(cmd)
result = output.split("\n").length.to_s
end
end
diff --git a/lib/facter/processor.rb b/lib/facter/processor.rb
index 586d43d..57d9459 100644
--- a/lib/facter/processor.rb
+++ b/lib/facter/processor.rb
@@ -91,21 +91,21 @@ end
Facter.add("Processor") do
confine :kernel => :openbsd
setcode do
- Facter::Util::Resolution.exec("uname -p")
+ Facter::Core::Execution.exec("uname -p")
end
end
Facter.add("ProcessorCount") do
confine :kernel => :openbsd
setcode do
- Facter::Util::Resolution.exec("sysctl -n hw.ncpu")
+ Facter::Core::Execution.exec("sysctl -n hw.ncpu")
end
end
Facter.add("ProcessorCount") do
confine :kernel => :Darwin
setcode do
- Facter::Util::Resolution.exec("sysctl -n hw.ncpu")
+ Facter::Core::Execution.exec("sysctl -n hw.ncpu")
end
end
@@ -150,14 +150,14 @@ end
Facter.add("Processor") do
confine :kernel => [:dragonfly,:freebsd]
setcode do
- Facter::Util::Resolution.exec("sysctl -n hw.model")
+ Facter::Core::Execution.exec("sysctl -n hw.model")
end
end
Facter.add("ProcessorCount") do
confine :kernel => [:dragonfly,:freebsd]
setcode do
- Facter::Util::Resolution.exec("sysctl -n hw.ncpu")
+ Facter::Core::Execution.exec("sysctl -n hw.ncpu")
end
end
@@ -169,11 +169,11 @@ Facter.add("ProcessorCount") do
result = nil
if (major_version > 5) or (major_version == 5 and minor_version >= 8) then
- if kstat = Facter::Util::Resolution.exec("/usr/bin/kstat cpu_info")
+ if kstat = Facter::Core::Execution.exec("/usr/bin/kstat cpu_info")
result = kstat.scan(/\bcore_id\b\s+\d+/).uniq.length
end
else
- if output = Facter::Util::Resolution.exec("/usr/sbin/psrinfo") then
+ if output = Facter::Core::Execution.exec("/usr/sbin/psrinfo") then
result = output.split("\n").length
end
end
diff --git a/lib/facter/selinux.rb b/lib/facter/selinux.rb
index 0c54cb9..9599d96 100644
--- a/lib/facter/selinux.rb
+++ b/lib/facter/selinux.rb
@@ -22,7 +22,7 @@ def selinux_mount_point
# a hang. Reading from other parts of /proc does not seem to cause this problem.
# The work around is to read the file in another process.
# -- andy Fri Aug 31 2012
- selinux_line = Facter::Util::Resolution.exec('cat /proc/self/mounts').each_line.find { |line| line =~ /selinuxfs/ }
+ selinux_line = Facter::Core::Execution.exec('cat /proc/self/mounts').each_line.find { |line| line =~ /selinuxfs/ }
if selinux_line
path = selinux_line.split[1]
end
@@ -72,7 +72,7 @@ Facter.add("selinux_current_mode") do
confine :selinux => :true
setcode do
result = 'unknown'
- mode = Facter::Util::Resolution.exec(sestatus_cmd)
+ mode = Facter::Core::Execution.exec(sestatus_cmd)
mode.each_line { |l| result = $1 if l =~ /^Current mode\:\s+(\w+)$/i }
result.chomp
end
@@ -82,7 +82,7 @@ Facter.add("selinux_config_mode") do
confine :selinux => :true
setcode do
result = 'unknown'
- mode = Facter::Util::Resolution.exec(sestatus_cmd)
+ mode = Facter::Core::Execution.exec(sestatus_cmd)
mode.each_line { |l| result = $1 if l =~ /^Mode from config file\:\s+(\w+)$/i }
result.chomp
end
@@ -92,7 +92,7 @@ Facter.add("selinux_config_policy") do
confine :selinux => :true
setcode do
result = 'unknown'
- mode = Facter::Util::Resolution.exec(sestatus_cmd)
+ mode = Facter::Core::Execution.exec(sestatus_cmd)
mode.each_line { |l| result = $1 if l =~ /^Policy from config file\:\s+(\w+)$/i }
result.chomp
end
diff --git a/lib/facter/util/architecture.rb b/lib/facter/util/architecture.rb
index c168635..1aeebbd 100644
--- a/lib/facter/util/architecture.rb
+++ b/lib/facter/util/architecture.rb
@@ -2,11 +2,11 @@
module Facter::Util::Architecture
##
- # lsattr is intended to directly delegate to Facter::Util::Resolution.exec in
+ # lsattr is intended to directly delegate to Facter::Core::Execution.exec in
# an effort to make the processorX facts easier to test. See also the
# {lsdev} method.
def self.lsattr(command="lsattr -El proc0 -a type")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
diff --git a/lib/facter/util/ec2.rb b/lib/facter/util/ec2.rb
index c5c393a..c6e5dca 100644
--- a/lib/facter/util/ec2.rb
+++ b/lib/facter/util/ec2.rb
@@ -52,7 +52,7 @@ module Facter::Util::EC2
"arp -an"
end
- if arp_table = Facter::Util::Resolution.exec(arp_command)
+ if arp_table = Facter::Core::Execution.exec(arp_command)
return true if arp_table.match(mac_address_re)
end
return false
diff --git a/lib/facter/util/file_read.rb b/lib/facter/util/file_read.rb
index 2b911ac..c92185a 100644
--- a/lib/facter/util/file_read.rb
+++ b/lib/facter/util/file_read.rb
@@ -7,7 +7,7 @@ module Util
# Ruby, as mocking these behaviors can have wide-ranging effects.
#
# All Facter facts are encouraged to use this method instead of File.read or
-# Facter::Util::Resolution.exec('cat ...')
+# Facter::Core::Execution.exec('cat ...')
#
# @api public
module FileRead
diff --git a/lib/facter/util/ip.rb b/lib/facter/util/ip.rb
index c15a6a1..81bb706 100644
--- a/lib/facter/util/ip.rb
+++ b/lib/facter/util/ip.rb
@@ -96,7 +96,7 @@ module Facter::Util::IP
#
# @return [String] the output of `ifconfig #{arguments} 2>/dev/null` or nil
def self.exec_ifconfig(additional_arguments=[])
- Facter::Util::Resolution.exec("#{self.get_ifconfig} #{additional_arguments.join(' ')}")
+ Facter::Core::Execution.exec("#{self.get_ifconfig} #{additional_arguments.join(' ')}")
end
##
# get_ifconfig looks up the ifconfig binary
@@ -110,7 +110,7 @@ module Facter::Util::IP
# hpux_netstat_in is a delegate method that allows us to stub netstat -in
# without stubbing exec.
def self.hpux_netstat_in
- Facter::Util::Resolution.exec("/bin/netstat -in")
+ Facter::Core::Execution.exec("/bin/netstat -in")
end
def self.get_infiniband_macaddress(interface)
@@ -160,7 +160,7 @@ module Facter::Util::IP
end
def self.hpux_lanscan
- Facter::Util::Resolution.exec("/usr/sbin/lanscan")
+ Facter::Core::Execution.exec("/usr/sbin/lanscan")
end
def self.get_output_for_interface_and_label(interface, label)
diff --git a/lib/facter/util/macosx.rb b/lib/facter/util/macosx.rb
index 17da5b8..73a7916 100644
--- a/lib/facter/util/macosx.rb
+++ b/lib/facter/util/macosx.rb
@@ -15,7 +15,7 @@ module Facter::Util::Macosx
# by looking at the _name key of the _items dict for each _dataType
def self.profiler_xml(data_field)
- Facter::Util::Resolution.exec("/usr/sbin/system_profiler -xml #{data_field}")
+ Facter::Core::Execution.exec("/usr/sbin/system_profiler -xml #{data_field}")
end
def self.intern_xml(xml)
@@ -57,7 +57,7 @@ module Facter::Util::Macosx
def self.sw_vers
ver = Hash.new
[ "productName", "productVersion", "buildVersion" ].each do |option|
- ver["macosx_#{option}"] = Facter::Util::Resolution.exec("/usr/bin/sw_vers -#{option}").strip
+ ver["macosx_#{option}"] = Facter::Core::Execution.exec("/usr/bin/sw_vers -#{option}").strip
end
productversion = ver["macosx_productVersion"]
if not productversion.nil?
diff --git a/lib/facter/util/manufacturer.rb b/lib/facter/util/manufacturer.rb
index ecaa97f..183c52f 100644
--- a/lib/facter/util/manufacturer.rb
+++ b/lib/facter/util/manufacturer.rb
@@ -55,7 +55,7 @@ module Facter::Manufacturer
Facter.add(facterkey) do
confine :kernel => [:openbsd, :darwin]
setcode do
- Facter::Util::Resolution.exec("sysctl -n #{sysctlkey} 2>/dev/null")
+ Facter::Core::Execution.exec("sysctl -n #{sysctlkey} 2>/dev/null")
end
end
end
@@ -63,7 +63,7 @@ module Facter::Manufacturer
def self.prtdiag_sparc_find_system_info()
# Parses prtdiag for a SPARC architecture string, won't work with Solaris x86
- output = Facter::Util::Resolution.exec('/usr/sbin/prtdiag 2>/dev/null')
+ output = Facter::Core::Execution.exec('/usr/sbin/prtdiag 2>/dev/null')
# System Configuration: Sun Microsystems sun4u Sun SPARC Enterprise M3000 Server
if output and output =~ /^System Configuration:\s+(.+?)\s+(sun\d+\S+)\s+(.+)/
@@ -81,7 +81,7 @@ module Facter::Manufacturer
Facter.add('serialnumber') do
setcode do
- Facter::Util::Resolution.exec("/usr/sbin/sneep")
+ Facter::Core::Execution.exec("/usr/sbin/sneep")
end
end
end
diff --git a/lib/facter/util/memory.rb b/lib/facter/util/memory.rb
index 58dca42..818b0fd 100644
--- a/lib/facter/util/memory.rb
+++ b/lib/facter/util/memory.rb
@@ -35,7 +35,7 @@ module Facter::Memory
def self.vmstat_find_free_memory(args = [])
cmd = 'vmstat'
cmd += (' ' + args.join(' ')) unless args.empty?
- row = Facter::Util::Resolution.exec(cmd).split("\n")[-1]
+ row = Facter::Core::Execution.exec(cmd).split("\n")[-1]
if row =~ /^\s*\d+\s*\d+\s*\d+\s*\d+\s*(\d+)/
memfree = $1
end
@@ -52,7 +52,7 @@ module Facter::Memory
pagesize = 0
memspecfree = 0
- vmstats = Facter::Util::Resolution.exec('vm_stat')
+ vmstats = Facter::Core::Execution.exec('vm_stat')
vmstats.each_line do |vmline|
case
when vmline =~ /page\ssize\sof\s(\d+)\sbytes/
@@ -71,7 +71,7 @@ module Facter::Memory
# it's the third value on the line starting with memory
# svmon can be run by non root users
def self.svmon_aix_find_free_memory()
- Facter::Util::Resolution.exec("/usr/bin/svmon -O unit=KB") =~ /^memory\s+\d+\s+\d+\s+(\d+)\s+/
+ Facter::Core::Execution.exec("/usr/bin/svmon -O unit=KB") =~ /^memory\s+\d+\s+\d+\s+(\d+)\s+/
$1
end
@@ -112,15 +112,15 @@ module Facter::Memory
def self.mem_size_info(kernel = Facter.value(:kernel))
case kernel
when /OpenBSD/i
- Facter::Util::Resolution.exec("sysctl hw.physmem | cut -d'=' -f2")
+ Facter::Core::Execution.exec("sysctl hw.physmem | cut -d'=' -f2")
when /FreeBSD/i
- Facter::Util::Resolution.exec("sysctl -n hw.physmem")
+ Facter::Core::Execution.exec("sysctl -n hw.physmem")
when /Darwin/i
- Facter::Util::Resolution.exec("sysctl -n hw.memsize")
+ Facter::Core::Execution.exec("sysctl -n hw.memsize")
when /Dragonfly/i
- Facter::Util::Resolution.exec("sysctl -n hw.physmem")
+ Facter::Core::Execution.exec("sysctl -n hw.physmem")
when /AIX/i
- if Facter::Util::Resolution.exec("/usr/bin/svmon -O unit=KB") =~ /^memory\s+(\d+)\s+/
+ if Facter::Core::Execution.exec("/usr/bin/svmon -O unit=KB") =~ /^memory\s+(\d+)\s+/
$1
end
end
@@ -150,15 +150,15 @@ module Facter::Memory
def self.swap_info(kernel = Facter.value(:kernel))
case kernel
when /AIX/i
- (Facter.value(:id) == "root") ? Facter::Util::Resolution.exec('swap -l 2>/dev/null') : nil
+ (Facter.value(:id) == "root") ? Facter::Core::Execution.exec('swap -l 2>/dev/null') : nil
when /OpenBSD/i
- Facter::Util::Resolution.exec('swapctl -s')
+ Facter::Core::Execution.exec('swapctl -s')
when /FreeBSD/i
- Facter::Util::Resolution.exec('swapinfo -k')
+ Facter::Core::Execution.exec('swapinfo -k')
when /Darwin/i
- Facter::Util::Resolution.exec('sysctl vm.swapusage')
+ Facter::Core::Execution.exec('sysctl vm.swapusage')
when /SunOS/i
- Facter::Util::Resolution.exec('/usr/sbin/swap -l 2>/dev/null')
+ Facter::Core::Execution.exec('/usr/sbin/swap -l 2>/dev/null')
end
end
diff --git a/lib/facter/util/parser.rb b/lib/facter/util/parser.rb
index 1f87134..19f9d17 100644
--- a/lib/facter/util/parser.rb
+++ b/lib/facter/util/parser.rb
@@ -119,7 +119,7 @@ module Facter::Util::Parser
class ScriptParser < Base
def parse_results
- KeyValuePairOutputFormat.parse Facter::Util::Resolution.exec(quote(filename))
+ KeyValuePairOutputFormat.parse Facter::Core::Execution.exec(quote(filename))
end
private
@@ -142,7 +142,7 @@ module Facter::Util::Parser
# Returns a hash of facts from powershell output
def parse_results
shell_command = "powershell -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File \"#{filename}\""
- KeyValuePairOutputFormat.parse Facter::Util::Resolution.exec(shell_command)
+ KeyValuePairOutputFormat.parse Facter::Core::Execution.exec(shell_command)
end
end
diff --git a/lib/facter/util/processor.rb b/lib/facter/util/processor.rb
index 335dcf6..05a5f98 100644
--- a/lib/facter/util/processor.rb
+++ b/lib/facter/util/processor.rb
@@ -47,19 +47,19 @@ module Processor
end
##
- # lsdev is intended to directly delegate to Facter::Util::Resolution.exec in an
+ # lsdev is intended to directly delegate to Facter::Core::Execution.exec in an
# effort to make the processorX facts easier to test by stubbing only the
# behaviors we need to stub to get the output of the system command.
def self.lsdev(command="lsdev -Cc processor")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
- # lsattr is intended to directly delegate to Facter::Util::Resolution.exec in
+ # lsattr is intended to directly delegate to Facter::Core::Execution.exec in
# an effort to make the processorX facts easier to test. See also the
# {lsdev} method.
def self.lsattr(command="lsattr -El proc0 -a type")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
@@ -181,34 +181,34 @@ module Processor
private_class_method :read_unistd_h
##
- # machinfo delegates directly to Facter::Util::Resolution.exec, as with lsdev
+ # machinfo delegates directly to Facter::Core::Execution.exec, as with lsdev
# above.
def self.machinfo(command="/usr/contrib/bin/machinfo")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
- # model delegates directly to Facter::Util::Resolution.exec.
+ # model delegates directly to Facter::Core::Execution.exec.
def self.model(command="model")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
- # ioscan delegates directly to Facter::Util::Resolution.exec.
+ # ioscan delegates directly to Facter::Core::Execution.exec.
def self.ioscan(command="ioscan -fknCprocessor")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
- # getconf_cpu_version delegates directly to Facter::Util::Resolution.exec.
+ # getconf_cpu_version delegates directly to Facter::Core::Execution.exec.
def self.getconf_cpu_version(command="getconf CPU_VERSION")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
##
- # getconf_cpu_chip_type delegates directly to Facter::Util::Resolution.exec.
+ # getconf_cpu_chip_type delegates directly to Facter::Core::Execution.exec.
def self.getconf_cpu_chip_type(command="getconf CPU_CHIP_TYPE")
- Facter::Util::Resolution.exec(command)
+ Facter::Core::Execution.exec(command)
end
def self.enum_cpuinfo
@@ -272,7 +272,7 @@ module Processor
processor_num = -1
processor_list = []
Thread::exclusive do
- kstat = Facter::Util::Resolution.exec('/usr/bin/kstat cpu_info')
+ kstat = Facter::Core::Execution.exec('/usr/bin/kstat cpu_info')
if kstat
kstat.each_line do |l|
if l =~ /cpu_info(\d+)/
diff --git a/lib/facter/util/resolution.rb b/lib/facter/util/resolution.rb
index 007a4b8..d7564c2 100644
--- a/lib/facter/util/resolution.rb
+++ b/lib/facter/util/resolution.rb
@@ -145,7 +145,7 @@ class Facter::Util::Resolution
if @code.is_a? Proc
@code.call()
else
- Facter::Util::Resolution.exec(@code)
+ Facter::Core::Execution.exec(@code)
end
end
end
diff --git a/lib/facter/util/solaris_zones.rb b/lib/facter/util/solaris_zones.rb
index 28bfbe3..881baa7 100644
--- a/lib/facter/util/solaris_zones.rb
+++ b/lib/facter/util/solaris_zones.rb
@@ -93,7 +93,7 @@ module Util
#
# @return [Hash] the parsed output of the zoneadm command
def refresh
- @zoneadm_output = Facter::Util::Resolution.exec(zoneadm_cmd)
+ @zoneadm_output = Facter::Core::Execution.exec(zoneadm_cmd)
parse!
end
diff --git a/lib/facter/util/uptime.rb b/lib/facter/util/uptime.rb
index 2fab9f4..8af2af2 100644
--- a/lib/facter/util/uptime.rb
+++ b/lib/facter/util/uptime.rb
@@ -20,19 +20,19 @@ module Facter::Util::Uptime
private
def self.uptime_proc_uptime
- if output = Facter::Util::Resolution.exec("/bin/cat #{uptime_file} 2>/dev/null")
+ if output = Facter::Core::Execution.exec("/bin/cat #{uptime_file} 2>/dev/null")
output.chomp.split(" ").first.to_i
end
end
def self.uptime_sysctl
- if output = Facter::Util::Resolution.exec("#{uptime_sysctl_cmd} 2>/dev/null")
+ if output = Facter::Core::Execution.exec("#{uptime_sysctl_cmd} 2>/dev/null")
compute_uptime(Time.at(output.match(/\d+/)[0].to_i))
end
end
def self.uptime_executable
- if output = Facter::Util::Resolution.exec("#{uptime_executable_cmd} 2>/dev/null")
+ if output = Facter::Core::Execution.exec("#{uptime_executable_cmd} 2>/dev/null")
up=0
if output =~ /(\d+) day(?:s|\(s\))?,\s+(\d+):(\d+)/
# Regexp handles Solaris, AIX, HP-UX, and Tru64.
diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb
index d224781..e655838 100644
--- a/lib/facter/util/virtual.rb
+++ b/lib/facter/util/virtual.rb
@@ -4,7 +4,7 @@ module Facter::Util::Virtual
##
# virt_what is a delegating helper method intended to make it easier to stub
# the system call without affecting other calls to
- # Facter::Util::Resolution.exec
+ # Facter::Core::Execution.exec
#
# Per https://bugzilla.redhat.com/show_bug.cgi?id=719611 when run as a
# non-root user the virt-what command may emit an error message on stdout,
@@ -12,7 +12,7 @@ module Facter::Util::Virtual
# method ensures stderr is redirected and that error messages are stripped
# from stdout.
def self.virt_what(command = "virt-what")
- command = Facter::Util::Resolution.which(command)
+ command = Facter::Core::Execution.which(command)
return unless command
if Facter.value(:kernel) == 'windows'
@@ -20,15 +20,15 @@ module Facter::Util::Virtual
else
redirected_cmd = "#{command} 2>/dev/null"
end
- output = Facter::Util::Resolution.exec redirected_cmd
+ output = Facter::Core::Execution.exec redirected_cmd
output.gsub(/^virt-what: .*$/, '') if output
end
##
# lspci is a delegating helper method intended to make it easier to stub the
- # system call without affecting other calls to Facter::Util::Resolution.exec
+ # system call without affecting other calls to Facter::Core::Execution.exec
def self.lspci(command = "lspci 2>/dev/null")
- Facter::Util::Resolution.exec command
+ Facter::Core::Execution.exec command
end
def self.openvz?
@@ -40,7 +40,7 @@ module Facter::Util::Virtual
return false unless self.openvz?
return false unless FileTest.exists?( '/proc/self/status' )
- envid = Facter::Util::Resolution.exec( 'grep "envID" /proc/self/status' )
+ envid = Facter::Core::Execution.exec( 'grep "envID" /proc/self/status' )
if envid =~ /^envID:\s+0$/i
return 'openvzhn'
elsif envid =~ /^envID:\s+(\d+)$/i
@@ -56,7 +56,7 @@ module Facter::Util::Virtual
def self.zone?
return true if FileTest.directory?("/.SUNWnative")
- z = Facter::Util::Resolution.exec("/sbin/zonename")
+ z = Facter::Core::Execution.exec("/sbin/zonename")
return false unless z
return z.chomp != 'global'
end
@@ -92,7 +92,7 @@ module Facter::Util::Virtual
txt = if FileTest.exists?("/proc/cpuinfo")
File.read("/proc/cpuinfo")
elsif ["FreeBSD", "OpenBSD"].include? Facter.value(:kernel)
- Facter::Util::Resolution.exec("/sbin/sysctl -n hw.model")
+ Facter::Core::Execution.exec("/sbin/sysctl -n hw.model")
end
(txt =~ /QEMU Virtual CPU/) ? true : false
end
@@ -123,11 +123,11 @@ module Facter::Util::Virtual
when "FreeBSD" then "/sbin"
when "GNU/kFreeBSD" then "/bin"
end
- Facter::Util::Resolution.exec("#{path}/sysctl -n security.jail.jailed") == "1"
+ Facter::Core::Execution.exec("#{path}/sysctl -n security.jail.jailed") == "1"
end
def self.hpvm?
- Facter::Util::Resolution.exec("/usr/bin/getconf MACHINE_MODEL").chomp =~ /Virtual Machine/
+ Facter::Core::Execution.exec("/usr/bin/getconf MACHINE_MODEL").chomp =~ /Virtual Machine/
end
def self.zlinux?
diff --git a/lib/facter/util/xendomains.rb b/lib/facter/util/xendomains.rb
index 6b0d403..5432ddd 100644
--- a/lib/facter/util/xendomains.rb
+++ b/lib/facter/util/xendomains.rb
@@ -2,7 +2,7 @@
#
module Facter::Util::Xendomains
def self.get_domains
- if xm_list = Facter::Util::Resolution.exec('/usr/sbin/xm list 2>/dev/null')
+ if xm_list = Facter::Core::Execution.exec('/usr/sbin/xm list 2>/dev/null')
domains = xm_list.split("\n").reject { |line| line =~ /^(Name|Domain-0)/ }
domains.map { |line| line.split(/\s/)[0] }.join(',')
end
diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index 416aff1..bc07bb9 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -60,7 +60,7 @@ Facter.add("virtual") do
setcode do
next "zone" if Facter::Util::Virtual.zone?
- output = Facter::Util::Resolution.exec('prtdiag')
+ output = Facter::Core::Execution.exec('prtdiag')
if output
lines = output.split("\n")
next "parallels" if lines.any? {|l| l =~ /Parallels/ }
@@ -91,7 +91,7 @@ Facter.add("virtual") do
confine :kernel => 'OpenBSD'
has_weight 10
setcode do
- output = Facter::Util::Resolution.exec('sysctl -n hw.product 2>/dev/null')
+ output = Facter::Core::Execution.exec('sysctl -n hw.product 2>/dev/null')
if output
lines = output.split("\n")
next "parallels" if lines.any? {|l| l =~ /Parallels/ }
@@ -132,7 +132,7 @@ Facter.add("virtual") do
end
# Parse dmidecode
- output = Facter::Util::Resolution.exec('dmidecode 2> /dev/null')
+ output = Facter::Core::Execution.exec('dmidecode 2> /dev/null')
if output
lines = output.split("\n")
next "parallels" if lines.any? {|l| l =~ /Parallels/ }
@@ -145,7 +145,7 @@ Facter.add("virtual") do
end
# Sample output of vmware -v `VMware Server 1.0.5 build-80187`
- output = Facter::Util::Resolution.exec("vmware -v")
+ output = Facter::Core::Execution.exec("vmware -v")
if output
mdata = output.match /(\S+)\s+(\S+)/
next "#{mdata[1]}_#{mdata[2]}".downcase if mdata
diff --git a/lib/facter/zfs_version.rb b/lib/facter/zfs_version.rb
index 8eeee11..3427eee 100644
--- a/lib/facter/zfs_version.rb
+++ b/lib/facter/zfs_version.rb
@@ -2,8 +2,8 @@ require 'facter'
Facter.add('zfs_version') do
setcode do
- if Facter::Util::Resolution.which('zfs')
- zfs_v = Facter::Util::Resolution.exec('zfs upgrade -v')
+ if Facter::Core::Execution.which('zfs')
+ zfs_v = Facter::Core::Execution.exec('zfs upgrade -v')
zfs_version = zfs_v.scan(/^\s+(\d+)\s+/m).flatten.last unless zfs_v.nil?
end
end
diff --git a/lib/facter/zpool_version.rb b/lib/facter/zpool_version.rb
index d182b2d..05a117a 100644
--- a/lib/facter/zpool_version.rb
+++ b/lib/facter/zpool_version.rb
@@ -2,8 +2,8 @@ require 'facter'
Facter.add('zpool_version') do
setcode do
- if Facter::Util::Resolution.which('zpool')
- zpool_v = Facter::Util::Resolution.exec('zpool upgrade -v')
+ if Facter::Core::Execution.which('zpool')
+ zpool_v = Facter::Core::Execution.exec('zpool upgrade -v')
zpool_version = zpool_v.match(/ZFS pool version (\d+)./).captures.first unless zpool_v.nil?
end
end
diff --git a/spec/unit/domain_spec.rb b/spec/unit/domain_spec.rb
index a2c1385..c3701d5 100755
--- a/spec/unit/domain_spec.rb
+++ b/spec/unit/domain_spec.rb
@@ -24,11 +24,11 @@ describe "Domain name facts" do
let(:dnsdomain_command) { "dnsdomainname 2> /dev/null" }
def the_hostname_is(value)
- Facter::Util::Resolution.stubs(:exec).with(hostname_command).returns(value)
+ Facter::Core::Execution.stubs(:exec).with(hostname_command).returns(value)
end
def the_dnsdomainname_is(value)
- Facter::Util::Resolution.stubs(:exec).with(dnsdomain_command).returns(value)
+ Facter::Core::Execution.stubs(:exec).with(dnsdomain_command).returns(value)
end
before do
@@ -197,7 +197,7 @@ describe "Domain name facts" do
it "should return nil" do
expects_dnsdomains([nil])
- Facter::Util::Resolution.stubs(:exec).with(hostname_command).returns('sometest')
+ Facter::Core::Execution.stubs(:exec).with(hostname_command).returns('sometest')
FileTest.stubs(:exists?).with("/etc/resolv.conf").returns(false)
Facter.fact(:domain).value.should be_nil
@@ -288,8 +288,8 @@ describe "Domain name facts" do
describe scenario[:scenario] do
before(:each) do
- Facter::Util::Resolution.stubs(:exec).with("hostname -f 2> /dev/null").returns(scenario[:hostname])
- Facter::Util::Resolution.stubs(:exec).with("dnsdomainname 2> /dev/null").returns(scenario[:dnsdomainname])
+ Facter::Core::Execution.stubs(:exec).with("hostname -f 2> /dev/null").returns(scenario[:hostname])
+ Facter::Core::Execution.stubs(:exec).with("dnsdomainname 2> /dev/null").returns(scenario[:dnsdomainname])
resolv_conf_contains(
"search #{scenario[:resolve_search]}",
"domain #{scenario[:resolve_domain]}"
diff --git a/spec/unit/filesystems_spec.rb b/spec/unit/filesystems_spec.rb
index 8ed6da2..fbe3805 100644
--- a/spec/unit/filesystems_spec.rb
+++ b/spec/unit/filesystems_spec.rb
@@ -14,7 +14,7 @@ describe 'Filesystem facts' do
before :each do
Facter.fact(:kernel).stubs(:value).returns('Linux')
fixture_data = my_fixture_read('linux')
- Facter::Util::Resolution.expects(:exec) \
+ Facter::Core::Execution.expects(:exec) \
.with('cat /proc/filesystems 2> /dev/null').returns(fixture_data)
Facter.collection.internal_loader.load(:filesystems)
end
diff --git a/spec/unit/hardwareisa_spec.rb b/spec/unit/hardwareisa_spec.rb
index a709e8c..39bb705 100755
--- a/spec/unit/hardwareisa_spec.rb
+++ b/spec/unit/hardwareisa_spec.rb
@@ -6,35 +6,35 @@ require 'facter'
describe "Hardwareisa fact" do
it "should match uname -p on Linux" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Inky")
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Inky")
Facter.fact(:hardwareisa).value.should == "Inky"
end
it "should match uname -p on Darwin" do
Facter.fact(:kernel).stubs(:value).returns("Darwin")
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Blinky")
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Blinky")
Facter.fact(:hardwareisa).value.should == "Blinky"
end
it "should match uname -p on SunOS" do
Facter.fact(:kernel).stubs(:value).returns("SunOS")
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Pinky")
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Pinky")
Facter.fact(:hardwareisa).value.should == "Pinky"
end
it "should match uname -p on FreeBSD" do
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Clyde")
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Clyde")
Facter.fact(:hardwareisa).value.should == "Clyde"
end
it "should match uname -m on HP-UX" do
Facter.fact(:kernel).stubs(:value).returns("HP-UX")
- Facter::Util::Resolution.stubs(:exec).with("uname -m").returns("Pac-Man")
+ Facter::Core::Execution.stubs(:exec).with("uname -m").returns("Pac-Man")
Facter.fact(:hardwareisa).value.should == "Pac-Man"
end
diff --git a/spec/unit/hardwaremodel_spec.rb b/spec/unit/hardwaremodel_spec.rb
index 29c893d..0a8e9ee 100644
--- a/spec/unit/hardwaremodel_spec.rb
+++ b/spec/unit/hardwaremodel_spec.rb
@@ -6,7 +6,7 @@ require 'facter'
describe "Hardwaremodel fact" do
it "should match uname -m by default" do
Facter.fact(:kernel).stubs(:value).returns("Darwin")
- Facter::Util::Resolution.stubs(:exec).with("uname -m").returns("Inky")
+ Facter::Core::Execution.stubs(:exec).with("uname -m").returns("Inky")
Facter.fact(:hardwaremodel).value.should == "Inky"
end
diff --git a/spec/unit/hostname_spec.rb b/spec/unit/hostname_spec.rb
index 0c31493..a787031 100755
--- a/spec/unit/hostname_spec.rb
+++ b/spec/unit/hostname_spec.rb
@@ -11,17 +11,17 @@ describe "Hostname facts" do
end
it "should use the hostname command" do
- Facter::Util::Resolution.expects(:exec).with('hostname').at_least_once
+ Facter::Core::Execution.expects(:exec).with('hostname').at_least_once
Facter.fact(:hostname).value.should be_nil
end
it "should use hostname as the fact if unqualified" do
- Facter::Util::Resolution.stubs(:exec).with('hostname').returns('host1')
+ Facter::Core::Execution.stubs(:exec).with('hostname').returns('host1')
Facter.fact(:hostname).value.should == "host1"
end
it "should truncate the domain name if qualified" do
- Facter::Util::Resolution.stubs(:exec).with('hostname').returns('host1.example.com')
+ Facter::Core::Execution.stubs(:exec).with('hostname').returns('host1.example.com')
Facter.fact(:hostname).value.should == "host1"
end
end
@@ -33,7 +33,7 @@ describe "Hostname facts" do
end
it "should use scutil to get the hostname" do
- Facter::Util::Resolution.expects(:exec).with('/usr/sbin/scutil --get LocalHostName').returns("host1")
+ Facter::Core::Execution.expects(:exec).with('/usr/sbin/scutil --get LocalHostName').returns("host1")
Facter.fact(:hostname).value.should == "host1"
end
end
diff --git a/spec/unit/id_spec.rb b/spec/unit/id_spec.rb
index e89aae4..b2eff37 100755
--- a/spec/unit/id_spec.rb
+++ b/spec/unit/id_spec.rb
@@ -12,7 +12,7 @@ describe "id fact" do
it "should return the current user" do
given_a_configuration_of(:is_windows => k == 'windows')
Facter.fact(:kernel).stubs(:value).returns(k)
- Facter::Util::Resolution.expects(:exec).once.with('whoami').returns 'bar'
+ Facter::Core::Execution.expects(:exec).once.with('whoami').returns 'bar'
Facter.fact(:id).value.should == 'bar'
end
@@ -21,8 +21,8 @@ describe "id fact" do
it "should return the current user on Solaris" do
given_a_configuration_of(:is_windows => false)
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
- Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('SunOS')
+ Facter::Core::Execution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
Facter.fact(:id).value.should == 'bar'
end
diff --git a/spec/unit/ipaddress6_spec.rb b/spec/unit/ipaddress6_spec.rb
index 1c9153d..729fb9b 100755
--- a/spec/unit/ipaddress6_spec.rb
+++ b/spec/unit/ipaddress6_spec.rb
@@ -15,7 +15,7 @@ describe "The IPv6 address fact" do
end
it "should return ipaddress6 information for Darwin" do
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Darwin')
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Darwin')
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
Facter::Util::IP.stubs(:exec_ifconfig).with(["-a"]).
returns(ifconfig_fixture('darwin_ifconfig_all_with_multiple_interfaces'))
@@ -24,7 +24,7 @@ describe "The IPv6 address fact" do
end
it "should return ipaddress6 information for Linux" do
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Linux')
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
Facter::Util::IP.stubs(:exec_ifconfig).with(["2>/dev/null"]).
returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces'))
@@ -33,7 +33,7 @@ describe "The IPv6 address fact" do
end
it "should return ipaddress6 information for Linux with recent net-tools" do
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Linux')
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
Facter::Util::IP.stubs(:exec_ifconfig).with(["2>/dev/null"]).
returns(ifconfig_fixture('ifconfig_net_tools_1.60.txt'))
@@ -42,7 +42,7 @@ describe "The IPv6 address fact" do
end
it "should return ipaddress6 information for Solaris" do
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('SunOS')
Facter::Util::IP.stubs(:get_ifconfig).returns("/usr/sbin/ifconfig")
Facter::Util::IP.stubs(:exec_ifconfig).with(["-a"]).
returns(ifconfig_fixture('sunos_ifconfig_all_with_multiple_interfaces'))
diff --git a/spec/unit/ipaddress_spec.rb b/spec/unit/ipaddress_spec.rb
index 674b743..39eb97c 100755
--- a/spec/unit/ipaddress_spec.rb
+++ b/spec/unit/ipaddress_spec.rb
@@ -60,7 +60,7 @@ describe "ipaddress fact" do
context "when you have no active network adapter" do
it "should return nil if there are no active (or any) network adapters" do
Facter::Util::WMI.expects(:execquery).with(Facter::Util::IP::Windows::WMI_IP_INFO_QUERY).returns([])
- Facter::Util::Resolution.stubs(:exec)
+ Facter::Core::Execution.stubs(:exec)
Facter.value(:ipaddress).should == nil
end
diff --git a/spec/unit/kernel_spec.rb b/spec/unit/kernel_spec.rb
index 37d3431..ab80b80 100644
--- a/spec/unit/kernel_spec.rb
+++ b/spec/unit/kernel_spec.rb
@@ -16,7 +16,7 @@ describe "Kernel fact" do
describe "on everything else" do
it "should return the kernel using 'uname -s'" do
given_a_configuration_of(:is_windows => false)
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns("test_kernel")
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns("test_kernel")
Facter.fact(:kernel).value.should == 'test_kernel'
end
diff --git a/spec/unit/kernelrelease_spec.rb b/spec/unit/kernelrelease_spec.rb
index 8566d4a..94eec12 100644
--- a/spec/unit/kernelrelease_spec.rb
+++ b/spec/unit/kernelrelease_spec.rb
@@ -21,7 +21,7 @@ describe "Kernel release fact" do
describe "on AIX" do
before do
Facter.fact(:kernel).stubs(:value).returns("aix")
- Facter::Util::Resolution.stubs(:exec).with('oslevel -s').returns("test_kernel")
+ Facter::Core::Execution.stubs(:exec).with('oslevel -s').returns("test_kernel")
end
it "should return the kernel release" do
@@ -32,7 +32,7 @@ describe "Kernel release fact" do
describe "on HP-UX" do
before do
Facter.fact(:kernel).stubs(:value).returns("hp-ux")
- Facter::Util::Resolution.stubs(:exec).with('uname -r').returns("B.11.31")
+ Facter::Core::Execution.stubs(:exec).with('uname -r').returns("B.11.31")
end
it "should remove preceding letters" do
@@ -43,7 +43,7 @@ describe "Kernel release fact" do
describe "on everything else" do
before do
Facter.fact(:kernel).stubs(:value).returns("linux")
- Facter::Util::Resolution.stubs(:exec).with('uname -r').returns("test_kernel")
+ Facter::Core::Execution.stubs(:exec).with('uname -r').returns("test_kernel")
end
it "should return the kernel release" do
diff --git a/spec/unit/kernelversion_spec.rb b/spec/unit/kernelversion_spec.rb
index 98cedcc..93ee061 100644
--- a/spec/unit/kernelversion_spec.rb
+++ b/spec/unit/kernelversion_spec.rb
@@ -7,7 +7,7 @@ describe "Kernel version fact" do
describe "on Solaris/Sun OS" do
before do
Facter.fact(:kernel).stubs(:value).returns('sunos')
- Facter::Util::Resolution.stubs(:exec).with('uname -v').returns("1.234.5")
+ Facter::Core::Execution.stubs(:exec).with('uname -v').returns("1.234.5")
end
it "should return the kernel version using 'uname -v'" do
diff --git a/spec/unit/ldom_spec.rb b/spec/unit/ldom_spec.rb
index f97d4a8..416134c 100644
--- a/spec/unit/ldom_spec.rb
+++ b/spec/unit/ldom_spec.rb
@@ -15,7 +15,7 @@ describe "ldom fact" do
before :each do
# For virtinfo documentation:
# http://docs.oracle.com/cd/E23824_01/html/821-1462/virtinfo-1m.html
- Facter::Util::Resolution.stubs(:exec).with("virtinfo -ap").
+ Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").
returns(ldom_fixtures('ldom_v1'))
Facter.collection.internal_loader.load(:ldom)
end
@@ -63,7 +63,7 @@ describe "ldom fact" do
describe "when running on non ldom hardware" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("virtinfo -ap").returns(nil)
+ Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").returns(nil)
Facter.collection.internal_loader.load(:ldom)
end
diff --git a/spec/unit/lsbdistcodename_spec.rb b/spec/unit/lsbdistcodename_spec.rb
index d0297ca..6516c4c 100755
--- a/spec/unit/lsbdistcodename_spec.rb
+++ b/spec/unit/lsbdistcodename_spec.rb
@@ -11,12 +11,12 @@ describe "lsbdistcodename fact" do
end
it "should return the codename through lsb_release -c -s 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns 'n/a'
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns 'n/a'
Facter.fact(:lsbdistcodename).value.should == 'n/a'
end
it "should return nil if lsb_release is not installed" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns nil
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns nil
Facter.fact(:lsbdistcodename).value.should be_nil
end
end
diff --git a/spec/unit/lsbdistdescription_spec.rb b/spec/unit/lsbdistdescription_spec.rb
index a73612e..bca930e 100755
--- a/spec/unit/lsbdistdescription_spec.rb
+++ b/spec/unit/lsbdistdescription_spec.rb
@@ -11,12 +11,12 @@ describe "lsbdistdescription fact" do
end
it "should return the description through lsb_release -d -s 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns '"Gentoo Base System release 2.1"'
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns '"Gentoo Base System release 2.1"'
Facter.fact(:lsbdistdescription).value.should == 'Gentoo Base System release 2.1'
end
it "should return nil if lsb_release is not installed" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns nil
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns nil
Facter.fact(:lsbdistdescription).value.should be_nil
end
end
diff --git a/spec/unit/lsbdistid_spec.rb b/spec/unit/lsbdistid_spec.rb
index b204a5f..bec2fc5 100755
--- a/spec/unit/lsbdistid_spec.rb
+++ b/spec/unit/lsbdistid_spec.rb
@@ -11,12 +11,12 @@ describe "lsbdistid fact" do
end
it "should return the id through lsb_release -i -s 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns 'Gentoo'
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns 'Gentoo'
Facter.fact(:lsbdistid).value.should == 'Gentoo'
end
it "should return nil if lsb_release is not installed 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns nil
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns nil
Facter.fact(:lsbdistid).value.should be_nil
end
end
diff --git a/spec/unit/lsbdistrelease_spec.rb b/spec/unit/lsbdistrelease_spec.rb
index c356e90..1d9476d 100755
--- a/spec/unit/lsbdistrelease_spec.rb
+++ b/spec/unit/lsbdistrelease_spec.rb
@@ -11,12 +11,12 @@ describe "lsbdistrelease fact" do
end
it "should return the release through lsb_release -r -s 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns '2.1'
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns '2.1'
Facter.fact(:lsbdistrelease).value.should == '2.1'
end
it "should return nil if lsb_release is not installed" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns nil
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns nil
Facter.fact(:lsbdistrelease).value.should be_nil
end
end
diff --git a/spec/unit/lsbrelease_spec.rb b/spec/unit/lsbrelease_spec.rb
index b0d5c93..18bf751 100755
--- a/spec/unit/lsbrelease_spec.rb
+++ b/spec/unit/lsbrelease_spec.rb
@@ -11,12 +11,12 @@ describe "lsbrelease fact" do
end
it "should return the release through lsb_release -v -s 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns 'n/a'
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns 'n/a'
Facter.fact(:lsbrelease).value.should == 'n/a'
end
it "should return nil if lsb_release is not installed" do
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns nil
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns nil
Facter.fact(:lsbrelease).value.should be_nil
end
end
diff --git a/spec/unit/memory_spec.rb b/spec/unit/memory_spec.rb
index dd1eb76..53a3198 100755
--- a/spec/unit/memory_spec.rb
+++ b/spec/unit/memory_spec.rb
@@ -48,7 +48,7 @@ describe "Memory facts" do
before(:each) do
Facter.clear
Facter.fact(:kernel).stubs(:value).returns("Darwin")
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.memsize').returns('8589934592')
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.memsize').returns('8589934592')
sample_vm_stat = <<VMSTAT
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 28430.
@@ -64,8 +64,8 @@ Pageins: 13862917.
Pageouts: 1384383.
Object cache: 14 hits of 2619925 lookups (0% hit rate)
VMSTAT
- Facter::Util::Resolution.stubs(:exec).with('vm_stat').returns(sample_vm_stat)
- Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 1.00M free = 63.00M (encrypted)")
+ Facter::Core::Execution.stubs(:exec).with('vm_stat').returns(sample_vm_stat)
+ Facter::Core::Execution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 1.00M free = 63.00M (encrypted)")
Facter.collection.internal_loader.load(:memory)
end
@@ -154,7 +154,7 @@ device maj,min total free
/dev/hd6 10, 2 512MB 508MB
SWAP
- Facter::Util::Resolution.stubs(:exec).with('swap -l 2>/dev/null').returns(swapusage)
+ Facter::Core::Execution.stubs(:exec).with('swap -l 2>/dev/null').returns(swapusage)
svmon = <<SVMON
Unit: KB
@@ -168,7 +168,7 @@ pin 1478228 0 0 953852
in use 4448928 0 5499480
SVMON
- Facter::Util::Resolution.stubs(:exec).with('/usr/bin/svmon -O unit=KB').returns(svmon)
+ Facter::Core::Execution.stubs(:exec).with('/usr/bin/svmon -O unit=KB').returns(svmon)
Facter.collection.internal_loader.load(:memory)
end
@@ -222,16 +222,16 @@ SVMON
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
- Facter::Util::Resolution.stubs(:exec).with('swapctl -s').returns(swapusage)
+ Facter::Core::Execution.stubs(:exec).with('swapctl -s').returns(swapusage)
vmstat = <<EOS
procs memory page disks traps cpu
r b w avm fre flt re pi po fr sr cd0 sd0 int sys cs us sy id
0 0 0 11048 181028 39 0 0 0 0 0 0 1 3 90 17 0 0 100
EOS
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
+ Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat)
- Facter::Util::Resolution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
+ Facter::Core::Execution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
Facter.collection.internal_loader.load(:memory)
end
@@ -267,14 +267,14 @@ Memory size: 2048 Megabytes
System Peripherals (Software Nodes):
PRTCONF
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/prtconf 2>/dev/null').returns sample_prtconf
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/prtconf 2>/dev/null').returns sample_prtconf
vmstat_lines = <<VMSTAT
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr s0 s3 -- -- in sy cs us sy id
0 0 0 1154552 476224 8 19 0 0 0 0 0 0 0 0 0 460 294 236 1 2 97
VMSTAT
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat_lines)
+ Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat_lines)
end
after(:each) do
@@ -287,7 +287,7 @@ VMSTAT
swapfile dev swaplo blocks free
/dev/swap 4294967295,4294967295 16 2097136 2097136
SWAP
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
Facter.collection.internal_loader.load(:memory)
end
@@ -316,7 +316,7 @@ swapfile dev swaplo blocks free
/dev/swap 4294967295,4294967295 16 2097136 2097136
/dev/swap2 4294967295,4294967295 16 2097136 2097136
SWAP
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
Facter.collection.internal_loader.load(:memory)
end
@@ -339,7 +339,7 @@ SWAP
describe "when no swap exists" do
before(:each) do
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns ""
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns ""
Facter.collection.internal_loader.load(:memory)
end
@@ -368,19 +368,19 @@ SWAP
Facter.fact(:kernel).stubs(:value).returns("dragonfly")
swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n hw.pagesize').returns("4096")
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_size').returns("128461")
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_anon_use').returns("2635")
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_cache_use').returns("0")
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n hw.pagesize').returns("4096")
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n vm.swap_size').returns("128461")
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n vm.swap_anon_use').returns("2635")
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n vm.swap_cache_use').returns("0")
vmstat = <<EOS
procs memory page disks faults cpu
r b w avm fre flt re pi po fr sr da0 sg1 in sy cs us sy id
0 0 0 33152 13940 1902120 2198 53119 11642 6544597 5460994 0 0 6148243 7087927 3484264 0 1 9
EOS
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
+ Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat)
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.physmem").returns('248512512')
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.physmem").returns('248512512')
Facter.collection.internal_loader.load(:memory)
end
@@ -416,11 +416,11 @@ EOS
r b w avm fre flt re pi po fr sr da0 cd0 in sy cs us sy id
1 0 0 207600 656640 10 0 0 0 13 0 0 0 51 164 257 0 1 99
VM_STAT
- Facter::Util::Resolution.stubs(:exec).with('vmstat -H').returns sample_vmstat
+ Facter::Core::Execution.stubs(:exec).with('vmstat -H').returns sample_vmstat
sample_physmem = <<PHYSMEM
1056276480
PHYSMEM
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.physmem').returns sample_physmem
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.physmem').returns sample_physmem
end
after(:each) do
@@ -432,7 +432,7 @@ PHYSMEM
sample_swapinfo = <<SWAP
Device 1K-blocks Used Avail Capacity
SWAP
- Facter::Util::Resolution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
+ Facter::Core::Execution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
Facter.collection.internal_loader.load(:memory)
end
@@ -460,7 +460,7 @@ SWAP
Device 1K-blocks Used Avail Capacity
/dev/da0p3 2048540 0 1048540 0%
SWAP
- Facter::Util::Resolution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
+ Facter::Core::Execution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
Facter.collection.internal_loader.load(:memory)
end
@@ -489,7 +489,7 @@ Device 1K-blocks Used Avail Capacity
/dev/da0p3 2048540 0 1048540 0%
/dev/da0p4 3048540 0 1048540 0%
SWAP
- Facter::Util::Resolution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
+ Facter::Core::Execution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
Facter.collection.internal_loader.load(:memory)
end
diff --git a/spec/unit/operatingsystem_spec.rb b/spec/unit/operatingsystem_spec.rb
index 794b9ca..97236c9 100755
--- a/spec/unit/operatingsystem_spec.rb
+++ b/spec/unit/operatingsystem_spec.rb
@@ -40,7 +40,7 @@ describe "Operating System fact" do
"OpenIndiana" => "oi_151a",
}.each_pair do |distribution, string|
it "should be #{distribution} if uname -v is '#{string}'" do
- Facter::Util::Resolution.stubs(:exec).with('uname -v').returns(string)
+ Facter::Core::Execution.stubs(:exec).with('uname -v').returns(string)
Facter.fact(:operatingsystem).value.should == distribution
end
end
diff --git a/spec/unit/operatingsystemrelease_spec.rb b/spec/unit/operatingsystemrelease_spec.rb
index 781ee98..dd9370d 100755
--- a/spec/unit/operatingsystemrelease_spec.rb
+++ b/spec/unit/operatingsystemrelease_spec.rb
@@ -51,7 +51,7 @@ describe "Operating System Release fact" do
Facter.fact(:kernelrelease).stubs(:value).returns("4.1.0")
Facter.fact(:operatingsystem).stubs(:value).returns("VMwareESX")
- Facter::Util::Resolution.stubs(:exec).with('vmware -v').returns('foo')
+ Facter::Core::Execution.stubs(:exec).with('vmware -v').returns('foo')
Facter.fact(:operatingsystemrelease).value
end
diff --git a/spec/unit/physicalprocessorcount_spec.rb b/spec/unit/physicalprocessorcount_spec.rb
index 1e957fc..acdd646 100755
--- a/spec/unit/physicalprocessorcount_spec.rb
+++ b/spec/unit/physicalprocessorcount_spec.rb
@@ -12,7 +12,7 @@ describe "Physical processor count facts" do
it "should return one physical CPU" do
Dir.stubs(:glob).with("/sys/devices/system/cpu/cpu*/topology/physical_package_id").returns(["/sys/devices/system/cpu/cpu0/topology/physical_package_id"])
- Facter::Util::Resolution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu0/topology/physical_package_id").returns("0")
+ Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu0/topology/physical_package_id").returns("0")
Facter.fact(:physicalprocessorcount).value.should == "1"
end
@@ -25,10 +25,10 @@ describe "Physical processor count facts" do
/sys/devices/system/cpu/cpu3/topology/physical_package_id
})
- Facter::Util::Resolution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu0/topology/physical_package_id").returns("0")
- Facter::Util::Resolution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu1/topology/physical_package_id").returns("1")
- Facter::Util::Resolution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu2/topology/physical_package_id").returns("2")
- Facter::Util::Resolution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu3/topology/physical_package_id").returns("3")
+ Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu0/topology/physical_package_id").returns("0")
+ Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu1/topology/physical_package_id").returns("1")
+ Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu2/topology/physical_package_id").returns("2")
+ Facter::Core::Execution.stubs(:exec).with("cat /sys/devices/system/cpu/cpu3/topology/physical_package_id").returns("3")
Facter.fact(:physicalprocessorcount).value.should == "4"
end
@@ -58,7 +58,7 @@ describe "Physical processor count facts" do
Facter.fact(:kernel).stubs(:value).returns(:sunos)
Facter.stubs(:value).with(:kernelrelease).returns(release)
- Facter::Util::Resolution.expects(:exec).with("/usr/sbin/psrinfo -p").returns("1")
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo -p").returns("1")
Facter.fact(:physicalprocessorcount).value.should == "1"
end
end
@@ -68,7 +68,7 @@ describe "Physical processor count facts" do
Facter.fact(:kernel).stubs(:value).returns(:sunos)
Facter.stubs(:value).with(:kernelrelease).returns(release)
- Facter::Util::Resolution.expects(:exec).with("/usr/sbin/psrinfo").returns(psrinfo)
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo").returns(psrinfo)
Facter.fact(:physicalprocessorcount).value.should == "2"
end
end
diff --git a/spec/unit/processor_spec.rb b/spec/unit/processor_spec.rb
index c3894fd..717f942 100755
--- a/spec/unit/processor_spec.rb
+++ b/spec/unit/processor_spec.rb
@@ -185,35 +185,35 @@ describe "Processor facts" do
it "should be 2 on dual-processor Darwin box" do
Facter.fact(:kernel).stubs(:value).returns("Darwin")
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
Facter.fact(:processorcount).value.should == "2"
end
it "should be 2 on dual-processor OpenBSD box" do
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
Facter.fact(:processorcount).value.should == "2"
end
it "should be 2 on dual-processor FreeBSD box" do
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
Facter.fact(:processorcount).value.should == "2"
end
it "should print the correct CPU Model on FreeBSD" do
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.model").returns('SomeVendor CPU 3GHz')
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.model").returns('SomeVendor CPU 3GHz')
Facter.fact(:processor).value.should == "SomeVendor CPU 3GHz"
end
it "should be 2 on dual-processor DragonFly box" do
Facter.fact(:kernel).stubs(:value).returns("DragonFly")
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.ncpu").returns('2')
Facter.fact(:processorcount).value.should == "2"
end
@@ -239,8 +239,8 @@ describe "Processor facts" do
it "uses kstat on release #{release} (#{arch})" do
Facter.stubs(:value).with(:kernelrelease).returns(release)
- Facter::Util::Resolution.expects(:exec).with("/usr/sbin/psrinfo").never
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/kstat cpu_info").returns(self.send("kstat_#{arch}".intern))
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo").never
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/kstat cpu_info").returns(self.send("kstat_#{arch}".intern))
Facter.fact(:processorcount).value.should == '8'
end
end
@@ -251,8 +251,8 @@ describe "Processor facts" do
Facter.stubs(:value).with(:kernelrelease).returns(release)
fixture_data = File.read(fixtures('processorcount','solaris-psrinfo'))
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/kstat cpu_info").never
- Facter::Util::Resolution.expects(:exec).with("/usr/sbin/psrinfo").returns(fixture_data)
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/kstat cpu_info").never
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/psrinfo").returns(fixture_data)
Facter.fact(:processorcount).value.should == '24'
end
end
diff --git a/spec/unit/selinux_spec.rb b/spec/unit/selinux_spec.rb
index 647fbb6..9241bec 100755
--- a/spec/unit/selinux_spec.rb
+++ b/spec/unit/selinux_spec.rb
@@ -105,7 +105,7 @@ describe "SELinux facts" do
end
def sestatus_is(status)
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/sestatus').returns(status)
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/sestatus').returns(status)
end
def mounts_does_not_exist
@@ -114,7 +114,7 @@ describe "SELinux facts" do
def mounts_contains(*lines)
FileTest.expects(:exists?).with("/proc/self/mounts").returns true
- Facter::Util::Resolution.expects(:exec).with("cat /proc/self/mounts").returns(lines.join("\n"))
+ Facter::Core::Execution.expects(:exec).with("cat /proc/self/mounts").returns(lines.join("\n"))
end
end
diff --git a/spec/unit/uniqueid_spec.rb b/spec/unit/uniqueid_spec.rb
index e9870d3..93adb79 100755
--- a/spec/unit/uniqueid_spec.rb
+++ b/spec/unit/uniqueid_spec.rb
@@ -6,21 +6,21 @@ require 'facter'
describe "Uniqueid fact" do
it "should match hostid on Solaris" do
Facter.fact(:kernel).stubs(:value).returns("SunOS")
- Facter::Util::Resolution.stubs(:exec).with("hostid").returns("Larry")
+ Facter::Core::Execution.stubs(:exec).with("hostid").returns("Larry")
Facter.fact(:uniqueid).value.should == "Larry"
end
it "should match hostid on Linux" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
- Facter::Util::Resolution.stubs(:exec).with("hostid").returns("Curly")
+ Facter::Core::Execution.stubs(:exec).with("hostid").returns("Curly")
Facter.fact(:uniqueid).value.should == "Curly"
end
it "should match hostid on AIX" do
Facter.fact(:kernel).stubs(:value).returns("AIX")
- Facter::Util::Resolution.stubs(:exec).with("hostid").returns("Moe")
+ Facter::Core::Execution.stubs(:exec).with("hostid").returns("Moe")
Facter.fact(:uniqueid).value.should == "Moe"
end
diff --git a/spec/unit/util/ec2_spec.rb b/spec/unit/util/ec2_spec.rb
index c894e59..f963db6 100755
--- a/spec/unit/util/ec2_spec.rb
+++ b/spec/unit/util/ec2_spec.rb
@@ -17,21 +17,21 @@ describe Facter::Util::EC2 do
it "should succeed if arp table contains fe:ff:ff:ff:ff:ff" do
ec2arp = my_fixture_read("linux-arp-ec2.out")
- Facter::Util::Resolution.expects(:exec).with("arp -an").\
+ Facter::Core::Execution.expects(:exec).with("arp -an").\
at_least_once.returns(ec2arp)
Facter::Util::EC2.has_ec2_arp?.should == true
end
it "should succeed if arp table contains FE:FF:FF:FF:FF:FF" do
ec2arp = my_fixture_read("centos-arp-ec2.out")
- Facter::Util::Resolution.expects(:exec).with("arp -an").\
+ Facter::Core::Execution.expects(:exec).with("arp -an").\
at_least_once.returns(ec2arp)
Facter::Util::EC2.has_ec2_arp?.should == true
end
it "should fail if arp table does not contain fe:ff:ff:ff:ff:ff" do
ec2arp = my_fixture_read("linux-arp-not-ec2.out")
- Facter::Util::Resolution.expects(:exec).with("arp -an").
+ Facter::Core::Execution.expects(:exec).with("arp -an").
at_least_once.returns(ec2arp)
Facter::Util::EC2.has_ec2_arp?.should == false
end
@@ -45,14 +45,14 @@ describe Facter::Util::EC2 do
it "should succeed if arp table contains fe-ff-ff-ff-ff-ff" do
ec2arp = my_fixture_read("windows-2008-arp-a.out")
- Facter::Util::Resolution.expects(:exec).with("arp -a").\
+ Facter::Core::Execution.expects(:exec).with("arp -a").\
at_least_once.returns(ec2arp)
Facter::Util::EC2.has_ec2_arp?.should == true
end
it "should fail if arp table does not contain fe-ff-ff-ff-ff-ff" do
ec2arp = my_fixture_read("windows-2008-arp-a-not-ec2.out")
- Facter::Util::Resolution.expects(:exec).with("arp -a").
+ Facter::Core::Execution.expects(:exec).with("arp -a").
at_least_once.returns(ec2arp)
Facter::Util::EC2.has_ec2_arp?.should == false
end
@@ -66,7 +66,7 @@ describe Facter::Util::EC2 do
it "should fail if arp table does not contain fe:ff:ff:ff:ff:ff" do
ec2arp = my_fixture_read("solaris8_arp_a_not_ec2.out")
- Facter::Util::Resolution.expects(:exec).with("arp -a").
+ Facter::Core::Execution.expects(:exec).with("arp -a").
at_least_once.returns(ec2arp)
Facter::Util::EC2.has_ec2_arp?.should == false
diff --git a/spec/unit/util/ip_spec.rb b/spec/unit/util/ip_spec.rb
index 67772b4..ace30e0 100755
--- a/spec/unit/util/ip_spec.rb
+++ b/spec/unit/util/ip_spec.rb
@@ -408,14 +408,14 @@ describe Facter::Util::IP do
it "support additional arguments" do
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
- Facter::Util::Resolution.stubs(:exec).with("/sbin/ifconfig -a")
+ Facter::Core::Execution.stubs(:exec).with("/sbin/ifconfig -a")
Facter::Util::IP.exec_ifconfig(["-a"])
end
it "joins multiple arguments correctly" do
Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
- Facter::Util::Resolution.stubs(:exec).with("/sbin/ifconfig -a -e -i -j")
+ Facter::Core::Execution.stubs(:exec).with("/sbin/ifconfig -a -e -i -j")
Facter::Util::IP.exec_ifconfig(["-a","-e","-i","-j"])
end
diff --git a/spec/unit/util/macosx_spec.rb b/spec/unit/util/macosx_spec.rb
index 94b967a..d65aa08 100755
--- a/spec/unit/util/macosx_spec.rb
+++ b/spec/unit/util/macosx_spec.rb
@@ -27,7 +27,7 @@ describe Facter::Util::Macosx do
end
it "should be able to retrieve profiler data as xml for a given data field" do
- Facter::Util::Resolution.expects(:exec).with("/usr/sbin/system_profiler -xml foo").returns "yay"
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/system_profiler -xml foo").returns "yay"
Facter::Util::Macosx.profiler_xml("foo").should == "yay"
end
@@ -80,17 +80,17 @@ describe Facter::Util::Macosx do
describe "when working out software version" do
before do
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/sw_vers -productName").returns "Mac OS X"
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/sw_vers -buildVersion").returns "9J62"
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/sw_vers -productName").returns "Mac OS X"
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/sw_vers -buildVersion").returns "9J62"
end
it "should have called sw_vers three times when determining software version" do
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "10.5.7"
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "10.5.7"
Facter::Util::Macosx.sw_vers
end
it "should return a hash with the correct keys when determining software version" do
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "10.5.7"
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "10.5.7"
Facter::Util::Macosx.sw_vers.keys.sort.should == ["macosx_productName",
"macosx_buildVersion",
"macosx_productversion_minor",
@@ -99,14 +99,14 @@ describe Facter::Util::Macosx do
end
it "should split a product version of 'x.y.z' into separate hash entries correctly" do
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "1.2.3"
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "1.2.3"
sw_vers = Facter::Util::Macosx.sw_vers
sw_vers["macosx_productversion_major"].should == "1.2"
sw_vers["macosx_productversion_minor"].should == "3"
end
it "should treat a product version of 'x.y' as 'x.y.0" do
- Facter::Util::Resolution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "2.3"
+ Facter::Core::Execution.expects(:exec).with("/usr/bin/sw_vers -productVersion").returns "2.3"
Facter::Util::Macosx.sw_vers["macosx_productversion_minor"].should == "0"
end
end
diff --git a/spec/unit/util/manufacturer_spec.rb b/spec/unit/util/manufacturer_spec.rb
index 20ba72f..f1dea56 100755
--- a/spec/unit/util/manufacturer_spec.rb
+++ b/spec/unit/util/manufacturer_spec.rb
@@ -18,14 +18,14 @@ describe Facter::Manufacturer do
end
it "should parse prtdiag output on a sunfire v120" do
- Facter::Util::Resolution.stubs(:exec).returns(my_fixture_read("solaris_sunfire_v120_prtdiag"))
+ Facter::Core::Execution.stubs(:exec).returns(my_fixture_read("solaris_sunfire_v120_prtdiag"))
Facter::Manufacturer.prtdiag_sparc_find_system_info()
Facter.value(:manufacturer).should == "Sun Microsystems"
Facter.value(:productname).should == "Sun Fire V120 (UltraSPARC-IIe 648MHz)"
end
it "should parse prtdiag output on a t5220" do
- Facter::Util::Resolution.stubs(:exec).returns(my_fixture_read("solaris_t5220_prtdiag"))
+ Facter::Core::Execution.stubs(:exec).returns(my_fixture_read("solaris_t5220_prtdiag"))
Facter::Manufacturer.prtdiag_sparc_find_system_info()
Facter.value(:manufacturer).should == "Sun Microsystems"
Facter.value(:productname).should == "SPARC Enterprise T5220"
@@ -36,7 +36,7 @@ describe Facter::Manufacturer do
Facter.fact(:kernel).stubs(:value).returns("SunOS")
Facter.fact(:hardwareisa).stubs(:value).returns("sparc")
- Facter::Util::Resolution.stubs(:exec).with(regexp_matches(/prtdiag/)).returns(nil)
+ Facter::Core::Execution.stubs(:exec).with(regexp_matches(/prtdiag/)).returns(nil)
Facter::Manufacturer.prtdiag_sparc_find_system_info()
Facter.value(:manufacturer).should_not == "Sun Microsystems"
end
diff --git a/spec/unit/util/parser_spec.rb b/spec/unit/util/parser_spec.rb
index f6e28e5..f7e0af1 100755
--- a/spec/unit/util/parser_spec.rb
+++ b/spec/unit/util/parser_spec.rb
@@ -95,7 +95,7 @@ describe Facter::Util::Parser do
let(:data_in_txt) { "one=two\nthree=four\n" }
def expects_script_to_return(path, content, result)
- Facter::Util::Resolution.stubs(:exec).with(path).returns(content)
+ Facter::Core::Execution.stubs(:exec).with(path).returns(content)
File.stubs(:executable?).with(path).returns(true)
File.stubs(:file?).with(path).returns(true)
@@ -123,7 +123,7 @@ describe Facter::Util::Parser do
it "quotes scripts with spaces" do
path = "/h a s s p a c e s#{ext}"
- Facter::Util::Resolution.expects(:exec).with("\"#{path}\"").returns(data_in_txt)
+ Facter::Core::Execution.expects(:exec).with("\"#{path}\"").returns(data_in_txt)
expects_script_to_return(path, data_in_txt, data)
end
@@ -176,7 +176,7 @@ describe Facter::Util::Parser do
def expects_to_parse_powershell(cmd, content, result)
Facter::Util::Config.stubs(:is_windows?).returns(true)
- Facter::Util::Resolution.stubs(:exec).returns(content)
+ Facter::Core::Execution.stubs(:exec).returns(content)
File.stubs(:file?).with(ps1).returns(true)
Facter::Util::Parser.parser_for(cmd).results.should == result
diff --git a/spec/unit/util/processor_spec.rb b/spec/unit/util/processor_spec.rb
index 5637a7b..a659acb 100755
--- a/spec/unit/util/processor_spec.rb
+++ b/spec/unit/util/processor_spec.rb
@@ -70,14 +70,14 @@ describe Facter::Util::Processor do
it "should get the processor description on Solaris (x86)" do
Facter.fact(:architecture).stubs(:value).returns("i86pc")
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/kstat cpu_info").returns(my_fixture_read("solaris-i86pc"))
+ Facter::Core::Execution.stubs(:exec).with("/usr/bin/kstat cpu_info").returns(my_fixture_read("solaris-i86pc"))
Facter::Util::Processor.enum_kstat[0].should == "Intel(r) Core(tm) i5 CPU M 450 @ 2.40GHz"
end
it "should get the processor description on Solaris (SPARC64)" do
Facter.fact(:architecture).stubs(:value).returns("sun4u")
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/kstat cpu_info").returns(my_fixture_read("solaris-sun4u"))
+ Facter::Core::Execution.stubs(:exec).with("/usr/bin/kstat cpu_info").returns(my_fixture_read("solaris-sun4u"))
Facter::Util::Processor.enum_kstat[0].should == "SPARC64-VII"
Facter::Util::Processor.enum_kstat[1].should == "SPARC64-VII"
diff --git a/spec/unit/util/resolution_spec.rb b/spec/unit/util/resolution_spec.rb
index 2d7c119..71bf168 100755
--- a/spec/unit/util/resolution_spec.rb
+++ b/spec/unit/util/resolution_spec.rb
@@ -65,7 +65,7 @@ describe Facter::Util::Resolution do
describe "and setcode has not been called" do
it "should return nil" do
- Facter::Util::Resolution.expects(:exec).with(nil, nil).never
+ Facter::Core::Execution.expects(:exec).with(nil, nil).never
resolution.value.should be_nil
end
end
@@ -78,7 +78,7 @@ describe Facter::Util::Resolution do
it "should return the result of executing the code" do
resolution.setcode "/bin/foo"
- Facter::Util::Resolution.expects(:exec).once.with("/bin/foo").returns "yup"
+ Facter::Core::Execution.expects(:exec).once.with("/bin/foo").returns "yup"
expect(resolution.value).to eq "yup"
end
@@ -91,7 +91,7 @@ describe Facter::Util::Resolution do
it "should return the result of executing the code" do
resolution.setcode "/bin/foo"
- Facter::Util::Resolution.expects(:exec).once.with("/bin/foo").returns "yup"
+ Facter::Core::Execution.expects(:exec).once.with("/bin/foo").returns "yup"
expect(resolution.value).to eq "yup"
end
diff --git a/spec/unit/util/solaris_zones_spec.rb b/spec/unit/util/solaris_zones_spec.rb
index c5c48ef..c7d4a05 100644
--- a/spec/unit/util/solaris_zones_spec.rb
+++ b/spec/unit/util/solaris_zones_spec.rb
@@ -47,7 +47,7 @@ describe Facter::Util::SolarisZones do
describe '#refresh' do
it 'executes the zoneadm_cmd' do
- Facter::Util::Resolution.expects(:exec).with(subject.zoneadm_cmd).returns(zone_list)
+ Facter::Core::Execution.expects(:exec).with(subject.zoneadm_cmd).returns(zone_list)
subject.refresh
end
end
@@ -69,7 +69,7 @@ describe Facter::Util::SolarisZones do
it 'uses a single read of the system information for all of the dynamically generated zone facts' do
given_initial_zone_facts # <= single read happens here
- Facter::Util::Resolution.expects(:exec).never
+ Facter::Core::Execution.expects(:exec).never
Facter.fact(:zone_zoneA_id).value
Facter.fact(:zone_local_id).value
end
@@ -101,7 +101,7 @@ describe Facter::Util::SolarisZones do
given_initial_zone_facts
when_facts_have_been_resolved_then_flushed
- Facter::Util::Resolution.expects(:exec).once.returns(zone_list2)
+ Facter::Core::Execution.expects(:exec).once.returns(zone_list2)
Facter.fact(:zones).value
Facter.fact(:zone_zoneA_id).value
Facter.fact(:zone_local_id).value
@@ -111,7 +111,7 @@ describe Facter::Util::SolarisZones do
end
def given_initial_zone_facts
- Facter::Util::Resolution.stubs(:exec).
+ Facter::Core::Execution.stubs(:exec).
with(subject.zoneadm_cmd).
returns(zone_list)
described_class.add_facts
@@ -121,7 +121,7 @@ describe Facter::Util::SolarisZones do
Facter.fact(:zones).value
Facter.fact(:zone_zoneA_id).value
Facter.fact(:zone_local_id).value
- Facter::Util::Resolution.stubs(:exec).returns(zone_list2)
+ Facter::Core::Execution.stubs(:exec).returns(zone_list2)
Facter.flush
end
end
diff --git a/spec/unit/util/uptime_spec.rb b/spec/unit/util/uptime_spec.rb
index 4bbbb75..06472a0 100755
--- a/spec/unit/util/uptime_spec.rb
+++ b/spec/unit/util/uptime_spec.rb
@@ -99,7 +99,7 @@ describe Facter::Util::Uptime do
test_cases.each do |uptime, expected|
it "should return #{expected} for #{uptime}" do
- Facter::Util::Resolution.stubs(:exec).with('uptime 2>/dev/null').returns(uptime)
+ Facter::Core::Execution.stubs(:exec).with('uptime 2>/dev/null').returns(uptime)
Facter.fact(:uptime_seconds).value.should == expected
end
end
diff --git a/spec/unit/util/virtual_spec.rb b/spec/unit/util/virtual_spec.rb
index 5caaacb..9414f8e 100755
--- a/spec/unit/util/virtual_spec.rb
+++ b/spec/unit/util/virtual_spec.rb
@@ -30,31 +30,31 @@ describe Facter::Util::Virtual do
it "should identify openvzhn when /proc/self/status has envID of 0" do
Facter::Util::Virtual.stubs(:openvz?).returns(true)
FileTest.stubs(:exists?).with("/proc/self/status").returns(true)
- Facter::Util::Resolution.stubs(:exec).with('grep "envID" /proc/self/status').returns("envID: 0")
+ Facter::Core::Execution.stubs(:exec).with('grep "envID" /proc/self/status').returns("envID: 0")
Facter::Util::Virtual.openvz_type().should == "openvzhn"
end
it "should identify openvzve when /proc/self/status has envID of 0" do
Facter::Util::Virtual.stubs(:openvz?).returns(true)
FileTest.stubs(:exists?).with('/proc/self/status').returns(true)
- Facter::Util::Resolution.stubs(:exec).with('grep "envID" /proc/self/status').returns("envID: 666")
+ Facter::Core::Execution.stubs(:exec).with('grep "envID" /proc/self/status').returns("envID: 666")
Facter::Util::Virtual.openvz_type().should == "openvzve"
end
it "should not attempt to identify openvz when /proc/self/status has no envID" do
Facter::Util::Virtual.stubs(:openvz?).returns(true)
FileTest.stubs(:exists?).with('/proc/self/status').returns(true)
- Facter::Util::Resolution.stubs(:exec).with('grep "envID" /proc/self/status').returns("")
+ Facter::Core::Execution.stubs(:exec).with('grep "envID" /proc/self/status').returns("")
Facter::Util::Virtual.openvz_type().should be_nil
end
it "should identify Solaris zones when non-global zone" do
- Facter::Util::Resolution.stubs(:exec).with("/sbin/zonename").returns("somezone")
+ Facter::Core::Execution.stubs(:exec).with("/sbin/zonename").returns("somezone")
Facter::Util::Virtual.should be_zone
end
it "should not identify Solaris zones when global zone" do
- Facter::Util::Resolution.stubs(:exec).with("/sbin/zonename").returns("global")
+ Facter::Core::Execution.stubs(:exec).with("/sbin/zonename").returns("global")
Facter::Util::Virtual.should_not be_zone
end
@@ -91,7 +91,7 @@ describe Facter::Util::Virtual do
it "should identify kvm" do
Facter::Util::Virtual.stubs(:kvm?).returns(true)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("something")
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("something")
Facter::Util::Virtual.kvm_type().should == "kvm"
end
@@ -202,38 +202,38 @@ describe Facter::Util::Virtual do
it "should detect kvm on FreeBSD" do
FileTest.stubs(:exists?).with("/proc/cpuinfo").returns(false)
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
- Facter::Util::Resolution.stubs(:exec).with("/sbin/sysctl -n hw.model").returns("QEMU Virtual CPU version 0.12.4")
+ Facter::Core::Execution.stubs(:exec).with("/sbin/sysctl -n hw.model").returns("QEMU Virtual CPU version 0.12.4")
Facter::Util::Virtual.should be_kvm
end
it "should detect kvm on OpenBSD" do
FileTest.stubs(:exists?).with("/proc/cpuinfo").returns(false)
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
- Facter::Util::Resolution.stubs(:exec).with("/sbin/sysctl -n hw.model").returns('QEMU Virtual CPU version (cpu64-rhel6) ("AuthenticAMD" 686-class, 512KB L2 cache)')
+ Facter::Core::Execution.stubs(:exec).with("/sbin/sysctl -n hw.model").returns('QEMU Virtual CPU version (cpu64-rhel6) ("AuthenticAMD" 686-class, 512KB L2 cache)')
Facter::Util::Virtual.should be_kvm
end
it "should identify FreeBSD jail when in jail" do
Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
- Facter::Util::Resolution.stubs(:exec).with("/sbin/sysctl -n security.jail.jailed").returns("1")
+ Facter::Core::Execution.stubs(:exec).with("/sbin/sysctl -n security.jail.jailed").returns("1")
Facter::Util::Virtual.should be_jail
end
it "should not identify GNU/kFreeBSD jail when not in jail" do
Facter.fact(:kernel).stubs(:value).returns("GNU/kFreeBSD")
- Facter::Util::Resolution.stubs(:exec).with("/bin/sysctl -n security.jail.jailed").returns("0")
+ Facter::Core::Execution.stubs(:exec).with("/bin/sysctl -n security.jail.jailed").returns("0")
Facter::Util::Virtual.should_not be_jail
end
it "should detect hpvm on HP-UX" do
Facter.fact(:kernel).stubs(:value).returns("HP-UX")
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/getconf MACHINE_MODEL").returns('ia64 hp server Integrity Virtual Machine')
+ Facter::Core::Execution.stubs(:exec).with("/usr/bin/getconf MACHINE_MODEL").returns('ia64 hp server Integrity Virtual Machine')
Facter::Util::Virtual.should be_hpvm
end
it "should not detect hpvm on HP-UX when not in hpvm" do
Facter.fact(:kernel).stubs(:value).returns("HP-UX")
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/getconf MACHINE_MODEL").returns('ia64 hp server rx660')
+ Facter::Core::Execution.stubs(:exec).with("/usr/bin/getconf MACHINE_MODEL").returns('ia64 hp server rx660')
Facter::Util::Virtual.should_not be_hpvm
end
@@ -263,8 +263,8 @@ describe Facter::Util::Virtual do
shared_examples_for "virt-what" do |kernel, path, null_device|
before(:each) do
Facter.fact(:kernel).stubs(:value).returns(kernel)
- Facter::Util::Resolution.expects(:which).with("virt-what").returns(path)
- Facter::Util::Resolution.expects(:exec).with("#{path} 2>#{null_device}")
+ Facter::Core::Execution.expects(:which).with("virt-what").returns(path)
+ Facter::Core::Execution.expects(:exec).with("#{path} 2>#{null_device}")
end
it "on #{kernel} virt-what is at #{path} and stderr is sent to #{null_device}" do
@@ -278,8 +278,8 @@ describe Facter::Util::Virtual do
it "should strip out warnings on stdout from virt-what" do
virt_what_warning = "virt-what: this script must be run as root"
Facter.fact(:kernel).stubs(:value).returns('linux')
- Facter::Util::Resolution.expects(:which).with('virt-what').returns "/usr/bin/virt-what"
- Facter::Util::Resolution.expects(:exec).with('/usr/bin/virt-what 2>/dev/null').returns virt_what_warning
+ Facter::Core::Execution.expects(:which).with('virt-what').returns "/usr/bin/virt-what"
+ Facter::Core::Execution.expects(:exec).with('/usr/bin/virt-what 2>/dev/null').returns virt_what_warning
Facter::Util::Virtual.virt_what.should_not match /^virt-what: /
end
end
diff --git a/spec/unit/util/xendomains_spec.rb b/spec/unit/util/xendomains_spec.rb
index 8649488..b1c32e3 100755
--- a/spec/unit/util/xendomains_spec.rb
+++ b/spec/unit/util/xendomains_spec.rb
@@ -7,13 +7,13 @@ describe Facter::Util::Xendomains do
describe ".get_domains" do
it "should return a list of running Xen Domains on Xen0" do
xen0_domains = my_fixture_read("xendomains")
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/xm list 2>/dev/null').returns(xen0_domains)
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/xm list 2>/dev/null').returns(xen0_domains)
Facter::Util::Xendomains.get_domains.should == %{web01,mailserver}
end
describe "when xm list isn't executable" do
it "should be nil" do
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/xm list 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/xm list 2>/dev/null').returns(nil)
Facter::Util::Xendomains.get_domains.should == nil
end
end
diff --git a/spec/unit/virtual_spec.rb b/spec/unit/virtual_spec.rb
index 509c4be..a733abd 100755
--- a/spec/unit/virtual_spec.rb
+++ b/spec/unit/virtual_spec.rb
@@ -78,7 +78,7 @@ describe "Virtual fact" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter.fact(:operatingsystem).stubs(:value).returns("Linux")
- Facter::Util::Resolution.stubs(:exec).with("vmware -v").returns false
+ Facter::Core::Execution.stubs(:exec).with("vmware -v").returns false
FileTest.stubs(:exists?).with("/proc/sys/xen").returns false
FileTest.stubs(:exists?).with("/sys/bus/xen").returns false
@@ -97,18 +97,18 @@ describe "Virtual fact" do
end
it "should be vmware with VMware vendor name from lspci 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns("00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter")
Facter.fact(:virtual).value.should == "vmware"
end
it "should be virtualbox with VirtualBox vendor name from lspci 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns("00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter")
Facter.fact(:virtual).value.should == "virtualbox"
end
it "should be vmware with VMWare vendor name from dmidecode" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
Facter.fact(:virtual).value.should == "vmware"
end
@@ -128,50 +128,50 @@ describe "Virtual fact" do
end
it "should be xenhvm with Xen HVM vendor name from lspci 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns("00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)")
Facter.fact(:virtual).value.should == "xenhvm"
end
it "should be xenhvm with Xen HVM vendor name from dmidecode" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("System Information\nManufacturer: Xen\nProduct Name: HVM domU")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("System Information\nManufacturer: Xen\nProduct Name: HVM domU")
Facter.fact(:virtual).value.should == "xenhvm"
end
it "should be parallels with Parallels vendor name from dmidecode" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device Information\nType: Video\nStatus: Disabled\nDescription: Parallels Video Adapter")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device Information\nType: Video\nStatus: Disabled\nDescription: Parallels Video Adapter")
Facter.fact(:virtual).value.should == "parallels"
end
it "should be virtualbox with VirtualBox vendor name from dmidecode" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("BIOS Information\nVendor: innotek GmbH\nVersion: VirtualBox\n\nSystem Information\nManufacturer: innotek GmbH\nProduct Name: VirtualBox\nFamily: Virtual Machine")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("BIOS Information\nVendor: innotek GmbH\nVersion: VirtualBox\n\nSystem Information\nManufacturer: innotek GmbH\nProduct Name: VirtualBox\nFamily: Virtual Machine")
Facter.fact(:virtual).value.should == "virtualbox"
end
it "should be rhev with RHEV Hypervisor product name from dmidecode" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Product Name: RHEV Hypervisor")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Product Name: RHEV Hypervisor")
Facter.fact(:virtual).value.should == "rhev"
end
it "should be ovirt with oVirt Node product name from dmidecode" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Product Name: oVirt Node")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Product Name: oVirt Node")
Facter.fact(:virtual).value.should == "ovirt"
end
it "should be hyperv with Microsoft vendor name from lspci 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns("00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA")
Facter.fact(:virtual).value.should == "hyperv"
end
it "should be hyperv with Microsoft vendor name from dmidecode" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("System Information\nManufacturer: Microsoft Corporation\nProduct Name: Virtual Machine")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("System Information\nManufacturer: Microsoft Corporation\nProduct Name: Virtual Machine")
Facter.fact(:virtual).value.should == "hyperv"
end
@@ -186,7 +186,7 @@ describe "Virtual fact" do
end
it "should be gce with gce vendor name from lspci 2>/dev/null" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:05.0 Class 8007: Google, Inc. Device 6442")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns("00:05.0 Class 8007: Google, Inc. Device 6442")
Facter.fact(:virtual).value.should == "gce"
end
end
@@ -207,69 +207,69 @@ describe "Virtual fact" do
end
it "(#20236) is vmware when dmidecode contains vmware and lspci returns insufficient information" do
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("garbage\ninformation\n")
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns("garbage\ninformation\n")
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
Facter.fact(:virtual).value.should eq("vmware")
end
end
describe "on Solaris" do
before(:each) do
- Facter::Util::Resolution.stubs(:exec).with("vmware -v").returns false
+ Facter::Core::Execution.stubs(:exec).with("vmware -v").returns false
Facter.fact(:kernel).stubs(:value).returns("SunOS")
end
it "should be vmware with VMWare vendor name from prtdiag" do
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: VMware, Inc. VMware Virtual Platform")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('prtdiag').returns("System Configuration: VMware, Inc. VMware Virtual Platform")
Facter.fact(:virtual).value.should == "vmware"
end
it "should be parallels with Parallels vendor name from prtdiag" do
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: Parallels Virtual Platform")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('prtdiag').returns("System Configuration: Parallels Virtual Platform")
Facter.fact(:virtual).value.should == "parallels"
end
it "should be virtualbox with VirtualBox vendor name from prtdiag" do
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: innotek GmbH VirtualBox")
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('prtdiag').returns("System Configuration: innotek GmbH VirtualBox")
Facter.fact(:virtual).value.should == "virtualbox"
end
end
describe "on OpenBSD" do
before do
- Facter::Util::Resolution.stubs(:exec).with("vmware -v").returns false
+ Facter::Core::Execution.stubs(:exec).with("vmware -v").returns false
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
- Facter::Util::Resolution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
end
it "should be parallels with Parallels product name from sysctl" do
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("Parallels Virtual Platform")
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("Parallels Virtual Platform")
Facter.fact(:virtual).value.should == "parallels"
end
it "should be vmware with VMware product name from sysctl" do
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("VMware Virtual Platform")
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("VMware Virtual Platform")
Facter.fact(:virtual).value.should == "vmware"
end
it "should be virtualbox with VirtualBox product name from sysctl" do
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("VirtualBox")
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("VirtualBox")
Facter.fact(:virtual).value.should == "virtualbox"
end
it "should be xenhvm with Xen HVM product name from sysctl" do
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("HVM domU")
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.product 2>/dev/null').returns("HVM domU")
Facter.fact(:virtual).value.should == "xenhvm"
end
end
diff --git a/spec/unit/zfs_version_spec.rb b/spec/unit/zfs_version_spec.rb
index 2bfc01e..039dfaf 100644
--- a/spec/unit/zfs_version_spec.rb
+++ b/spec/unit/zfs_version_spec.rb
@@ -15,52 +15,52 @@ describe "zfs_version fact" do
# Solaris 11 11/11 (ga) 33 5
before :each do
- Facter::Util::Resolution.stubs(:which).with("zfs").returns("/usr/bin/zfs")
+ Facter::Core::Execution.stubs(:which).with("zfs").returns("/usr/bin/zfs")
end
it "should return correct version on Solaris 10" do
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('solaris_10'))
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('solaris_10'))
Facter.fact(:zfs_version).value.should == "3"
end
it "should return correct version on Solaris 11" do
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('solaris_11'))
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('solaris_11'))
Facter.fact(:zfs_version).value.should == "5"
end
it "should return correct version on FreeBSD 8.2" do
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('freebsd_8.2'))
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('freebsd_8.2'))
Facter.fact(:zfs_version).value.should == "4"
end
it "should return correct version on FreeBSD 9.0" do
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('freebsd_9.0'))
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('freebsd_9.0'))
Facter.fact(:zfs_version).value.should == "5"
end
it "should return correct version on Linux with ZFS-fuse" do
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
Facter.fact(:zfs_version).value.should == "4"
end
it "should return nil if zfs command is not available" do
- Facter::Util::Resolution.stubs(:which).with("zfs").returns(nil)
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
+ Facter::Core::Execution.stubs(:which).with("zfs").returns(nil)
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
Facter.fact(:zfs_version).value.should == nil
end
it "should return nil if zfs fails to run" do
- Facter::Util::Resolution.stubs(:exec).with("zfs upgrade -v").returns(nil)
+ Facter::Core::Execution.stubs(:exec).with("zfs upgrade -v").returns(nil)
Facter.fact(:zfs_version).value.should == nil
end
it "handles the zfs command becoming available at a later point in time" do
# Simulate Puppet configuring the zfs tools from a persistent daemon by
# simulating three sequential responses to which('zfs').
- Facter::Util::Resolution.stubs(:which).
+ Facter::Core::Execution.stubs(:which).
with("zfs").
returns(nil,nil,"/usr/bin/zfs")
- Facter::Util::Resolution.stubs(:exec).
+ Facter::Core::Execution.stubs(:exec).
with("zfs upgrade -v").
returns(my_fixture_read('linux-fuse_0.6.9'))
diff --git a/spec/unit/zonename_spec.rb b/spec/unit/zonename_spec.rb
index b0c5b31..23a2f98 100644
--- a/spec/unit/zonename_spec.rb
+++ b/spec/unit/zonename_spec.rb
@@ -7,7 +7,7 @@ describe "zonename fact" do
it "should return global zone" do
Facter.fact(:kernel).stubs(:value).returns("SunOS")
- Facter::Util::Resolution.stubs(:exec).with("zonename").returns('global')
+ Facter::Core::Execution.stubs(:exec).with("zonename").returns('global')
Facter.fact(:zonename).value.should == "global"
end
diff --git a/spec/unit/zones_spec.rb b/spec/unit/zones_spec.rb
index 62fdf6e..55e3d14 100644
--- a/spec/unit/zones_spec.rb
+++ b/spec/unit/zones_spec.rb
@@ -10,7 +10,7 @@ describe "on Solaris" do
-:local:configured:/::native:shared
-:zoneA:stopped:/::native:shared
EOF
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/zoneadm list -cp').returns(zone_list)
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/zoneadm list -cp').returns(zone_list)
Facter.collection.internal_loader.load(:zones)
end
diff --git a/spec/unit/zpool_version_spec.rb b/spec/unit/zpool_version_spec.rb
index fc6a952..169bcef 100644
--- a/spec/unit/zpool_version_spec.rb
+++ b/spec/unit/zpool_version_spec.rb
@@ -15,52 +15,52 @@ describe "zpool_version fact" do
# Solaris 11 11/11 (ga) 33 5
before :each do
- Facter::Util::Resolution.stubs(:which).with("zpool").returns("/usr/bin/zpool")
+ Facter::Core::Execution.stubs(:which).with("zpool").returns("/usr/bin/zpool")
end
it "should return correct version on Solaris 10" do
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('solaris_10'))
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('solaris_10'))
Facter.fact(:zpool_version).value.should == "22"
end
it "should return correct version on Solaris 11" do
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('solaris_11'))
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('solaris_11'))
Facter.fact(:zpool_version).value.should == "33"
end
it "should return correct version on FreeBSD 8.2" do
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('freebsd_8.2'))
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('freebsd_8.2'))
Facter.fact(:zpool_version).value.should == "15"
end
it "should return correct version on FreeBSD 9.0" do
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('freebsd_9.0'))
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('freebsd_9.0'))
Facter.fact(:zpool_version).value.should == "28"
end
it "should return correct version on Linux with ZFS-fuse" do
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
Facter.fact(:zpool_version).value.should == "23"
end
it "should return nil if zpool is not available" do
- Facter::Util::Resolution.stubs(:which).with("zpool").returns(nil)
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
+ Facter::Core::Execution.stubs(:which).with("zpool").returns(nil)
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(my_fixture_read('linux-fuse_0.6.9'))
Facter.fact(:zpool_version).value.should == nil
end
it "should return nil if zpool fails to run" do
- Facter::Util::Resolution.stubs(:exec).with("zpool upgrade -v").returns(nil)
+ Facter::Core::Execution.stubs(:exec).with("zpool upgrade -v").returns(nil)
Facter.fact(:zpool_version).value.should == nil
end
it "handles the zpool command becoming available" do
# Simulate Puppet configuring the zfs tools from a persistent daemon by
# simulating three sequential responses to which('zpool').
- Facter::Util::Resolution.stubs(:which).
+ Facter::Core::Execution.stubs(:which).
with("zpool").
returns(nil,nil,"/usr/bin/zpool")
- Facter::Util::Resolution.stubs(:exec).
+ Facter::Core::Execution.stubs(:exec).
with("zpool upgrade -v").
returns(my_fixture_read('linux-fuse_0.6.9'))
--
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