facter 1.6.2 → 1.6.3

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 (57) hide show
  1. data/CHANGELOG +11 -0
  2. data/LICENSE +1 -1
  3. data/conf/osx/createpackage.sh +1 -1
  4. data/conf/redhat/facter.spec +9 -6
  5. data/conf/solaris/pkginfo +1 -1
  6. data/install.rb +1 -1
  7. data/lib/facter.rb +2 -2
  8. data/lib/facter/architecture.rb +1 -2
  9. data/lib/facter/augeasversion.rb +1 -2
  10. data/lib/facter/domain.rb +3 -3
  11. data/lib/facter/hardwareisa.rb +1 -1
  12. data/lib/facter/ipaddress.rb +2 -2
  13. data/lib/facter/lsbmajdistrelease.rb +1 -1
  14. data/lib/facter/macaddress.rb +2 -2
  15. data/lib/facter/manufacturer.rb +1 -1
  16. data/lib/facter/netmask.rb +0 -3
  17. data/lib/facter/network.rb +2 -3
  18. data/lib/facter/operatingsystem.rb +5 -2
  19. data/lib/facter/operatingsystemrelease.rb +3 -3
  20. data/lib/facter/osfamily.rb +1 -1
  21. data/lib/facter/processor.rb +2 -2
  22. data/lib/facter/selinux.rb +3 -3
  23. data/lib/facter/uniqueid.rb +1 -1
  24. data/lib/facter/uptime_days.rb +0 -1
  25. data/lib/facter/uptime_hours.rb +0 -1
  26. data/lib/facter/util/manufacturer.rb +2 -3
  27. data/lib/facter/util/processor.rb +3 -3
  28. data/lib/facter/util/resolution.rb +3 -3
  29. data/lib/facter/util/values.rb +1 -1
  30. data/lib/facter/virtual.rb +2 -2
  31. data/lib/facter/vlans.rb +1 -2
  32. data/lib/facter/xendomains.rb +0 -1
  33. data/spec/fixtures/unit/util/manufacturer/solaris_sunfire_v120_prtdiag +33 -0
  34. data/spec/fixtures/unit/util/manufacturer/solaris_t5220_prtdiag +136 -0
  35. data/spec/spec_helper.rb +5 -0
  36. data/spec/unit/architecture_spec.rb +40 -40
  37. data/spec/unit/facter_spec.rb +220 -220
  38. data/spec/unit/id_spec.rb +16 -16
  39. data/spec/unit/interfaces_spec.rb +6 -6
  40. data/spec/unit/memory_spec.rb +105 -105
  41. data/spec/unit/operatingsystem_spec.rb +72 -63
  42. data/spec/unit/operatingsystemrelease_spec.rb +44 -43
  43. data/spec/unit/processor_spec.rb +2 -2
  44. data/spec/unit/selinux_spec.rb +53 -53
  45. data/spec/unit/util/collection_spec.rb +183 -183
  46. data/spec/unit/util/confine_spec.rb +92 -92
  47. data/spec/unit/util/fact_spec.rb +96 -96
  48. data/spec/unit/util/ip_spec.rb +218 -218
  49. data/spec/unit/util/loader_spec.rb +193 -193
  50. data/spec/unit/util/macosx_spec.rb +63 -63
  51. data/spec/unit/util/manufacturer_spec.rb +124 -107
  52. data/spec/unit/util/resolution_spec.rb +235 -235
  53. data/spec/unit/util/virtual_spec.rb +167 -167
  54. data/spec/unit/util/vlans_spec.rb +6 -6
  55. data/spec/unit/virtual_spec.rb +246 -246
  56. data/spec/watchr.rb +1 -1
  57. metadata +6 -4
data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ 1.6.3
2
+ ===
3
+ b2a66a9 (#7038) Validate prtdiag output in manufacturer
4
+ c9db305 (#10228) Ascendos OS support for various facts.
5
+ 6efadbb (#10233) Adds support for Parallels Server Bare Metal to Facter
6
+ ce8f572 (#10079) Remove trailing whitespace
7
+ e89758d Updated CHANGELOG for 1.6.2
8
+ 7b14b77 (#9928) Correct readlines stubbing to return an array instead of an empty string.
9
+ 0d6df28 (#9904) Remove windows rspec warning.
10
+ f0ccb5e (#9555) Spec tests: Change all cases of tabs and 4 space indentation to 2 space indentation.
11
+
1
12
  1.6.2
2
13
  ===
3
14
  d7c00f6 (#9852) Fixing watchr on facter
data/LICENSE CHANGED
@@ -11,5 +11,5 @@ http://www.apache.org/licenses/LICENSE-2.0
11
11
  Unless required by applicable law or agreed to in writing, software
12
12
  distributed under the License is distributed on an "AS IS" BASIS,
13
13
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
14
+ See the License for the specific language governing permissions and
15
15
  limitations under the License.
@@ -56,7 +56,7 @@ function install_facter() {
56
56
 
57
57
  function install_docs() {
58
58
  echo "Installing docs to ${pkgroot}"
59
- docdir="${pkgroot}/usr/share/doc/facter"
59
+ docdir="${pkgroot}/usr/share/doc/facter"
60
60
  mkdir -p "${docdir}"
61
61
  for docfile in ChangeLog COPYING LICENSE README README.rst TODO; do
62
62
  install -m 0644 "${facter_root}/${docfile}" "${docdir}"
@@ -2,17 +2,17 @@
2
2
 
3
3
  %define has_ruby_abi 0%{?fedora} || 0%{?rhel} >= 5
4
4
  %define has_ruby_noarch %has_ruby_abi
5
- %global _ver 1.6.2
5
+ %global _ver 1.6.3
6
6
 
7
7
  Summary: Ruby module for collecting simple facts about a host operating system
8
8
  Name: facter
9
- Version: 1.6.2
10
- Release: 1%{?dist}
9
+ Version: 1.6.3
10
+ Release: 0.1rc1%{?dist}
11
11
  License: Apache 2.0
12
12
  Group: System Environment/Base
13
13
  URL: http://www.puppetlabs.com/puppet/related-projects/%{name}/
14
- Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{_ver}.tar.gz
15
- #Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.sign
14
+ Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz
15
+ #Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc1.tar.gz.asc
16
16
 
17
17
  BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
18
18
  %if %has_ruby_noarch
@@ -32,7 +32,7 @@ system. Some of the facts are preconfigured, such as the hostname and the
32
32
  operating system. Additional facts can be added through simple Ruby scripts
33
33
 
34
34
  %prep
35
- %setup -q -n %{name}-%{_ver}
35
+ %setup -q -n %{name}-%{version}rc1
36
36
 
37
37
  %build
38
38
 
@@ -53,6 +53,9 @@ rm -rf %{buildroot}
53
53
 
54
54
 
55
55
  %changelog
56
+ * Mon Oct 31 2011 Michael Stahnke <stahnma@puppetlabs.com> - 1.6.3-0.1rc1
57
+ - 1.6.3 rc1
58
+
56
59
  * Mon Oct 10 2011 Michael Stahnke <stahnma@puppetlabs.com> - 1.6.2-1
57
60
  - Update to 1.6.2
58
61
 
@@ -1,6 +1,6 @@
1
1
  PKG=CSWfacter
2
2
  NAME=facter - System Fact Gatherer
3
- VERSION=1.6.2
3
+ VERSION=1.6.3rc1
4
4
  CATEGORY=application
5
5
  VENDOR=http://www.puppetlabs.com/puppet/related-projects/facter
6
6
  HOTLINE=http://puppetlabs.com/cgi-bin/facter.cgi
data/install.rb CHANGED
@@ -101,7 +101,7 @@ def do_libs(libs, strip = 'lib/')
101
101
  end
102
102
 
103
103
  def do_man(man, strip = 'man/')
104
- if (InstallOptions.man == true)
104
+ if (InstallOptions.man == true)
105
105
  man.each do |mf|
106
106
  omf = File.join(InstallOptions.man_dir, mf.gsub(/#{strip}/, ''))
107
107
  om = File.dirname(omf)
@@ -11,7 +11,7 @@
11
11
  # Unless required by applicable law or agreed to in writing, software
12
12
  # distributed under the License is distributed on an "AS IS" BASIS,
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
14
+ # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
17
  module Facter
@@ -24,7 +24,7 @@ module Facter
24
24
  include Comparable
25
25
  include Enumerable
26
26
 
27
- FACTERVERSION = '1.6.2'
27
+ FACTERVERSION = '1.6.3'
28
28
  # = Facter
29
29
  # Functions as a hash of 'facts' you might care about about your
30
30
  # system, such as mac address, IP address, Video card, etc.
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Purpose:
4
4
  # Return the CPU hardware architecture.
5
- #
5
+ #
6
6
  # Resolution:
7
7
  # On OpenBSD, Linux and Debian's kfreebsd, use the hardwaremodel fact.
8
8
  # Gentoo and Debian call "x86_86" "amd64".
@@ -35,4 +35,3 @@ Facter.add(:architecture) do
35
35
  end
36
36
  end
37
37
  end
38
-
@@ -7,7 +7,7 @@
7
7
  # the underlying Augeas library.
8
8
  #
9
9
  # Caveats:
10
- # The library version may not indicate the presence of certain lenses,
10
+ # The library version may not indicate the presence of certain lenses,
11
11
  # depending on the system packages updated, nor the version of ruby-augeas
12
12
  # which may affect support for the Puppet Augeas provider.
13
13
  # Versions prior to 0.3.6 cannot be interrogated for their version.
@@ -26,4 +26,3 @@ Facter.add(:augeasversion) do
26
26
  end
27
27
  end
28
28
  end
29
-
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Purpose:
4
4
  # Return the host's primary DNS domain name.
5
- #
5
+ #
6
6
  # Resolution:
7
7
  # On UNIX (excluding Darwin), first try and use the hostname fact,
8
8
  # which uses the hostname system command, and then parse the output
@@ -23,11 +23,11 @@ Facter.add(:domain) do
23
23
  # Get the domain from various sources; the order of these
24
24
  # steps is important
25
25
 
26
- if name = Facter::Util::Resolution.exec('hostname') and
26
+ if name = Facter::Util::Resolution.exec('hostname') and
27
27
  name =~ /.*?\.(.+$)/
28
28
 
29
29
  $1
30
- elsif domain = Facter::Util::Resolution.exec('dnsdomainname') and
30
+ elsif domain = Facter::Util::Resolution.exec('dnsdomainname') and
31
31
  domain =~ /.+\..+/
32
32
 
33
33
  domain
@@ -12,5 +12,5 @@
12
12
 
13
13
  Facter.add(:hardwareisa) do
14
14
  setcode 'uname -p'
15
- confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS Scientific SLC SuSE SLES Debian Ubuntu Gentoo FreeBSD OpenBSD NetBSD DragonFly OEL OracleLinux OVS GNU/kFreeBSD}
15
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS Scientific PSBM SLC Ascendos SuSE SLES Debian Ubuntu Gentoo FreeBSD OpenBSD NetBSD DragonFly OEL OracleLinux OVS GNU/kFreeBSD}
16
16
  end
@@ -117,13 +117,13 @@ Facter.add(:ipaddress, :ldapname => "iphostnumber", :timeout => 2) do
117
117
  else
118
118
  require 'resolv'
119
119
  end
120
-
120
+
121
121
  begin
122
122
  if hostname = Facter.value(:hostname)
123
123
  if Facter.value(:kernel) == 'windows'
124
124
  ip = Win32::Resolv.get_resolv_info.last[0]
125
125
  else
126
- ip = Resolv.getaddress(hostname)
126
+ ip = Resolv.getaddress(hostname)
127
127
  end
128
128
  unless ip == "127.0.0.1"
129
129
  ip
@@ -15,7 +15,7 @@
15
15
  require 'facter'
16
16
 
17
17
  Facter.add("lsbmajdistrelease") do
18
- confine :operatingsystem => %w{Linux Fedora RedHat CentOS Scientific SLC SuSE SLES Debian Ubuntu Gentoo OEL OracleLinux OVS GNU/kFreeBSD}
18
+ confine :operatingsystem => %w{Linux Fedora RedHat CentOS Scientific PSBM SLC Ascendos SuSE SLES Debian Ubuntu Gentoo OEL OracleLinux OVS GNU/kFreeBSD}
19
19
  setcode do
20
20
  if /(\d*)\./i =~ Facter.value(:lsbdistrelease)
21
21
  result=$1
@@ -1,6 +1,6 @@
1
1
  # Fact: macaddress
2
2
  #
3
- # Purpose:
3
+ # Purpose:
4
4
  #
5
5
  # Resolution:
6
6
  #
@@ -10,7 +10,7 @@
10
10
  require 'facter/util/macaddress'
11
11
 
12
12
  Facter.add(:macaddress) do
13
- confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS Scientific SLC SuSE SLES Debian Gentoo Ubuntu OEL OracleLinux OVS GNU/kFreeBSD}
13
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS Scientific PSBM SLC Ascendos SuSE SLES Debian Gentoo Ubuntu OEL OracleLinux OVS GNU/kFreeBSD}
14
14
  setcode do
15
15
  ether = []
16
16
  output = Facter::Util::Resolution.exec("/sbin/ifconfig -a")
@@ -26,7 +26,7 @@ if Facter.value(:kernel) == "OpenBSD"
26
26
  }
27
27
 
28
28
  Facter::Manufacturer.sysctl_find_system_info(mfg_keys)
29
- elsif Facter.value(:kernel) == "Darwin"
29
+ elsif Facter.value(:kernel) == "Darwin"
30
30
  mfg_keys = {
31
31
  'hw.model' => 'productname'
32
32
  }
@@ -6,7 +6,6 @@
6
6
  #
7
7
  # Caveats:
8
8
  #
9
-
10
9
  # netmask.rb
11
10
  # Find the netmask of the primary ipaddress
12
11
  # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
@@ -14,7 +13,6 @@
14
13
  #
15
14
  # idea and originial source by Mark 'phips' Phillips
16
15
  #
17
-
18
16
  require 'facter/util/netmask'
19
17
 
20
18
  Facter.add("netmask") do
@@ -23,4 +21,3 @@ Facter.add("netmask") do
23
21
  Facter::NetMask.get_netmask
24
22
  end
25
23
  end
26
-
@@ -9,13 +9,12 @@
9
9
  #
10
10
  # Caveats:
11
11
  #
12
-
13
12
  require 'facter/util/ip'
14
13
 
15
14
  Facter::Util::IP.get_interfaces.each do |interface|
16
15
  Facter.add("network_" + Facter::Util::IP.alphafy(interface)) do
17
16
  setcode do
18
17
  Facter::Util::IP.get_network_value(interface)
19
- end
20
- end
18
+ end
19
+ end
21
20
  end
@@ -10,7 +10,6 @@
10
10
  #
11
11
  # Caveats:
12
12
  #
13
-
14
13
  require 'facter/lsb'
15
14
 
16
15
  Facter.add(:operatingsystem) do
@@ -55,10 +54,14 @@ Facter.add(:operatingsystem) do
55
54
  "CentOS"
56
55
  elsif txt =~ /CERN/
57
56
  "SLC"
58
- elsif txt =~ /scientific/i
57
+ elsif txt =~ /scientific/i
59
58
  "Scientific"
60
59
  elsif txt =~ /^cloudlinux/i
61
60
  "CloudLinux"
61
+ elsif txt =~ /^Parallels Server Bare Metal/i
62
+ "PSBM"
63
+ elsif txt =~ /Ascendos/i
64
+ "Ascendos"
62
65
  else
63
66
  "RedHat"
64
67
  end
@@ -10,17 +10,17 @@
10
10
  # information.
11
11
  # On Slackware, parses '/etc/slackware-version'.
12
12
  # On Amazon Linux, returns the 'lsbdistrelease' value.
13
- #
13
+ #
14
14
  # On all remaining systems, returns the 'kernelrelease' value.
15
15
  #
16
16
  # Caveats:
17
17
  #
18
18
 
19
19
  Facter.add(:operatingsystemrelease) do
20
- confine :operatingsystem => %w{CentOS Fedora oel ovs OracleLinux RedHat MeeGo Scientific SLC CloudLinux}
20
+ confine :operatingsystem => %w{CentOS Fedora oel ovs OracleLinux RedHat MeeGo Scientific SLC Ascendos CloudLinux PSBM}
21
21
  setcode do
22
22
  case Facter.value(:operatingsystem)
23
- when "CentOS", "RedHat", "Scientific", "SLC", "CloudLinux"
23
+ when "CentOS", "RedHat", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM"
24
24
  releasefile = "/etc/redhat-release"
25
25
  when "Fedora"
26
26
  releasefile = "/etc/fedora-release"
@@ -16,7 +16,7 @@ Facter.add(:osfamily) do
16
16
 
17
17
  setcode do
18
18
  case Facter.value(:operatingsystem)
19
- when "RedHat", "Fedora", "CentOS", "Scientific", "SLC", "CloudLinux", "OracleLinux", "OVS", "OEL"
19
+ when "RedHat", "Fedora", "CentOS", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM", "OracleLinux", "OVS", "OEL"
20
20
  "RedHat"
21
21
  when "Ubuntu", "Debian"
22
22
  "Debian"
@@ -25,7 +25,7 @@ Facter.add("ProcessorCount") do
25
25
  confine :kernel => [ :linux, :"gnu/kfreebsd" ]
26
26
  setcode do
27
27
  processor_list = Facter::Util::Processor.enum_cpuinfo
28
-
28
+
29
29
  ## If this returned nothing, then don't resolve the fact
30
30
  if processor_list.length != 0
31
31
  processor_list.length.to_s
@@ -51,7 +51,7 @@ Facter.add("ProcessorCount") do
51
51
  confine :kernel => :aix
52
52
  setcode do
53
53
  processor_list = Facter::Util::Processor.enum_lsdev
54
-
54
+
55
55
  processor_list.length.to_s
56
56
  end
57
57
  end
@@ -12,7 +12,7 @@
12
12
 
13
13
  sestatus_cmd = '/usr/sbin/sestatus'
14
14
 
15
- # This supports the fact that the selinux mount point is not always in the
15
+ # This supports the fact that the selinux mount point is not always in the
16
16
  # same location -- the selinux mount point is operating system specific.
17
17
  def selinux_mount_point
18
18
  if FileTest.exists?('/proc/self/mountinfo')
@@ -29,7 +29,7 @@ end
29
29
  Facter.add("selinux") do
30
30
  confine :kernel => :linux
31
31
  setcode do
32
- result = "false"
32
+ result = "false"
33
33
  if FileTest.exists?("#{selinux_mount_point}/enforce")
34
34
  if FileTest.exists?("/proc/self/attr/current")
35
35
  if (File.read("/proc/self/attr/current") != "kernel\0")
@@ -90,7 +90,7 @@ Facter.add("selinux_config_policy") do
90
90
  end
91
91
  end
92
92
 
93
- # This is a legacy fact which returns the old selinux_mode fact value to prevent
93
+ # This is a legacy fact which returns the old selinux_mode fact value to prevent
94
94
  # breakages of existing manifests. It should be removed at the next major release.
95
95
  # See ticket #6677.
96
96
 
@@ -1,4 +1,4 @@
1
1
  Facter.add(:uniqueid) do
2
2
  setcode 'hostid'
3
- confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS Scientific SLC SuSE SLES Debian Ubuntu Gentoo AIX OEL OracleLinux OVS GNU/kFreeBSD}
3
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS Scientific PSBM SLC Ascendos SuSE SLES Debian Ubuntu Gentoo AIX OEL OracleLinux OVS GNU/kFreeBSD}
4
4
  end
@@ -13,4 +13,3 @@ Facter.add(:uptime_days) do
13
13
  hours && hours / 24 # hours in day
14
14
  end
15
15
  end
16
-
@@ -13,4 +13,3 @@ Facter.add(:uptime_hours) do
13
13
  seconds && seconds / (60 * 60) # seconds in hour
14
14
  end
15
15
  end
16
-
@@ -63,11 +63,10 @@ module Facter::Manufacturer
63
63
 
64
64
  def self.prtdiag_sparc_find_system_info()
65
65
  # Parses prtdiag for a SPARC architecture string, won't work with Solaris x86
66
- output = Facter::Util::Resolution.exec('/usr/sbin/prtdiag')
66
+ output = Facter::Util::Resolution.exec('/usr/sbin/prtdiag 2>/dev/null')
67
67
 
68
68
  # System Configuration: Sun Microsystems sun4u Sun SPARC Enterprise M3000 Server
69
- sysconfig = output.split("\n")[0]
70
- if sysconfig =~ /^System Configuration:\s+(.+?)\s+(sun\d+\S+)\s+(.+)/ then
69
+ if output and output =~ /^System Configuration:\s+(.+?)\s+(sun\d+\S+)\s+(.+)/
71
70
  Facter.add('manufacturer') do
72
71
  setcode do
73
72
  $1
@@ -21,7 +21,7 @@ module Facter::Util::Processor
21
21
  end
22
22
  end
23
23
  end
24
-
24
+
25
25
  when "ppc64"
26
26
  Thread::exclusive do
27
27
  File.readlines(cpuinfo).each do |l|
@@ -33,7 +33,7 @@ module Facter::Util::Processor
33
33
  end
34
34
  end
35
35
  end
36
-
36
+
37
37
  when /arm/
38
38
  Thread::exclusive do
39
39
  File.readlines(cpuinfo).each do |l|
@@ -63,7 +63,7 @@ module Facter::Util::Processor
63
63
  end
64
64
  processor_list
65
65
  end
66
-
66
+
67
67
  def self.enum_lsdev
68
68
  processor_num = -1
69
69
  processor_list = {}
@@ -36,12 +36,12 @@ class Facter::Util::Resolution
36
36
  # Try to guess whether the specified code can be executed by looking at the
37
37
  # first word. If it cannot be found on the PATH defer on resolving the fact
38
38
  # by returning nil.
39
- # This only fails on shell built-ins, most of which are masked by stuff in
39
+ # This only fails on shell built-ins, most of which are masked by stuff in
40
40
  # /bin or of dubious value anyways. In the worst case, "sh -c 'builtin'" can
41
41
  # be used to work around this limitation
42
42
  #
43
- # Windows' %x{} throws Errno::ENOENT when the command is not found, so we
44
- # can skip the check there. This is good, since builtins cannot be found
43
+ # Windows' %x{} throws Errno::ENOENT when the command is not found, so we
44
+ # can skip the check there. This is good, since builtins cannot be found
45
45
  # elsewhere.
46
46
  if have_which and !Facter::Util::Config.is_windows?
47
47
  path = nil
@@ -8,7 +8,7 @@ module Facter
8
8
  value = value.to_s if value.is_a?(Symbol)
9
9
  value = value.downcase if value.is_a?(String)
10
10
  value
11
- end
11
+ end
12
12
  end
13
13
  end
14
14
  end