facter 2.1.0-x86-mingw32 → 2.2.0-x86-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.

Files changed (139) hide show
  1. data/COMMITTERS.md +25 -34
  2. data/CONTRIBUTING.md +27 -5
  3. data/README.md +32 -0
  4. data/ext/build_defaults.yaml +1 -1
  5. data/ext/debian/control +3 -2
  6. data/ext/osx/file_mapping.yaml +5 -0
  7. data/ext/redhat/facter.spec.erb +4 -1
  8. data/lib/facter/Cfkey.rb +2 -2
  9. data/lib/facter/architecture.rb +2 -2
  10. data/lib/facter/augeasversion.rb +2 -2
  11. data/lib/facter/blockdevices.rb +12 -12
  12. data/lib/facter/dhcp_servers.rb +4 -4
  13. data/lib/facter/domain.rb +4 -4
  14. data/lib/facter/ec2.rb +17 -0
  15. data/lib/facter/ec2/rest.rb +2 -2
  16. data/lib/facter/facterversion.rb +2 -2
  17. data/lib/facter/filesystems.rb +10 -3
  18. data/lib/facter/fqdn.rb +1 -1
  19. data/lib/facter/gid.rb +16 -0
  20. data/lib/facter/hardwareisa.rb +3 -3
  21. data/lib/facter/hardwaremodel.rb +3 -3
  22. data/lib/facter/hostname.rb +1 -1
  23. data/lib/facter/id.rb +4 -4
  24. data/lib/facter/interfaces.rb +3 -0
  25. data/lib/facter/ipaddress6.rb +9 -9
  26. data/lib/facter/kernel.rb +2 -2
  27. data/lib/facter/kernelmajversion.rb +2 -2
  28. data/lib/facter/kernelrelease.rb +4 -4
  29. data/lib/facter/kernelversion.rb +3 -3
  30. data/lib/facter/ldom.rb +11 -0
  31. data/lib/facter/lsbdistcodename.rb +8 -4
  32. data/lib/facter/lsbdistdescription.rb +6 -10
  33. data/lib/facter/lsbdistid.rb +8 -4
  34. data/lib/facter/lsbdistrelease.rb +8 -4
  35. data/lib/facter/lsbmajdistrelease.rb +7 -12
  36. data/lib/facter/lsbminordistrelease.rb +22 -0
  37. data/lib/facter/lsbrelease.rb +8 -4
  38. data/lib/facter/macaddress.rb +1 -0
  39. data/lib/facter/macosx.rb +1 -1
  40. data/lib/facter/manufacturer.rb +3 -3
  41. data/lib/facter/memory.rb +8 -8
  42. data/lib/facter/netmask.rb +2 -1
  43. data/lib/facter/network.rb +3 -3
  44. data/lib/facter/operatingsystem.rb +9 -126
  45. data/lib/facter/operatingsystem/base.rb +61 -0
  46. data/lib/facter/operatingsystem/cumuluslinux.rb +27 -0
  47. data/lib/facter/operatingsystem/implementation.rb +30 -0
  48. data/lib/facter/operatingsystem/linux.rb +467 -0
  49. data/lib/facter/operatingsystem/sunos.rb +54 -0
  50. data/lib/facter/operatingsystem/vmkernel.rb +11 -0
  51. data/lib/facter/operatingsystem/windows.rb +37 -0
  52. data/lib/facter/operatingsystemmajrelease.rb +14 -33
  53. data/lib/facter/operatingsystemrelease.rb +14 -235
  54. data/lib/facter/os.rb +69 -0
  55. data/lib/facter/osfamily.rb +4 -23
  56. data/lib/facter/partitions.rb +4 -3
  57. data/lib/facter/path.rb +2 -2
  58. data/lib/facter/physicalprocessorcount.rb +10 -74
  59. data/lib/facter/processor.rb +13 -129
  60. data/lib/facter/processors.rb +60 -0
  61. data/lib/facter/processors/os.rb +234 -0
  62. data/lib/facter/ps.rb +5 -4
  63. data/lib/facter/puppetversion.rb +1 -1
  64. data/lib/facter/rackspace.rb +34 -0
  65. data/lib/facter/rubysitedir.rb +3 -0
  66. data/lib/facter/rubyversion.rb +2 -2
  67. data/lib/facter/selinux.rb +57 -2
  68. data/lib/facter/ssh.rb +1 -0
  69. data/lib/facter/system_uptime.rb +42 -0
  70. data/lib/facter/timezone.rb +1 -1
  71. data/lib/facter/uptime.rb +5 -23
  72. data/lib/facter/uptime_days.rb +4 -6
  73. data/lib/facter/uptime_hours.rb +4 -6
  74. data/lib/facter/uptime_seconds.rb +5 -9
  75. data/lib/facter/util/formatter.rb +1 -1
  76. data/lib/facter/util/manufacturer.rb +1 -1
  77. data/lib/facter/util/partitions.rb +3 -1
  78. data/lib/facter/util/partitions/linux.rb +1 -1
  79. data/lib/facter/util/partitions/openbsd.rb +35 -0
  80. data/lib/facter/util/uptime.rb +4 -3
  81. data/lib/facter/util/virtual.rb +3 -1
  82. data/lib/facter/util/xendomains.rb +12 -3
  83. data/lib/facter/version.rb +1 -1
  84. data/lib/facter/virtual.rb +24 -23
  85. data/lib/facter/vlans.rb +1 -1
  86. data/lib/facter/xendomains.rb +1 -1
  87. data/lib/facter/zfs_version.rb +6 -2
  88. data/lib/facter/zones.rb +6 -5
  89. data/lib/facter/zpool_version.rb +1 -1
  90. data/spec/fixtures/cpuinfo/amd64dual-grep +2 -0
  91. data/spec/fixtures/cpuinfo/amd64twentyfour-grep +24 -0
  92. data/spec/fixtures/cpuinfo/two_multicore-grep +4 -0
  93. data/spec/fixtures/cpuinfo/two_singlecore-grep +2 -0
  94. data/spec/fixtures/unit/processors/os/darwin-system-profiler +287 -0
  95. data/spec/fixtures/unit/zfs_version/zfs_new +61 -0
  96. data/spec/fixtures/unit/zfs_version/zfs_old +43 -0
  97. data/spec/fixtures/unit/zfs_version/zfsonlinux_0.6.1 +13 -0
  98. data/spec/fixtures/unit/zpool_version/zfsonlinux_0.6.1 +48 -0
  99. data/spec/unit/ec2/rest_spec.rb +6 -6
  100. data/spec/unit/gid_spec.rb +22 -0
  101. data/spec/unit/hardwaremodel_spec.rb +2 -0
  102. data/spec/unit/lsbdistcodename_spec.rb +22 -17
  103. data/spec/unit/lsbdistdescription_spec.rb +22 -17
  104. data/spec/unit/lsbdistid_spec.rb +23 -18
  105. data/spec/unit/lsbdistrelease_spec.rb +22 -17
  106. data/spec/unit/lsbmajdistrelease_spec.rb +23 -6
  107. data/spec/unit/lsbminordistrelease_spec.rb +31 -0
  108. data/spec/unit/lsbrelease_spec.rb +22 -17
  109. data/spec/unit/macaddress_spec.rb +3 -0
  110. data/spec/unit/operatingsystem/base_spec.rb +76 -0
  111. data/spec/unit/operatingsystem/cumuluslinux_spec.rb +40 -0
  112. data/spec/unit/operatingsystem/implementation_spec.rb +49 -0
  113. data/spec/unit/operatingsystem/linux_spec.rb +538 -0
  114. data/spec/unit/operatingsystem/sunos_spec.rb +144 -0
  115. data/spec/unit/operatingsystem/vmkernel_spec.rb +13 -0
  116. data/spec/unit/operatingsystem/windows_spec.rb +68 -0
  117. data/spec/unit/operatingsystem_spec.rb +10 -153
  118. data/spec/unit/operatingsystemmajrelease_spec.rb +14 -31
  119. data/spec/unit/operatingsystemrelease_spec.rb +13 -229
  120. data/spec/unit/os_spec.rb +131 -0
  121. data/spec/unit/osfamily_spec.rb +9 -54
  122. data/spec/unit/partitions_spec.rb +41 -3
  123. data/spec/unit/physicalprocessorcount_spec.rb +6 -78
  124. data/spec/unit/processor_spec.rb +18 -381
  125. data/spec/unit/processors/os_spec.rb +446 -0
  126. data/spec/unit/processors_spec.rb +203 -0
  127. data/spec/unit/rackspace_spec.rb +40 -0
  128. data/spec/unit/system_uptime_spec.rb +80 -0
  129. data/spec/unit/util/formatter_spec.rb +5 -0
  130. data/spec/unit/util/macaddress_spec.rb +2 -0
  131. data/spec/unit/util/processor_spec.rb +120 -0
  132. data/spec/unit/util/uptime_spec.rb +3 -4
  133. data/spec/unit/util/virtual_spec.rb +8 -0
  134. data/spec/unit/util/xendomains_spec.rb +54 -9
  135. data/spec/unit/virtual_spec.rb +8 -1
  136. data/spec/unit/zfs_version_spec.rb +20 -8
  137. data/spec/unit/zpool_version_spec.rb +5 -0
  138. metadata +660 -589
  139. checksums.yaml +0 -7
@@ -1,11 +1,12 @@
1
1
  # Fact: ps
2
2
  #
3
- # Purpose: Internal fact for what to use to list all processes. Used by
4
- # Service{} type in Puppet.
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 "ps -ef" for all operating systems other than BSD derivatives, where
8
- # it uses "ps auxwww"
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
  #
@@ -3,7 +3,7 @@
3
3
  # Purpose: Return the version of puppet installed.
4
4
  #
5
5
  # Resolution:
6
- # Requres puppet via Ruby and returns it's version constant.
6
+ # Requires puppet via Ruby and returns the value of its version constant.
7
7
  #
8
8
  # Caveats:
9
9
  #
@@ -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
@@ -2,6 +2,9 @@
2
2
  #
3
3
  # Purpose: Returns Ruby's site library directory.
4
4
  #
5
+ # Resolution:
6
+ # Uses the RbConfig module.
7
+ #
5
8
 
6
9
  require 'rbconfig'
7
10
 
@@ -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
  #
@@ -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
- if (File.read("/proc/self/attr/current") != "kernel\0")
40
- result = "true"
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
@@ -1,6 +1,7 @@
1
1
  # Fact: ssh
2
2
  #
3
3
  # Purpose:
4
+ # Gather facts related to SSH.
4
5
  #
5
6
  # Resolution:
6
7
  #
@@ -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
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Purpose: Return the machine's time zone.
4
4
  #
5
- # Resolution: Uses's Ruby's Time module's Time.new call.
5
+ # Resolution: Uses Ruby's Time module.
6
6
  #
7
7
  # Caveats:
8
8
  #
@@ -1,34 +1,16 @@
1
1
  # Fact: uptime
2
2
  #
3
- # Purpose: return the system uptime in a human readable format.
3
+ # Purpose: Return the system uptime in a human-readable format.
4
4
  #
5
5
  # Resolution:
6
- # Does basic maths on the "uptime_seconds" fact to return a count of
7
- # days, hours and minutes of uptime
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 do
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
 
@@ -1,15 +1,13 @@
1
1
  # Fact: uptime_days
2
2
  #
3
- # Purpose: Return purely number of days of uptime.
3
+ # Purpose: Return just the number of days of uptime.
4
4
  #
5
- # Resolution: Divides uptime_hours fact by 24.
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 do
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
@@ -1,15 +1,13 @@
1
1
  # Fact: uptime_hours
2
2
  #
3
- # Purpose: Return purely number of hours of uptime.
3
+ # Purpose: Return just the number of hours of uptime.
4
4
  #
5
- # Resolution: Divides uptime_seconds fact by 3600.
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 do
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 purely number of seconds of uptime.
3
+ # Purpose: Return just the number of seconds of uptime.
4
4
  #
5
5
  # Resolution:
6
- # Using the 'facter/util/uptime.rb' module, try a verity of methods to acquire
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 "LastBootupTime" Windows
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::Util::Uptime.get_uptime_seconds_unix }
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+(.+)/
@@ -1,8 +1,10 @@
1
1
  require 'facter/util/partitions/linux'
2
+ require 'facter/util/partitions/openbsd'
2
3
 
3
4
  module Facter::Util::Partitions
4
5
  IMPLEMENTATIONS = {
5
- 'Linux' => Linux
6
+ 'Linux' => Linux,
7
+ 'OpenBSD' => OpenBSD,
6
8
  }
7
9
 
8
10
  module NoImplementation
@@ -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="(.+)"/).flatten.first
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
@@ -28,7 +28,8 @@ module Facter::Util::Uptime
28
28
  end
29
29
 
30
30
  def self.uptime_sysctl
31
- output = Facter::Core::Execution.execute("#{uptime_sysctl_cmd} 2>/dev/null", :on_fail => nil)
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.uptime_sysctl_cmd
75
- 'sysctl -n kern.boottime'
75
+ def self.uptime_sysctl_variable
76
+ 'kern.boottime'
76
77
  end
77
78
 
78
79
  def self.uptime_executable_cmd
@@ -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?
@@ -1,10 +1,19 @@
1
1
  # A module to gather running Xen Domains
2
2
  #
3
3
  module Facter::Util::Xendomains
4
+ XEN_COMMANDS = ['/usr/sbin/xl', '/usr/sbin/xm']
5
+
6
+ def self.xen_command
7
+ XEN_COMMANDS.find { |cmd| Facter::Util::Resolution.which(cmd) }
8
+ end
9
+
4
10
  def self.get_domains
5
- if xm_list = Facter::Core::Execution.exec('/usr/sbin/xm list 2>/dev/null')
6
- domains = xm_list.split("\n").reject { |line| line =~ /^(Name|Domain-0)/ }
7
- domains.map { |line| line.split(/\s/)[0] }.join(',')
11
+ command = self.xen_command
12
+ if command
13
+ if domains_list = Facter::Util::Resolution.exec("#{command} list 2>/dev/null")
14
+ domains = domains_list.split("\n").reject { |line| line =~ /^(Name|Domain-0)/ }
15
+ domains.map { |line| line.split(/\s/)[0] }.join(',')
16
+ end
8
17
  end
9
18
  end
10
19
  end