facter 1.6.9 → 1.6.10
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of facter might be problematic. Click here for more details.
- data/CHANGELOG +24 -0
- data/Rakefile +41 -12
- data/conf/redhat/facter.spec +12 -2
- data/lib/facter.rb +1 -1
- data/lib/facter/architecture.rb +1 -1
- data/lib/facter/domain.rb +10 -5
- data/lib/facter/hardwaremodel.rb +29 -2
- data/lib/facter/ipaddress6.rb +1 -1
- data/lib/facter/lsbdistcodename.rb +1 -1
- data/lib/facter/lsbdistdescription.rb +1 -1
- data/lib/facter/lsbdistid.rb +1 -1
- data/lib/facter/lsbdistrelease.rb +1 -1
- data/lib/facter/lsbrelease.rb +1 -1
- data/lib/facter/util/ip.rb +4 -4
- data/lib/facter/util/registry.rb +11 -0
- data/lib/facter/util/resolution.rb +101 -30
- data/spec/puppetlabs_spec/verbose.rb +9 -0
- data/spec/puppetlabs_spec_helper.rb +1 -0
- data/spec/shared_contexts/platform.rb +55 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/unit/architecture_spec.rb +2 -0
- data/spec/unit/domain_spec.rb +29 -9
- data/spec/unit/facter_spec.rb +2 -1
- data/spec/unit/hardwaremodel_spec.rb +34 -0
- data/spec/unit/ipaddress6_spec.rb +1 -1
- data/spec/unit/lsbdistcodename_spec.rb +3 -3
- data/spec/unit/lsbdistdescription_spec.rb +3 -3
- data/spec/unit/lsbdistid_spec.rb +4 -4
- data/spec/unit/lsbdistrelease_spec.rb +3 -3
- data/spec/unit/lsbrelease_spec.rb +3 -3
- data/spec/unit/processor_spec.rb +2 -0
- data/spec/unit/util/registry_spec.rb +76 -0
- data/spec/unit/util/resolution_spec.rb +264 -28
- metadata +183 -178
data/CHANGELOG
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
1.6.10
|
2
|
+
===
|
3
|
+
35067dc Bump Facter epoch to 1
|
4
|
+
d6a3e91 Make package task depend on tar in Rakfile
|
5
|
+
f42896d (#14764) Stub architecture fact when Windows facts run on Linux
|
6
|
+
f44ca52 (maint) Fix hardware model fact for ruby 1.9
|
7
|
+
964d1f0 (#12864) Close registry key
|
8
|
+
ab025bb Revert "Revert "(#12864) Windows: get primary DNS from registry""
|
9
|
+
478386d (#10261) Detect x64 architecture on Windows
|
10
|
+
6cc881d Use git describe in Rakefile to determine pkg ver
|
11
|
+
2043244 (#13678) Remove deprecation msg triggerd by the ipaddress6 fact
|
12
|
+
d118d81 (#13678) Add filename extension on absolute paths on windows
|
13
|
+
b050eb1 (#14582) Fix noise in LSB facts
|
14
|
+
85654b0 (#13678) Allow passing shell built-ins to exec method on windows
|
15
|
+
8f4c016 (#13678) Single quote paths on unix with spaces
|
16
|
+
2d164e8 (#13678) Join PATHs correctly on windows
|
17
|
+
e7e7e8f (#13678) Extend spec tests for expand_command
|
18
|
+
0fea7b0 maint: Add shared context for specs to imitate windows or posix
|
19
|
+
60d0cd2 (#13678) Fix spec failures on windows
|
20
|
+
121a2ab (#13678) Fix quoting in expand_command
|
21
|
+
55b1125 (#13678) Add more unit tests for new methods
|
22
|
+
9086c0a (#13678) Add RDoc documentation for new methods
|
23
|
+
165ace4 (#13678) Convert command to absolute paths before executing
|
24
|
+
|
1
25
|
1.6.9
|
2
26
|
===
|
3
27
|
b398bd8 (#14334) Fix dmidecode based facts on DragonFly BSD
|
data/Rakefile
CHANGED
@@ -17,10 +17,6 @@ require 'rake'
|
|
17
17
|
require 'rake/packagetask'
|
18
18
|
require 'rake/gempackagetask'
|
19
19
|
|
20
|
-
module Facter
|
21
|
-
FACTERVERSION = File.read('lib/facter.rb')[/FACTERVERSION *= *'(.*)'/,1] or fail "Couldn't find FACTERVERSION"
|
22
|
-
end
|
23
|
-
|
24
20
|
FILES = FileList[
|
25
21
|
'[A-Z]*',
|
26
22
|
'install.rb',
|
@@ -31,12 +27,50 @@ FILES = FileList[
|
|
31
27
|
'spec/**/*'
|
32
28
|
]
|
33
29
|
|
30
|
+
def get_version
|
31
|
+
`git describe`.strip
|
32
|
+
end
|
33
|
+
|
34
|
+
# :build_environment and :tar are mostly borrowed from puppet-dashboard Rakefile
|
35
|
+
task :build_environment do
|
36
|
+
unless ENV['FORCE'] == '1'
|
37
|
+
modified = `git status --porcelain | sed -e '/^\?/d'`
|
38
|
+
if modified.split(/\n/).length != 0
|
39
|
+
puts <<-HERE
|
40
|
+
!! ERROR: Your git working directory is not clean. You must
|
41
|
+
!! remove or commit your changes before you can create a package:
|
42
|
+
|
43
|
+
#{`git status | grep '^#'`.chomp}
|
44
|
+
|
45
|
+
!! To override this check, set FORCE=1 -- e.g. `rake package:deb FORCE=1`
|
46
|
+
HERE
|
47
|
+
raise
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Create a release .tar.gz"
|
53
|
+
task :tar => :build_environment do
|
54
|
+
name = "facter"
|
55
|
+
rm_rf 'pkg/tar'
|
56
|
+
temp=`mktemp -d -t tmpXXXXXX`.strip!
|
57
|
+
version = get_version
|
58
|
+
base = "#{temp}/#{name}-#{version}/"
|
59
|
+
mkdir_p base
|
60
|
+
sh "git checkout-index -af --prefix=#{base}"
|
61
|
+
mkdir_p "pkg/tar"
|
62
|
+
sh "tar -C #{temp} -pczf #{temp}/#{name}-#{version}.tar.gz #{name}-#{version}"
|
63
|
+
mv "#{temp}/#{name}-#{version}.tar.gz", "pkg/tar"
|
64
|
+
rm_rf temp
|
65
|
+
puts "Tarball is pkg/tar/#{name}-#{version}.tar.gz"
|
66
|
+
end
|
67
|
+
|
34
68
|
spec = Gem::Specification.new do |spec|
|
35
69
|
spec.platform = Gem::Platform::RUBY
|
36
70
|
spec.name = 'facter'
|
37
71
|
spec.files = FILES.to_a
|
38
72
|
spec.executables = %w{facter}
|
39
|
-
spec.version =
|
73
|
+
spec.version = get_version.split('-')[0]
|
40
74
|
spec.summary = 'Facter, a system inventory tool'
|
41
75
|
spec.description = 'You can prove anything with facts!'
|
42
76
|
spec.author = 'Puppet Labs'
|
@@ -49,16 +83,11 @@ spec = Gem::Specification.new do |spec|
|
|
49
83
|
'--main' << 'README' <<
|
50
84
|
'--line-numbers'
|
51
85
|
end
|
52
|
-
|
53
|
-
Rake::PackageTask.new("facter", Facter::FACTERVERSION) do |pkg|
|
54
|
-
pkg.package_dir = 'pkg'
|
55
|
-
pkg.need_tar_gz = true
|
56
|
-
pkg.package_files = FILES.to_a
|
57
|
-
end
|
58
|
-
|
59
86
|
Rake::GemPackageTask.new(spec) do |pkg|
|
60
87
|
end
|
61
88
|
|
89
|
+
task :package => :tar
|
90
|
+
|
62
91
|
task :default do
|
63
92
|
sh %{rake -T}
|
64
93
|
end
|
data/conf/redhat/facter.spec
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
Summary: Ruby module for collecting simple facts about a host operating system
|
4
4
|
Name: facter
|
5
|
-
Version: 1.6.
|
5
|
+
Version: 1.6.10
|
6
6
|
Release: 1%{?dist}
|
7
|
-
#Release: 0.1rc1%{?dist}
|
7
|
+
#Release: 0.1rc1.2%{?dist}
|
8
|
+
Epoch: 1
|
8
9
|
License: Apache 2.0
|
9
10
|
Group: System Environment/Base
|
10
11
|
URL: http://www.puppetlabs.com/puppet/related-projects/%{name}
|
@@ -53,6 +54,15 @@ rm -rf %{buildroot}
|
|
53
54
|
|
54
55
|
|
55
56
|
%changelog
|
57
|
+
* Wed Jun 13 2012 Moses Mendoza <moses@puppetlabs.com> - 1.6.10-1
|
58
|
+
- Update for 1.6.10
|
59
|
+
|
60
|
+
* Fri Jun 8 2012 Moses Mendoza <moses@puppetlabs.com> - 1.6.10-0.1rc1.2
|
61
|
+
- Bump epoch to 1 to address errant Facter 2.0 rc release
|
62
|
+
|
63
|
+
* Wed Jun 6 2012 Moses Mendoza <moses@puppetlabs.com> - 1.6.10-0.1rc1
|
64
|
+
- Update for 1.6.10rc1
|
65
|
+
|
56
66
|
* Thu May 17 2012 Moses Mendoza <moses@puppetlabs.com> - 1.6.9-1
|
57
67
|
- Update for 1.6.9
|
58
68
|
|
data/lib/facter.rb
CHANGED
@@ -25,7 +25,7 @@ module Facter
|
|
25
25
|
include Comparable
|
26
26
|
include Enumerable
|
27
27
|
|
28
|
-
FACTERVERSION = '1.6.
|
28
|
+
FACTERVERSION = '1.6.10'
|
29
29
|
# = Facter
|
30
30
|
# Functions as a hash of 'facts' you might care about about your
|
31
31
|
# system, such as mac address, IP address, Video card, etc.
|
data/lib/facter/architecture.rb
CHANGED
data/lib/facter/domain.rb
CHANGED
@@ -52,12 +52,17 @@ end
|
|
52
52
|
Facter.add(:domain) do
|
53
53
|
confine :kernel => :windows
|
54
54
|
setcode do
|
55
|
-
require 'facter/util/
|
55
|
+
require 'facter/util/registry'
|
56
56
|
domain = ""
|
57
|
-
Facter::Util::
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
regvalue = Facter::Util::Registry.hklm_read('SYSTEM\CurrentControlSet\Services\Tcpip\Parameters', 'Domain')
|
58
|
+
domain = regvalue if regvalue
|
59
|
+
if domain == ""
|
60
|
+
require 'facter/util/wmi'
|
61
|
+
Facter::Util::WMI.execquery("select DNSDomain from Win32_NetworkAdapterConfiguration where IPEnabled = True").each { |nic|
|
62
|
+
domain = nic.DNSDomain
|
63
|
+
break
|
64
|
+
}
|
65
|
+
end
|
61
66
|
domain
|
62
67
|
end
|
63
68
|
end
|
data/lib/facter/hardwaremodel.rb
CHANGED
@@ -28,7 +28,34 @@ end
|
|
28
28
|
Facter.add(:hardwaremodel) do
|
29
29
|
confine :operatingsystem => :windows
|
30
30
|
setcode do
|
31
|
-
|
32
|
-
|
31
|
+
# The cryptic windows cpu architecture models are documented in these places:
|
32
|
+
# http://source.winehq.org/source/include/winnt.h#L568
|
33
|
+
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394373(v=vs.85).aspx
|
34
|
+
# http://msdn.microsoft.com/en-us/library/windows/desktop/windows.system.processorarchitecture.aspx
|
35
|
+
# Also, arm and neutral are included because they are valid for the upcoming
|
36
|
+
# windows 8 release. --jeffweiss 23 May 2012
|
37
|
+
require 'facter/util/wmi'
|
38
|
+
model = ""
|
39
|
+
Facter::Util::WMI.execquery("select Architecture, Level from Win32_Processor").each do |cpu|
|
40
|
+
model =
|
41
|
+
case cpu.Architecture
|
42
|
+
when 11 then 'neutral' # PROCESSOR_ARCHITECTURE_NEUTRAL
|
43
|
+
when 10 then 'i686' # PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
|
44
|
+
when 9 then 'x64' # PROCESSOR_ARCHITECTURE_AMD64
|
45
|
+
when 8 then 'msil' # PROCESSOR_ARCHITECTURE_MSIL
|
46
|
+
when 7 then 'alpha64' # PROCESSOR_ARCHITECTURE_ALPHA64
|
47
|
+
when 6 then 'ia64' # PROCESSOR_ARCHITECTURE_IA64
|
48
|
+
when 5 then 'arm' # PROCESSOR_ARCHITECTURE_ARM
|
49
|
+
when 4 then 'shx' # PROCESSOR_ARCHITECTURE_SHX
|
50
|
+
when 3 then 'powerpc' # PROCESSOR_ARCHITECTURE_PPC
|
51
|
+
when 2 then 'alpha' # PROCESSOR_ARCHITECTURE_ALPHA
|
52
|
+
when 1 then 'mips' # PROCESSOR_ARCHITECTURE_MIPS
|
53
|
+
when 0 then "i#{cpu.Level}86" # PROCESSOR_ARCHITECTURE_INTEL
|
54
|
+
else 'unknown' # PROCESSOR_ARCHITECTURE_UNKNOWN
|
55
|
+
end
|
56
|
+
break
|
57
|
+
end
|
58
|
+
|
59
|
+
model
|
33
60
|
end
|
34
61
|
end
|
data/lib/facter/ipaddress6.rb
CHANGED
@@ -65,7 +65,7 @@ end
|
|
65
65
|
Facter.add(:ipaddress6) do
|
66
66
|
confine :kernel => :windows
|
67
67
|
setcode do
|
68
|
-
output = Facter::Util::Resolution.exec("#{ENV['SYSTEMROOT']}/system32/netsh interface ipv6 show address level=verbose")
|
68
|
+
output = Facter::Util::Resolution.exec("#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ipv6 show address level=verbose")
|
69
69
|
|
70
70
|
get_address_after_token(output, 'Address', true)
|
71
71
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
Facter.add(:lsbdistdescription) do
|
14
14
|
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
|
15
15
|
setcode do
|
16
|
-
if output = Facter::Util::Resolution.exec('lsb_release -d -s')
|
16
|
+
if output = Facter::Util::Resolution.exec('lsb_release -d -s 2>/dev/null')
|
17
17
|
# the output may be quoted (at least it is on gentoo)
|
18
18
|
output.sub(/^"(.*)"$/,'\1')
|
19
19
|
end
|
data/lib/facter/lsbdistid.rb
CHANGED
data/lib/facter/lsbrelease.rb
CHANGED
data/lib/facter/util/ip.rb
CHANGED
@@ -80,8 +80,8 @@ module Facter::Util::IP
|
|
80
80
|
when 'HP-UX'
|
81
81
|
output = %x{/bin/netstat -in | sed -e 1d}
|
82
82
|
when 'windows'
|
83
|
-
output = %x|#{ENV['SYSTEMROOT']}/system32/netsh interface ip show interface|
|
84
|
-
output += %x|#{ENV['SYSTEMROOT']}/system32/netsh interface ipv6 show interface|
|
83
|
+
output = %x|#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ip show interface|
|
84
|
+
output += %x|#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ipv6 show interface|
|
85
85
|
end
|
86
86
|
output
|
87
87
|
end
|
@@ -107,9 +107,9 @@ module Facter::Util::IP
|
|
107
107
|
return get_single_interface_output(interface) unless Facter.value(:kernel) == 'windows'
|
108
108
|
|
109
109
|
if label == 'ipaddress6'
|
110
|
-
output = %x|#{ENV['SYSTEMROOT']}/system32/netsh interface ipv6 show address \"#{interface}\"|
|
110
|
+
output = %x|#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ipv6 show address \"#{interface}\"|
|
111
111
|
else
|
112
|
-
output = %x|#{ENV['SYSTEMROOT']}/system32/netsh interface ip show address \"#{interface}\"|
|
112
|
+
output = %x|#{ENV['SYSTEMROOT']}/system32/netsh.exe interface ip show address \"#{interface}\"|
|
113
113
|
end
|
114
114
|
output
|
115
115
|
end
|
@@ -13,18 +13,102 @@ class Facter::Util::Resolution
|
|
13
13
|
|
14
14
|
INTERPRETER = Facter::Util::Config.is_windows? ? "cmd.exe" : "/bin/sh"
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
# Returns the locations to be searched when looking for a binary. This
|
17
|
+
# is currently determined by the +PATH+ environment variable plus
|
18
|
+
# <tt>/sbin</tt> and <tt>/usr/sbin</tt> when run on unix
|
19
|
+
def self.search_paths
|
20
|
+
if Facter::Util::Config.is_windows?
|
21
|
+
ENV['PATH'].split(File::PATH_SEPARATOR)
|
22
|
+
else
|
23
|
+
# Make sure facter is usable even for non-root users. Most commands
|
24
|
+
# in /sbin (like ifconfig) can be run as non priviledged users as
|
25
|
+
# long as they do not modify anything - which we do not do with facter
|
26
|
+
ENV['PATH'].split(File::PATH_SEPARATOR) + [ '/sbin', '/usr/sbin' ]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Determine the full path to a binary. If the supplied filename does not
|
31
|
+
# already describe an absolute path then different locations (determined
|
32
|
+
# by <tt>self.search_paths</tt>) will be searched for a match.
|
33
|
+
#
|
34
|
+
# Returns nil if no matching executable can be found otherwise returns
|
35
|
+
# the expanded pathname.
|
36
|
+
def self.which(bin)
|
37
|
+
if absolute_path?(bin)
|
38
|
+
return bin if File.executable?(bin)
|
39
|
+
if Facter::Util::Config.is_windows? and File.extname(bin).empty?
|
40
|
+
exts = ENV['PATHEXT']
|
41
|
+
exts = exts ? exts.split(File::PATH_SEPARATOR) : %w[.COM .EXE .BAT .CMD]
|
42
|
+
exts.each do |ext|
|
43
|
+
destext = bin + ext
|
44
|
+
if File.executable?(destext)
|
45
|
+
Facter.warnonce("Using Facter::Util::Resolution.which with an absolute path like #{bin} but no fileextension is deprecated. Please add the correct extension (#{ext})")
|
46
|
+
return destext
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
else
|
51
|
+
search_paths.each do |dir|
|
52
|
+
dest = File.join(dir, bin)
|
53
|
+
if Facter::Util::Config.is_windows?
|
54
|
+
dest.gsub!(File::SEPARATOR, File::ALT_SEPARATOR)
|
55
|
+
if File.extname(dest).empty?
|
56
|
+
exts = ENV['PATHEXT']
|
57
|
+
exts = exts ? exts.split(File::PATH_SEPARATOR) : %w[.COM .EXE .BAT .CMD]
|
58
|
+
exts.each do |ext|
|
59
|
+
destext = dest + ext
|
60
|
+
return destext if File.executable?(destext)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
return dest if File.executable?(dest)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
|
70
|
+
# Determine in a platform-specific way whether a path is absolute. This
|
71
|
+
# defaults to the local platform if none is specified.
|
72
|
+
def self.absolute_path?(path, platform=nil)
|
73
|
+
# Escape once for the string literal, and once for the regex.
|
74
|
+
slash = '[\\\\/]'
|
75
|
+
name = '[^\\\\/]+'
|
76
|
+
regexes = {
|
77
|
+
:windows => %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i,
|
78
|
+
:posix => %r!^/!,
|
79
|
+
}
|
80
|
+
platform ||= Facter::Util::Config.is_windows? ? :windows : :posix
|
81
|
+
|
82
|
+
!! (path =~ regexes[platform])
|
83
|
+
end
|
84
|
+
|
85
|
+
# Expand the executable of a commandline to an absolute path. The executable
|
86
|
+
# is the first word of the commandline. If the executable contains spaces,
|
87
|
+
# it has be but in double quotes to be properly recognized.
|
88
|
+
#
|
89
|
+
# Returns the commandline with the expanded binary or nil if the binary
|
90
|
+
# can't be found. If the path to the binary contains quotes, the whole binary
|
91
|
+
# is put in quotes.
|
92
|
+
def self.expand_command(command)
|
93
|
+
if match = /^"(.+?)"(?:\s+(.*))?/.match(command)
|
94
|
+
exe, arguments = match.captures
|
95
|
+
exe = which(exe) and [ "\"#{exe}\"", arguments ].compact.join(" ")
|
96
|
+
elsif match = /^'(.+?)'(?:\s+(.*))?/.match(command) and not Facter::Util::Config.is_windows?
|
97
|
+
exe, arguments = match.captures
|
98
|
+
exe = which(exe) and [ "'#{exe}'", arguments ].compact.join(" ")
|
99
|
+
else
|
100
|
+
exe, arguments = command.split(/ /,2)
|
101
|
+
if exe = which(exe)
|
102
|
+
# the binary was not quoted which means it contains no spaces. But the
|
103
|
+
# full path to the binary may do so.
|
104
|
+
exe = "\"#{exe}\"" if exe =~ /\s/ and Facter::Util::Config.is_windows?
|
105
|
+
exe = "'#{exe}'" if exe =~ /\s/ and not Facter::Util::Config.is_windows?
|
106
|
+
[ exe, arguments ].compact.join(" ")
|
23
107
|
end
|
24
108
|
end
|
25
|
-
@have_which
|
26
109
|
end
|
27
110
|
|
111
|
+
|
28
112
|
# Execute a program and return the output of that program.
|
29
113
|
#
|
30
114
|
# Returns nil if the program can't be found, or if there is a problem
|
@@ -33,34 +117,21 @@ class Facter::Util::Resolution
|
|
33
117
|
def self.exec(code, interpreter = nil)
|
34
118
|
Facter.warnonce "The interpreter parameter to 'exec' is deprecated and will be removed in a future version." if interpreter
|
35
119
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# can skip the check there. This is good, since builtins cannot be found
|
45
|
-
# elsewhere.
|
46
|
-
if have_which and !Facter::Util::Config.is_windows?
|
47
|
-
path = nil
|
48
|
-
binary = code.split.first
|
49
|
-
if code =~ /^\//
|
50
|
-
path = binary
|
51
|
-
else
|
52
|
-
path = %x{which #{binary} 2>/dev/null}.chomp
|
53
|
-
# we don't have the binary necessary
|
54
|
-
return nil if path == "" or path.match(/Command not found\./)
|
55
|
-
end
|
56
|
-
|
57
|
-
return nil unless FileTest.exists?(path)
|
120
|
+
if expanded_code = expand_command(code)
|
121
|
+
# if we can find the binary, we'll run the command with the expanded path to the binary
|
122
|
+
code = expanded_code
|
123
|
+
else
|
124
|
+
# if we cannot find the binary return nil on posix. On windows we'll still try to run the
|
125
|
+
# command in case it is a shell-builtin. In case it is not, windows will raise Errno::ENOENT
|
126
|
+
return nil unless Facter::Util::Config.is_windows?
|
127
|
+
return nil if absolute_path?(code)
|
58
128
|
end
|
59
129
|
|
60
130
|
out = nil
|
61
131
|
|
62
132
|
begin
|
63
133
|
out = %x{#{code}}.chomp
|
134
|
+
Facter.warnonce 'Using Facter::Util::Resolution.exec with a shell built-in is deprecated. Most built-ins can be replaced with native ruby commands. If you really have to run a built-in, pass "cmd /c your_builtin" as a command' unless expanded_code
|
64
135
|
rescue Errno::ENOENT => detail
|
65
136
|
# command not found on Windows
|
66
137
|
return nil
|