facter 2.4.3 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,14 @@
2
2
  packaging_url: 'git://github.com/puppetlabs/packaging.git --branch=master'
3
3
  packaging_repo: 'packaging'
4
4
  default_cow: 'base-squeeze-i386.cow'
5
- cows: 'base-lucid-i386.cow base-lucid-amd64.cow base-precise-i386.cow base-precise-amd64.cow base-squeeze-i386.cow base-squeeze-amd64.cow base-stable-i386.cow base-stable-amd64.cow base-testing-i386.cow base-testing-amd64.cow base-trusty-i386.cow base-trusty-amd64.cow base-wheezy-i386.cow base-wheezy-amd64.cow'
5
+ cows: 'base-precise-i386.cow base-precise-amd64.cow base-squeeze-i386.cow base-squeeze-amd64.cow base-trusty-i386.cow base-trusty-amd64.cow base-wheezy-i386.cow base-wheezy-amd64.cow'
6
6
  pbuild_conf: '/etc/pbuilderrc'
7
7
  packager: 'puppetlabs'
8
8
  gpg_name: 'info@puppetlabs.com'
9
9
  gpg_key: '4BD6EC30'
10
10
  sign_tar: FALSE
11
11
  # a space separated list of mock configs
12
- final_mocks: 'pl-el-5-i386 pl-el-5-x86_64 pl-el-6-i386 pl-el-6-x86_64 pl-el-7-x86_64 pl-fedora-19-i386 pl-fedora-19-x86_64 pl-fedora-20-i386 pl-fedora-20-x86_64'
12
+ final_mocks: 'pl-el-5-i386 pl-el-5-x86_64 pl-el-6-i386 pl-el-6-x86_64 pl-el-7-x86_64 pl-fedora-20-i386 pl-fedora-20-x86_64'
13
13
  yum_host: 'yum.puppetlabs.com'
14
14
  yum_repo_path: '/opt/repository/yum/'
15
15
  build_gem: TRUE
@@ -160,7 +160,9 @@ OPTIONS
160
160
  "Enable timing.") { |v| Facter.timing(1) }
161
161
  opts.on("-p",
162
162
  "--puppet",
163
- "Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.") { |v| load_puppet }
163
+ "(Deprecated: use `puppet facts` instead) Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.") do |v|
164
+ load_puppet
165
+ end
164
166
 
165
167
  opts.on_tail("-v",
166
168
  "--version",
@@ -24,7 +24,8 @@ Facter.add(:dhcp_servers) do
24
24
  Facter::Core::Execution.which('nmcli')
25
25
  end
26
26
  confine do
27
- Facter::Util::DHCPServers.network_manager_state != 'unknown'
27
+ s = Facter::Util::DHCPServers.network_manager_state
28
+ !s.empty? && (s != 'unknown')
28
29
  end
29
30
 
30
31
  setcode do
@@ -47,15 +47,5 @@ if Facter.value(:kernel) == 'SunOS' &&
47
47
  end
48
48
  end
49
49
  end
50
-
51
- # When ldom domainrole control = false, the system is a guest, so we mark it
52
- # as a virtual system:
53
- Facter.add("virtual") do
54
- confine :ldom_domainrole_control => 'false'
55
- has_weight 10
56
- setcode do
57
- Facter.value(:ldom_domainrole_impl)
58
- end
59
- end
60
50
  end
61
51
  end
@@ -232,7 +232,7 @@ module Processor
232
232
  end
233
233
  end
234
234
 
235
- when "ppc64"
235
+ when "ppc64", "ppc64le"
236
236
  File.readlines(cpuinfo).each do |l|
237
237
  if l =~ /processor\s+:\s+(\d+)/
238
238
  processor_num = $1.to_i
@@ -1,6 +1,6 @@
1
1
  module Facter
2
2
  if not defined? FACTERVERSION then
3
- FACTERVERSION = '2.4.3'
3
+ FACTERVERSION = '2.4.4'
4
4
  end
5
5
 
6
6
  # Returns the running version of Facter.
@@ -89,6 +89,17 @@ Facter.add("virtual") do
89
89
  end
90
90
  end
91
91
 
92
+ Facter.add("virtual") do
93
+ confine :kernel => 'SunOS'
94
+ confine :hardwareisa => 'sparc'
95
+ confine :ldom_domainrole_control => 'false'
96
+ has_weight 20 # Weight this before the default solaris implementation
97
+ setcode do
98
+ Facter.value(:ldom_domainrole_impl)
99
+ end
100
+ end
101
+
102
+
92
103
  Facter.add("virtual") do
93
104
  confine :kernel => 'HP-UX'
94
105
  has_weight 10
@@ -0,0 +1,15 @@
1
+ processor : 0
2
+ cpu : POWER8E (raw), altivec supported
3
+ clock : 3690.000000MHz
4
+ revision : 2.1 (pvr 004b 0201)
5
+
6
+ processor : 1
7
+ cpu : POWER8E (raw), altivec supported
8
+ clock : 3690.000000MHz
9
+ revision : 2.1 (pvr 004b 0201)
10
+
11
+ timebase : 512000000
12
+ platform : PowerNV
13
+ model : 8247-22L
14
+ machine : PowerNV 8247-22L
15
+ firmware : OPAL v3
@@ -54,6 +54,15 @@ describe Facter::Application do
54
54
  end
55
55
  end
56
56
 
57
+ ['-h', '--help'].each do |option|
58
+ it "issues a deprecation message for `--puppet`" do
59
+ Facter::Application.stubs(:exit).with(0)
60
+ expect do
61
+ Facter::Application.parse([option])
62
+ end.to have_printed('Deprecated: use `puppet facts` instead')
63
+ end
64
+ end
65
+
57
66
  it 'mutates argv so that non-option arguments are left' do
58
67
  argv = ['-y', '--trace', 'uptime', 'virtual']
59
68
  Facter::Application.parse(argv)
@@ -175,6 +175,28 @@ describe "DHCP server facts" do
175
175
  Facter.fact(:dhcp_servers).value.should be_nil
176
176
  end
177
177
  end
178
+ describe 'with nmcli version >= 0.9.9 available but printing an error to STDERR' do
179
+ before :each do
180
+ Facter::Core::Execution.stubs(:exec).with('nmcli -t -f STATE g 2>/dev/null').returns("\n")
181
+ Facter::Core::Execution.stubs(:exec).with('nmcli --version').returns('nmcli tool, version 0.9.9.0')
182
+ end
183
+
184
+ it 'should not produce a dhcp_servers fact' do
185
+ Facter.fact(:dhcp_servers).value.should be_nil
186
+ end
187
+ end
188
+
189
+ describe 'with nmcli version <= 0.9.8 available but printing an error to STDERR' do
190
+ before :each do
191
+ Facter::Core::Execution.stubs(:exec).with('nmcli -t -f STATE nm 2>/dev/null').returns("\n")
192
+ Facter::Core::Execution.stubs(:exec).with('nmcli --version').returns('nmcli tool, version 0.9.7.0')
193
+ end
194
+
195
+ it 'should not produce a dhcp_servers fact' do
196
+ Facter.fact(:dhcp_servers).value.should be_nil
197
+ end
198
+ end
199
+
178
200
  end
179
201
 
180
202
  describe "without nmcli available" do
@@ -57,10 +57,6 @@ describe "ldom fact" do
57
57
  it "should return correct serial on version 1.0" do
58
58
  Facter.fact(:ldom_domainchassis).value.should == "0704RB0280"
59
59
  end
60
-
61
- it "should return correct virtual on version 1.0" do
62
- Facter.fact(:virtual).value.should == "LDoms"
63
- end
64
60
  end
65
61
 
66
62
  describe "when running on non ldom hardware" do
@@ -40,6 +40,13 @@ describe Facter::Processors::Linux do
40
40
  expect(count).to eq 2
41
41
  end
42
42
 
43
+ it "should be 2 in ppc64le fixture on Linux" do
44
+ Facter.fact(:architecture).stubs(:value).returns("ppc64le")
45
+ File.expects(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("ppc64le"))
46
+ count = subject.get_processor_count
47
+ expect(count).to eq 2
48
+ end
49
+
43
50
  it "should be 2 in panda-armel fixture on Linux" do
44
51
  Facter.fact(:architecture).stubs(:value).returns("arm")
45
52
  File.expects(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture_readlines("panda-armel"))
@@ -31,6 +31,18 @@ describe "Virtual fact" do
31
31
  Facter.fact(:virtual).value.should == "zone"
32
32
  end
33
33
 
34
+ it "should be LDoms on Solaris when an ldom" do
35
+ ldom_fixture = File.read(fixtures('ldom', 'ldom_v1'))
36
+ Facter.fact(:kernel).stubs(:value).returns("SunOS")
37
+ Facter.fact(:operatingsystem).stubs(:value).returns("Solaris")
38
+ Facter.fact(:hardwareisa).stubs(:value).returns("sparc")
39
+ Facter::Core::Execution.stubs(:which).with("virtinfo").returns 'virtinfo'
40
+ Facter::Core::Execution.stubs(:which).with("vmware").returns nil
41
+ Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").returns(ldom_fixture)
42
+ Facter.collection.internal_loader.load(:ldom)
43
+ Facter.fact(:virtual).value.should == "LDoms"
44
+ end
45
+
34
46
  it "should be jail on FreeBSD when a jail in kvm" do
35
47
  Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
36
48
  Facter::Util::Virtual.stubs(:jail?).returns(true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-02 00:00:00.000000000 Z
12
+ date: 2015-05-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: You can prove anything with facts!
15
15
  email: info@puppetlabs.com
@@ -190,6 +190,7 @@ files:
190
190
  - spec/fixtures/cpuinfo/amd64tri
191
191
  - spec/fixtures/cpuinfo/amd64twentyfour-grep
192
192
  - spec/fixtures/cpuinfo/amd64solo
193
+ - spec/fixtures/cpuinfo/ppc64le
193
194
  - spec/fixtures/cpuinfo/beaglexm-armel
194
195
  - spec/fixtures/cpuinfo/amd64twentyfour
195
196
  - spec/fixtures/cpuinfo/sparc
@@ -537,6 +538,7 @@ test_files:
537
538
  - spec/fixtures/cpuinfo/amd64tri
538
539
  - spec/fixtures/cpuinfo/amd64twentyfour-grep
539
540
  - spec/fixtures/cpuinfo/amd64solo
541
+ - spec/fixtures/cpuinfo/ppc64le
540
542
  - spec/fixtures/cpuinfo/beaglexm-armel
541
543
  - spec/fixtures/cpuinfo/amd64twentyfour
542
544
  - spec/fixtures/cpuinfo/sparc