facter 2.1.0-x64-mingw32 → 2.2.0-x64-mingw32
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/COMMITTERS.md +25 -34
- data/CONTRIBUTING.md +27 -5
- data/README.md +32 -0
- data/ext/build_defaults.yaml +1 -1
- data/ext/debian/control +3 -2
- data/ext/osx/file_mapping.yaml +5 -0
- data/ext/redhat/facter.spec.erb +4 -1
- data/lib/facter/Cfkey.rb +2 -2
- data/lib/facter/architecture.rb +2 -2
- data/lib/facter/augeasversion.rb +2 -2
- data/lib/facter/blockdevices.rb +12 -12
- data/lib/facter/dhcp_servers.rb +4 -4
- data/lib/facter/domain.rb +4 -4
- data/lib/facter/ec2.rb +17 -0
- data/lib/facter/ec2/rest.rb +2 -2
- data/lib/facter/facterversion.rb +2 -2
- data/lib/facter/filesystems.rb +10 -3
- data/lib/facter/fqdn.rb +1 -1
- data/lib/facter/gid.rb +16 -0
- data/lib/facter/hardwareisa.rb +3 -3
- data/lib/facter/hardwaremodel.rb +3 -3
- data/lib/facter/hostname.rb +1 -1
- data/lib/facter/id.rb +4 -4
- data/lib/facter/interfaces.rb +3 -0
- data/lib/facter/ipaddress6.rb +9 -9
- data/lib/facter/kernel.rb +2 -2
- data/lib/facter/kernelmajversion.rb +2 -2
- data/lib/facter/kernelrelease.rb +4 -4
- data/lib/facter/kernelversion.rb +3 -3
- data/lib/facter/ldom.rb +11 -0
- data/lib/facter/lsbdistcodename.rb +8 -4
- data/lib/facter/lsbdistdescription.rb +6 -10
- data/lib/facter/lsbdistid.rb +8 -4
- data/lib/facter/lsbdistrelease.rb +8 -4
- data/lib/facter/lsbmajdistrelease.rb +7 -12
- data/lib/facter/lsbminordistrelease.rb +22 -0
- data/lib/facter/lsbrelease.rb +8 -4
- data/lib/facter/macaddress.rb +1 -0
- data/lib/facter/macosx.rb +1 -1
- data/lib/facter/manufacturer.rb +3 -3
- data/lib/facter/memory.rb +8 -8
- data/lib/facter/netmask.rb +2 -1
- data/lib/facter/network.rb +3 -3
- data/lib/facter/operatingsystem.rb +9 -126
- data/lib/facter/operatingsystem/base.rb +61 -0
- data/lib/facter/operatingsystem/cumuluslinux.rb +27 -0
- data/lib/facter/operatingsystem/implementation.rb +30 -0
- data/lib/facter/operatingsystem/linux.rb +467 -0
- data/lib/facter/operatingsystem/sunos.rb +54 -0
- data/lib/facter/operatingsystem/vmkernel.rb +11 -0
- data/lib/facter/operatingsystem/windows.rb +37 -0
- data/lib/facter/operatingsystemmajrelease.rb +14 -33
- data/lib/facter/operatingsystemrelease.rb +14 -235
- data/lib/facter/os.rb +69 -0
- data/lib/facter/osfamily.rb +4 -23
- data/lib/facter/partitions.rb +4 -3
- data/lib/facter/path.rb +2 -2
- data/lib/facter/physicalprocessorcount.rb +10 -74
- data/lib/facter/processor.rb +13 -129
- data/lib/facter/processors.rb +60 -0
- data/lib/facter/processors/os.rb +234 -0
- data/lib/facter/ps.rb +5 -4
- data/lib/facter/puppetversion.rb +1 -1
- data/lib/facter/rackspace.rb +34 -0
- data/lib/facter/rubysitedir.rb +3 -0
- data/lib/facter/rubyversion.rb +2 -2
- data/lib/facter/selinux.rb +57 -2
- data/lib/facter/ssh.rb +1 -0
- data/lib/facter/system_uptime.rb +42 -0
- data/lib/facter/timezone.rb +1 -1
- data/lib/facter/uptime.rb +5 -23
- data/lib/facter/uptime_days.rb +4 -6
- data/lib/facter/uptime_hours.rb +4 -6
- data/lib/facter/uptime_seconds.rb +5 -9
- data/lib/facter/util/formatter.rb +1 -1
- data/lib/facter/util/manufacturer.rb +1 -1
- data/lib/facter/util/partitions.rb +3 -1
- data/lib/facter/util/partitions/linux.rb +1 -1
- data/lib/facter/util/partitions/openbsd.rb +35 -0
- data/lib/facter/util/uptime.rb +4 -3
- data/lib/facter/util/virtual.rb +3 -1
- data/lib/facter/util/xendomains.rb +12 -3
- data/lib/facter/version.rb +1 -1
- data/lib/facter/virtual.rb +24 -23
- data/lib/facter/vlans.rb +1 -1
- data/lib/facter/xendomains.rb +1 -1
- data/lib/facter/zfs_version.rb +6 -2
- data/lib/facter/zones.rb +6 -5
- data/lib/facter/zpool_version.rb +1 -1
- data/spec/fixtures/cpuinfo/amd64dual-grep +2 -0
- data/spec/fixtures/cpuinfo/amd64twentyfour-grep +24 -0
- data/spec/fixtures/cpuinfo/two_multicore-grep +4 -0
- data/spec/fixtures/cpuinfo/two_singlecore-grep +2 -0
- data/spec/fixtures/unit/processors/os/darwin-system-profiler +287 -0
- data/spec/fixtures/unit/zfs_version/zfs_new +61 -0
- data/spec/fixtures/unit/zfs_version/zfs_old +43 -0
- data/spec/fixtures/unit/zfs_version/zfsonlinux_0.6.1 +13 -0
- data/spec/fixtures/unit/zpool_version/zfsonlinux_0.6.1 +48 -0
- data/spec/unit/ec2/rest_spec.rb +6 -6
- data/spec/unit/gid_spec.rb +22 -0
- data/spec/unit/hardwaremodel_spec.rb +2 -0
- data/spec/unit/lsbdistcodename_spec.rb +22 -17
- data/spec/unit/lsbdistdescription_spec.rb +22 -17
- data/spec/unit/lsbdistid_spec.rb +23 -18
- data/spec/unit/lsbdistrelease_spec.rb +22 -17
- data/spec/unit/lsbmajdistrelease_spec.rb +23 -6
- data/spec/unit/lsbminordistrelease_spec.rb +31 -0
- data/spec/unit/lsbrelease_spec.rb +22 -17
- data/spec/unit/macaddress_spec.rb +3 -0
- data/spec/unit/operatingsystem/base_spec.rb +76 -0
- data/spec/unit/operatingsystem/cumuluslinux_spec.rb +40 -0
- data/spec/unit/operatingsystem/implementation_spec.rb +49 -0
- data/spec/unit/operatingsystem/linux_spec.rb +538 -0
- data/spec/unit/operatingsystem/sunos_spec.rb +144 -0
- data/spec/unit/operatingsystem/vmkernel_spec.rb +13 -0
- data/spec/unit/operatingsystem/windows_spec.rb +68 -0
- data/spec/unit/operatingsystem_spec.rb +10 -153
- data/spec/unit/operatingsystemmajrelease_spec.rb +14 -31
- data/spec/unit/operatingsystemrelease_spec.rb +13 -229
- data/spec/unit/os_spec.rb +131 -0
- data/spec/unit/osfamily_spec.rb +9 -54
- data/spec/unit/partitions_spec.rb +41 -3
- data/spec/unit/physicalprocessorcount_spec.rb +6 -78
- data/spec/unit/processor_spec.rb +18 -381
- data/spec/unit/processors/os_spec.rb +446 -0
- data/spec/unit/processors_spec.rb +203 -0
- data/spec/unit/rackspace_spec.rb +40 -0
- data/spec/unit/system_uptime_spec.rb +80 -0
- data/spec/unit/util/formatter_spec.rb +5 -0
- data/spec/unit/util/macaddress_spec.rb +2 -0
- data/spec/unit/util/processor_spec.rb +120 -0
- data/spec/unit/util/uptime_spec.rb +3 -4
- data/spec/unit/util/virtual_spec.rb +8 -0
- data/spec/unit/util/xendomains_spec.rb +54 -9
- data/spec/unit/virtual_spec.rb +8 -1
- data/spec/unit/zfs_version_spec.rb +20 -8
- data/spec/unit/zpool_version_spec.rb +5 -0
- metadata +658 -589
- checksums.yaml +0 -7
data/lib/facter/ps.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# Fact: ps
|
2
2
|
#
|
3
|
-
# Purpose:
|
4
|
-
#
|
3
|
+
# Purpose:
|
4
|
+
# Internal fact for what to use to list all processes. Used by
|
5
|
+
# the Service type in Puppet.
|
5
6
|
#
|
6
7
|
# Resolution:
|
7
|
-
# Assumes
|
8
|
-
# it uses
|
8
|
+
# Assumes `ps -ef` for all operating systems other than BSD derivatives, where
|
9
|
+
# it uses `ps auxwww`.
|
9
10
|
#
|
10
11
|
# Caveats:
|
11
12
|
#
|
data/lib/facter/puppetversion.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Purpose: Determine information about Rackspace cloud instances
|
2
|
+
#
|
3
|
+
# Resolution:
|
4
|
+
# If this is a Rackspace Cloud instance, populates rsc_ facts
|
5
|
+
#
|
6
|
+
# Caveats:
|
7
|
+
# Depends on Xenstore
|
8
|
+
#
|
9
|
+
|
10
|
+
Facter.add(:is_rsc) do
|
11
|
+
setcode do
|
12
|
+
result = Facter::Util::Resolution.exec("/usr/bin/xenstore-read vm-data/provider_data/provider")
|
13
|
+
if result == "Rackspace"
|
14
|
+
"true"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Facter.add(:rsc_region) do
|
20
|
+
confine :is_rsc => "true"
|
21
|
+
setcode do
|
22
|
+
Facter::Util::Resolution.exec("/usr/bin/xenstore-read vm-data/provider_data/region")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Facter.add(:rsc_instance_id) do
|
27
|
+
confine :is_rsc => "true"
|
28
|
+
setcode do
|
29
|
+
result = Facter::Util::Resolution.exec("/usr/bin/xenstore-read name")
|
30
|
+
if result and (match = result.match(/instance-(.*)/))
|
31
|
+
match[1]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/facter/rubysitedir.rb
CHANGED
data/lib/facter/rubyversion.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Fact: rubyversion
|
2
2
|
#
|
3
|
-
# Purpose: Returns the version of Ruby facter is running under.
|
3
|
+
# Purpose: Returns the version of Ruby that facter is running under.
|
4
4
|
#
|
5
|
-
# Resolution: Returns RUBY_VERSION.
|
5
|
+
# Resolution: Returns the value of the `RUBY_VERSION` constant.
|
6
6
|
#
|
7
7
|
# Caveats:
|
8
8
|
#
|
data/lib/facter/selinux.rb
CHANGED
@@ -1,8 +1,60 @@
|
|
1
1
|
# Fact: selinux
|
2
2
|
#
|
3
3
|
# Purpose:
|
4
|
+
# Determine whether SE Linux is enabled on the node.
|
4
5
|
#
|
5
6
|
# Resolution:
|
7
|
+
# Checks for the existence of the enforce file under the SE Linux mount
|
8
|
+
# point (e.g. `/selinux/enforce`) and returns true if `/proc/self/attr/current`
|
9
|
+
# does not contain the kernel.
|
10
|
+
#
|
11
|
+
# Caveats:
|
12
|
+
#
|
13
|
+
|
14
|
+
# Fact: selinux_config_mode
|
15
|
+
#
|
16
|
+
# Purpose:
|
17
|
+
# Returns the configured SE Linux mode (e.g., `enforcing`, `permissive`, or `disabled`).
|
18
|
+
#
|
19
|
+
# Resolution:
|
20
|
+
# Parses the output of `sestatus_cmd` and returns the value of the line beginning
|
21
|
+
# with `Mode from config file:`.
|
22
|
+
#
|
23
|
+
# Caveats:
|
24
|
+
#
|
25
|
+
|
26
|
+
# Fact: selinux_config_policy
|
27
|
+
#
|
28
|
+
# Purpose:
|
29
|
+
# Returns the configured SE Linux policy (e.g., `targeted`, `MLS`, or `minimum`).
|
30
|
+
#
|
31
|
+
# Resolution:
|
32
|
+
# Parses the output of `sestatus_cmd` and returns the value of the line beginning
|
33
|
+
# with `Policy from config file:`.
|
34
|
+
#
|
35
|
+
# Caveats:
|
36
|
+
#
|
37
|
+
|
38
|
+
# Fact: selinux_enforced
|
39
|
+
#
|
40
|
+
# Purpose:
|
41
|
+
# Returns whether SE Linux is enabled (`true`) or not (`false`).
|
42
|
+
#
|
43
|
+
# Resolution:
|
44
|
+
# Returns the value found in the `enforce` file under the SE Linux mount
|
45
|
+
# point (e.g. `/selinux/enforce`).
|
46
|
+
#
|
47
|
+
# Caveats:
|
48
|
+
#
|
49
|
+
|
50
|
+
# Fact: selinux_policyversion
|
51
|
+
#
|
52
|
+
# Purpose:
|
53
|
+
# Returns the current SE Linux policy version.
|
54
|
+
#
|
55
|
+
# Resolution:
|
56
|
+
# Reads the content of the `policyvers` file found under the SE Linux mount point,
|
57
|
+
# e.g. `/selinux/policyvers`.
|
6
58
|
#
|
7
59
|
# Caveats:
|
8
60
|
#
|
@@ -36,8 +88,11 @@ Facter.add("selinux") do
|
|
36
88
|
result = "false"
|
37
89
|
if FileTest.exists?("#{selinux_mount_point}/enforce")
|
38
90
|
if FileTest.exists?("/proc/self/attr/current")
|
39
|
-
|
40
|
-
|
91
|
+
begin
|
92
|
+
if (File.read("/proc/self/attr/current") != "kernel\0")
|
93
|
+
result = "true"
|
94
|
+
end
|
95
|
+
rescue
|
41
96
|
end
|
42
97
|
end
|
43
98
|
end
|
data/lib/facter/ssh.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Fact: system_uptime
|
2
|
+
#
|
3
|
+
# Purpose:
|
4
|
+
# Return the system uptime in a hash in the forms of
|
5
|
+
# seconds, hours, days and a general, human
|
6
|
+
# readable uptime.
|
7
|
+
#
|
8
|
+
# Resolution:
|
9
|
+
# Does basic math on the get_uptime_seconds utility
|
10
|
+
# to calculate seconds, hours and days.
|
11
|
+
#
|
12
|
+
# Caveats:
|
13
|
+
#
|
14
|
+
|
15
|
+
require 'facter/util/uptime'
|
16
|
+
|
17
|
+
Facter.add(:system_uptime) do
|
18
|
+
setcode do
|
19
|
+
system_uptime = {}
|
20
|
+
if Facter.value(:kernel) == 'windows'
|
21
|
+
seconds = Facter::Util::Uptime.get_uptime_seconds_win
|
22
|
+
else
|
23
|
+
seconds = Facter::Util::Uptime.get_uptime_seconds_unix
|
24
|
+
end
|
25
|
+
|
26
|
+
if seconds
|
27
|
+
system_uptime['seconds'] = seconds
|
28
|
+
minutes = seconds / 60 % 60
|
29
|
+
system_uptime['hours'] = seconds / (60 * 60)
|
30
|
+
system_uptime['days'] = system_uptime['hours'] / 24
|
31
|
+
|
32
|
+
case system_uptime['days']
|
33
|
+
when 0 then system_uptime['uptime'] = "#{system_uptime['hours']}:#{"%02d" % minutes} hours"
|
34
|
+
when 1 then system_uptime['uptime'] = "1 day"
|
35
|
+
else system_uptime['uptime'] = "#{system_uptime['days']} days"
|
36
|
+
end
|
37
|
+
else
|
38
|
+
system_uptime['uptime'] = 'unknown'
|
39
|
+
end
|
40
|
+
system_uptime
|
41
|
+
end
|
42
|
+
end
|
data/lib/facter/timezone.rb
CHANGED
data/lib/facter/uptime.rb
CHANGED
@@ -1,34 +1,16 @@
|
|
1
1
|
# Fact: uptime
|
2
2
|
#
|
3
|
-
# Purpose:
|
3
|
+
# Purpose: Return the system uptime in a human-readable format.
|
4
4
|
#
|
5
5
|
# Resolution:
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# Uses the structured system_uptime fact, which does basic math
|
7
|
+
# on the number of seconds of uptime to return a count of days
|
8
|
+
# and hours of uptime.
|
8
9
|
#
|
9
10
|
# Caveats:
|
10
11
|
#
|
11
12
|
|
12
|
-
require 'facter/util/uptime'
|
13
|
-
|
14
13
|
Facter.add(:uptime) do
|
15
|
-
setcode
|
16
|
-
seconds = Facter.fact(:uptime_seconds).value
|
17
|
-
|
18
|
-
unless seconds
|
19
|
-
"unknown"
|
20
|
-
else
|
21
|
-
days = seconds / (60 * 60 * 24)
|
22
|
-
hours = seconds / (60 * 60) % 24
|
23
|
-
minutes = seconds / 60 % 60
|
24
|
-
|
25
|
-
case days
|
26
|
-
when 0 then "#{hours}:#{"%02d" % minutes} hours"
|
27
|
-
when 1 then '1 day'
|
28
|
-
else "#{days} days"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
14
|
+
setcode { Facter.value(:system_uptime)['uptime'] }
|
33
15
|
end
|
34
16
|
|
data/lib/facter/uptime_days.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# Fact: uptime_days
|
2
2
|
#
|
3
|
-
# Purpose: Return
|
3
|
+
# Purpose: Return just the number of days of uptime.
|
4
4
|
#
|
5
|
-
# Resolution:
|
5
|
+
# Resolution: Uses the "days" key of the system_uptime fact, which divides
|
6
|
+
# its own "hours" key by 24
|
6
7
|
#
|
7
8
|
# Caveats:
|
8
9
|
#
|
9
10
|
|
10
11
|
Facter.add(:uptime_days) do
|
11
|
-
setcode
|
12
|
-
hours = Facter.value(:uptime_hours)
|
13
|
-
hours && hours / 24 # hours in day
|
14
|
-
end
|
12
|
+
setcode { Facter.value(:system_uptime)['days'] }
|
15
13
|
end
|
data/lib/facter/uptime_hours.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# Fact: uptime_hours
|
2
2
|
#
|
3
|
-
# Purpose: Return
|
3
|
+
# Purpose: Return just the number of hours of uptime.
|
4
4
|
#
|
5
|
-
# Resolution:
|
5
|
+
# Resolution: Uses the "hours" key of the system_uptime fact, which divides
|
6
|
+
# its own 'seconds' key by 3600.
|
6
7
|
#
|
7
8
|
# Caveats:
|
8
9
|
#
|
9
10
|
|
10
11
|
Facter.add(:uptime_hours) do
|
11
|
-
setcode
|
12
|
-
seconds = Facter.value(:uptime_seconds)
|
13
|
-
seconds && seconds / (60 * 60) # seconds in hour
|
14
|
-
end
|
12
|
+
setcode { Facter.value(:system_uptime)['hours'] }
|
15
13
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
# Fact: uptime_seconds
|
2
2
|
#
|
3
|
-
# Purpose: Return
|
3
|
+
# Purpose: Return just the number of seconds of uptime.
|
4
4
|
#
|
5
5
|
# Resolution:
|
6
|
-
#
|
6
|
+
# Acquires the uptime in seconds via the 'seconds' key of the system_uptime fact,
|
7
|
+
# which uses the `facter/util/uptime.rb` module to try a variety of methods to acquire
|
7
8
|
# the uptime on Unix.
|
8
9
|
#
|
9
|
-
# On Windows, the module calculates the uptime by the
|
10
|
+
# On Windows, the module calculates the uptime by the `LastBootupTime` Windows
|
10
11
|
# management value.
|
11
12
|
#
|
12
13
|
# Caveats:
|
@@ -15,10 +16,5 @@
|
|
15
16
|
require 'facter/util/uptime'
|
16
17
|
|
17
18
|
Facter.add(:uptime_seconds) do
|
18
|
-
setcode { Facter
|
19
|
-
end
|
20
|
-
|
21
|
-
Facter.add(:uptime_seconds) do
|
22
|
-
confine :kernel => :windows
|
23
|
-
setcode { Facter::Util::Uptime.get_uptime_seconds_win }
|
19
|
+
setcode { Facter.value(:system_uptime)['seconds'] }
|
24
20
|
end
|
@@ -22,7 +22,7 @@ module Facter
|
|
22
22
|
# Print the value of a single fact, otherwise print a list sorted by fact
|
23
23
|
# name and separated by "=>"
|
24
24
|
if hash.length == 1
|
25
|
-
if value = hash.values.first
|
25
|
+
if !(value = hash.values.first).nil?
|
26
26
|
output = value.is_a?(String) ? value : value.inspect
|
27
27
|
end
|
28
28
|
else
|
@@ -60,7 +60,7 @@ module Facter::Manufacturer
|
|
60
60
|
|
61
61
|
def self.prtdiag_sparc_find_system_info()
|
62
62
|
# Parses prtdiag for a SPARC architecture string, won't work with Solaris x86
|
63
|
-
output = Facter::Core::Execution.exec('/usr/sbin/prtdiag 2>/dev/null')
|
63
|
+
output = Facter::Core::Execution.exec('/usr/sbin/prtdiag 2>/dev/null | /usr/bin/head -n 10')
|
64
64
|
|
65
65
|
# System Configuration: Sun Microsystems sun4u Sun SPARC Enterprise M3000 Server
|
66
66
|
if output and output =~ /^System Configuration:\s+(.+?)\s+(sun\d+\S+)\s+(.+)/
|
@@ -51,7 +51,7 @@ module Facter::Util::Partitions
|
|
51
51
|
|
52
52
|
def self.filesystem(partition)
|
53
53
|
if Facter::Core::Execution.which('blkid')
|
54
|
-
Facter::Core::Execution.exec("blkid #{File.join('/dev', partition)}").scan(/TYPE="(
|
54
|
+
Facter::Core::Execution.exec("blkid #{File.join('/dev', partition)}").scan(/TYPE="([^"]*)"/).flatten.first
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Facter::Util::Partitions
|
2
|
+
module OpenBSD
|
3
|
+
def self.list
|
4
|
+
Facter::Core::Execution.exec('df').scan(/\/dev\/(\S+)/).flatten
|
5
|
+
end
|
6
|
+
|
7
|
+
# On OpenBSD partitions don't have a UUID; disks have DUID but that's not
|
8
|
+
# compatible.
|
9
|
+
def self.uuid(partition)
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.mount(partition)
|
14
|
+
scan_mount(/\/dev\/#{partition}\son\s(\S+)/)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Reported size is in 1K blocks
|
18
|
+
def self.size(partition)
|
19
|
+
scan_df(/\/dev\/#{partition}\s+(\S+)/)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.filesystem(partition)
|
23
|
+
scan_mount(/\/dev\/#{partition}\son\s\S+\stype\s(\S+)/)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def self.scan_mount(scan_regex)
|
28
|
+
Facter::Core::Execution.exec('mount').scan(scan_regex).flatten.first
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.scan_df(scan_regex)
|
32
|
+
Facter::Core::Execution.exec('df -k').scan(scan_regex).flatten.first
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/facter/util/uptime.rb
CHANGED
@@ -28,7 +28,8 @@ module Facter::Util::Uptime
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.uptime_sysctl
|
31
|
-
|
31
|
+
require 'facter/util/posix'
|
32
|
+
output = Facter::Util::POSIX.sysctl(uptime_sysctl_variable)
|
32
33
|
if output
|
33
34
|
compute_uptime(Time.at(output.match(/\d+/)[0].to_i))
|
34
35
|
end
|
@@ -71,8 +72,8 @@ module Facter::Util::Uptime
|
|
71
72
|
"/proc/uptime"
|
72
73
|
end
|
73
74
|
|
74
|
-
def self.
|
75
|
-
'
|
75
|
+
def self.uptime_sysctl_variable
|
76
|
+
'kern.boottime'
|
76
77
|
end
|
77
78
|
|
78
79
|
def self.uptime_executable_cmd
|
data/lib/facter/util/virtual.rb
CHANGED
@@ -95,8 +95,10 @@ module Facter::Util::Virtual
|
|
95
95
|
File.read("/proc/cpuinfo")
|
96
96
|
elsif ["FreeBSD", "OpenBSD"].include? Facter.value(:kernel)
|
97
97
|
Facter::Util::POSIX.sysctl("hw.model")
|
98
|
+
elsif Facter.value(:kernel) == "SunOS" and FileTest.exists?("/usr/sbin/prtconf")
|
99
|
+
Facter::Core::Execution.exec("/usr/sbin/prtconf -v")
|
98
100
|
end
|
99
|
-
(txt =~ /QEMU Virtual CPU/) ? true : false
|
101
|
+
(txt =~ /QEMU Virtual (CPU|Machine)/i) ? true : false
|
100
102
|
end
|
101
103
|
|
102
104
|
def self.virtualbox?
|