facter 1.6.1 → 1.6.2
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 +31 -0
- data/Rakefile +41 -36
- data/conf/redhat/facter.spec +11 -4
- data/conf/solaris/pkginfo +1 -1
- data/install.rb +286 -286
- data/lib/facter.rb +211 -211
- data/lib/facter/Cfkey.rb +24 -24
- data/lib/facter/application.rb +1 -0
- data/lib/facter/architecture.rb +21 -29
- data/lib/facter/domain.rb +34 -34
- data/lib/facter/facterversion.rb +1 -1
- data/lib/facter/fqdn.rb +8 -8
- data/lib/facter/hardwareisa.rb +2 -2
- data/lib/facter/hardwaremodel.rb +12 -12
- data/lib/facter/hostname.rb +14 -14
- data/lib/facter/id.rb +3 -3
- data/lib/facter/interfaces.rb +13 -13
- data/lib/facter/ipaddress.rb +101 -101
- data/lib/facter/iphostnumber.rb +12 -12
- data/lib/facter/kernel.rb +7 -7
- data/lib/facter/kernelmajversion.rb +3 -3
- data/lib/facter/kernelrelease.rb +12 -12
- data/lib/facter/kernelversion.rb +5 -5
- data/lib/facter/lsb.rb +14 -14
- data/lib/facter/lsbmajdistrelease.rb +8 -8
- data/lib/facter/macaddress.rb +44 -44
- data/lib/facter/macosx.rb +21 -21
- data/lib/facter/manufacturer.rb +28 -28
- data/lib/facter/memory.rb +143 -115
- data/lib/facter/netmask.rb +4 -4
- data/lib/facter/network.rb +4 -4
- data/lib/facter/operatingsystem.rb +73 -69
- data/lib/facter/operatingsystemrelease.rb +85 -79
- data/lib/facter/osfamily.rb +31 -0
- data/lib/facter/path.rb +3 -3
- data/lib/facter/physicalprocessorcount.rb +8 -0
- data/lib/facter/processor.rb +91 -72
- data/lib/facter/ps.rb +3 -3
- data/lib/facter/puppetversion.rb +7 -7
- data/lib/facter/rubysitedir.rb +5 -5
- data/lib/facter/rubyversion.rb +1 -1
- data/lib/facter/ssh.rb +16 -16
- data/lib/facter/timezone.rb +3 -3
- data/lib/facter/uniqueid.rb +2 -2
- data/lib/facter/util/collection.rb +96 -96
- data/lib/facter/util/confine.rb +30 -30
- data/lib/facter/util/fact.rb +95 -95
- data/lib/facter/util/ip.rb +173 -173
- data/lib/facter/util/loader.rb +88 -88
- data/lib/facter/util/macosx.rb +46 -46
- data/lib/facter/util/manufacturer.rb +78 -78
- data/lib/facter/util/memory.rb +63 -63
- data/lib/facter/util/netmask.rb +34 -34
- data/lib/facter/util/plist.rb +1 -1
- data/lib/facter/util/plist/generator.rb +177 -177
- data/lib/facter/util/plist/parser.rb +166 -166
- data/lib/facter/util/processor.rb +88 -0
- data/lib/facter/util/resolution.rb +154 -154
- data/lib/facter/util/uptime.rb +42 -42
- data/lib/facter/util/values.rb +9 -9
- data/lib/facter/util/virtual.rb +68 -58
- data/lib/facter/util/vlans.rb +17 -17
- data/lib/facter/virtual.rb +105 -110
- data/lib/facter/vlans.rb +6 -6
- data/spec/fixtures/cpuinfo/amd64dual +57 -0
- data/spec/fixtures/cpuinfo/amd64quad +79 -0
- data/spec/fixtures/cpuinfo/amd64solo +23 -0
- data/spec/fixtures/cpuinfo/amd64tri +86 -0
- data/spec/fixtures/cpuinfo/bbg3-armel +12 -0
- data/spec/fixtures/cpuinfo/beaglexm-armel +12 -0
- data/spec/fixtures/cpuinfo/panda-armel +17 -0
- data/spec/fixtures/cpuinfo/ppc64 +19 -0
- data/spec/fixtures/cpuinfo/sparc +10 -0
- data/spec/fixtures/processorcount/solaris-sparc-kstat-cpu-info +1216 -0
- data/spec/fixtures/processorcount/solaris-x86_64-kstat-cpu-info +225 -0
- data/spec/integration/facter_spec.rb +18 -18
- data/spec/spec_helper.rb +10 -1
- data/spec/unit/architecture_spec.rb +54 -0
- data/spec/unit/domain_spec.rb +23 -0
- data/spec/unit/memory_spec.rb +78 -1
- data/spec/unit/physicalprocessorcount_spec.rb +41 -35
- data/spec/unit/processor_spec.rb +183 -2
- data/spec/unit/util/processor_spec.rb +62 -0
- data/spec/unit/util/uptime_spec.rb +4 -4
- data/spec/unit/util/virtual_spec.rb +26 -5
- data/spec/unit/virtual_spec.rb +47 -2
- data/spec/watchr.rb +125 -0
- metadata +20 -4
data/spec/watchr.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
ENV["WATCHR"] = "1"
|
2
|
+
ENV['AUTOTEST'] = 'true'
|
3
|
+
|
4
|
+
def run_comp(cmd)
|
5
|
+
puts cmd
|
6
|
+
results = []
|
7
|
+
old_sync = $stdout.sync
|
8
|
+
$stdout.sync = true
|
9
|
+
line = []
|
10
|
+
begin
|
11
|
+
open("| #{cmd}", "r") do |f|
|
12
|
+
until f.eof? do
|
13
|
+
c = f.getc
|
14
|
+
putc c
|
15
|
+
line << c
|
16
|
+
if c == ?\n
|
17
|
+
results << if RUBY_VERSION >= "1.9" then
|
18
|
+
line.join
|
19
|
+
else
|
20
|
+
line.pack "c*"
|
21
|
+
end
|
22
|
+
line.clear
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
ensure
|
27
|
+
$stdout.sync = old_sync
|
28
|
+
end
|
29
|
+
results.join
|
30
|
+
end
|
31
|
+
|
32
|
+
def clear
|
33
|
+
#system("clear")
|
34
|
+
end
|
35
|
+
|
36
|
+
def growl(message, status)
|
37
|
+
# Strip the color codes
|
38
|
+
message.gsub!(/\[\d+m/, '')
|
39
|
+
|
40
|
+
growlnotify = `which growlnotify`.chomp
|
41
|
+
return if growlnotify.empty?
|
42
|
+
title = "Watchr Test Results"
|
43
|
+
image = status == :pass ? "autotest/images/pass.png" : "autotest/images/fail.png"
|
44
|
+
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
|
45
|
+
system %(#{growlnotify} #{options} &)
|
46
|
+
end
|
47
|
+
|
48
|
+
def file2specs(file)
|
49
|
+
%w{spec/unit spec/integration}.collect { |d|
|
50
|
+
file.sub('lib/facter', d).sub('.rb', '_spec.rb')
|
51
|
+
}.find_all { |f|
|
52
|
+
FileTest.exist?(f)
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def run_spec(command)
|
57
|
+
clear
|
58
|
+
result = run_comp(command).split("\n").last
|
59
|
+
status = result.include?('0 failures') ? :pass : :fail
|
60
|
+
growl result, status
|
61
|
+
end
|
62
|
+
|
63
|
+
def run_spec_files(files)
|
64
|
+
files = Array(files)
|
65
|
+
return if files.empty?
|
66
|
+
opts = File.readlines('.rspec').collect { |l| l.chomp }.join(" ")
|
67
|
+
begin
|
68
|
+
run_spec("rspec --tty #{opts} #{files.join(' ')}")
|
69
|
+
rescue => detail
|
70
|
+
puts detail.backtrace
|
71
|
+
warn "Failed to run #{files.join(', ')}: #{detail}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def run_suite
|
76
|
+
files = files("unit") + files("integration")
|
77
|
+
opts = File.readlines('.rspec').collect { |l| l.chomp }.join(" ")
|
78
|
+
run_spec("rspec --tty #{opts} #{files.join(' ')}")
|
79
|
+
end
|
80
|
+
|
81
|
+
def files(dir)
|
82
|
+
require 'find'
|
83
|
+
|
84
|
+
result = []
|
85
|
+
Find.find(File.join("spec", dir)) do |path|
|
86
|
+
result << path if path =~ /\.rb/
|
87
|
+
end
|
88
|
+
|
89
|
+
result
|
90
|
+
end
|
91
|
+
|
92
|
+
watch('spec/spec_helper.rb') { run_suite }
|
93
|
+
watch(%r{^spec/(unit|integration)/.*\.rb$}) { |md| run_spec_files(md[0]) }
|
94
|
+
watch(%r{^lib/facter/(.*)\.rb$}) { |md|
|
95
|
+
run_spec_files(file2specs(md[0]))
|
96
|
+
}
|
97
|
+
watch(%r{^spec/lib/spec.*}) { |md| run_suite }
|
98
|
+
watch(%r{^spec/lib/monkey_patches/.*}) { |md| run_suite }
|
99
|
+
|
100
|
+
# Ctrl-\
|
101
|
+
Signal.trap 'QUIT' do
|
102
|
+
puts " --- Running all tests ---\n\n"
|
103
|
+
run_suite
|
104
|
+
end
|
105
|
+
|
106
|
+
@interrupted = false
|
107
|
+
|
108
|
+
# Ctrl-C
|
109
|
+
Signal.trap 'INT' do
|
110
|
+
if @interrupted
|
111
|
+
@wants_to_quit = true
|
112
|
+
abort("\n")
|
113
|
+
else
|
114
|
+
puts "Interrupt a second time to quit; wait for rerun of tests"
|
115
|
+
@interrupted = true
|
116
|
+
Kernel.sleep 1.5
|
117
|
+
# raise Interrupt, nil # let the run loop catch it
|
118
|
+
begin
|
119
|
+
run_suite
|
120
|
+
rescue => detail
|
121
|
+
puts detail.backtrace
|
122
|
+
puts "Could not run suite: #{detail}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 1.6.
|
9
|
+
- 2
|
10
|
+
version: 1.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Puppet Labs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-10 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description:
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/facter/network.rb
|
67
67
|
- lib/facter/operatingsystem.rb
|
68
68
|
- lib/facter/operatingsystemrelease.rb
|
69
|
+
- lib/facter/osfamily.rb
|
69
70
|
- lib/facter/path.rb
|
70
71
|
- lib/facter/physicalprocessorcount.rb
|
71
72
|
- lib/facter/processor.rb
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- lib/facter/util/plist/generator.rb
|
96
97
|
- lib/facter/util/plist/parser.rb
|
97
98
|
- lib/facter/util/plist.rb
|
99
|
+
- lib/facter/util/processor.rb
|
98
100
|
- lib/facter/util/resolution.rb
|
99
101
|
- lib/facter/util/uptime.rb
|
100
102
|
- lib/facter/util/values.rb
|
@@ -112,6 +114,15 @@ files:
|
|
112
114
|
- conf/redhat/facter.spec
|
113
115
|
- conf/solaris/pkginfo
|
114
116
|
- etc/facter.conf
|
117
|
+
- spec/fixtures/cpuinfo/amd64dual
|
118
|
+
- spec/fixtures/cpuinfo/amd64quad
|
119
|
+
- spec/fixtures/cpuinfo/amd64solo
|
120
|
+
- spec/fixtures/cpuinfo/amd64tri
|
121
|
+
- spec/fixtures/cpuinfo/bbg3-armel
|
122
|
+
- spec/fixtures/cpuinfo/beaglexm-armel
|
123
|
+
- spec/fixtures/cpuinfo/panda-armel
|
124
|
+
- spec/fixtures/cpuinfo/ppc64
|
125
|
+
- spec/fixtures/cpuinfo/sparc
|
115
126
|
- spec/fixtures/ifconfig/bsd_ifconfig_all_with_multiple_interfaces
|
116
127
|
- spec/fixtures/ifconfig/centos_5_5
|
117
128
|
- spec/fixtures/ifconfig/centos_5_5_eth0
|
@@ -147,6 +158,8 @@ files:
|
|
147
158
|
- spec/fixtures/netstat/open_solaris_10
|
148
159
|
- spec/fixtures/netstat/open_solaris_b132
|
149
160
|
- spec/fixtures/netstat/ubuntu_7_04
|
161
|
+
- spec/fixtures/processorcount/solaris-sparc-kstat-cpu-info
|
162
|
+
- spec/fixtures/processorcount/solaris-x86_64-kstat-cpu-info
|
150
163
|
- spec/fixtures/unit/util/loader/nosuchfact.rb
|
151
164
|
- spec/fixtures/uptime/kstat_boot_time
|
152
165
|
- spec/fixtures/uptime/sysctl_kern_boottime_big_endian
|
@@ -159,6 +172,7 @@ files:
|
|
159
172
|
- spec/fixtures/virtual/proc_self_status/vserver_2_3/host
|
160
173
|
- spec/integration/facter_spec.rb
|
161
174
|
- spec/spec_helper.rb
|
175
|
+
- spec/unit/architecture_spec.rb
|
162
176
|
- spec/unit/data/6.0-STABLE_FreeBSD_ifconfig
|
163
177
|
- spec/unit/data/darwin_ifconfig_all_with_multiple_interfaces
|
164
178
|
- spec/unit/data/darwin_ifconfig_single_interface
|
@@ -200,6 +214,7 @@ files:
|
|
200
214
|
- spec/unit/util/macaddress_spec.rb
|
201
215
|
- spec/unit/util/macosx_spec.rb
|
202
216
|
- spec/unit/util/manufacturer_spec.rb
|
217
|
+
- spec/unit/util/processor_spec.rb
|
203
218
|
- spec/unit/util/resolution_spec.rb
|
204
219
|
- spec/unit/util/uptime_spec.rb
|
205
220
|
- spec/unit/util/virtual_spec.rb
|
@@ -207,6 +222,7 @@ files:
|
|
207
222
|
- spec/unit/util/wmi_spec.rb
|
208
223
|
- spec/unit/util/xendomains_spec.rb
|
209
224
|
- spec/unit/virtual_spec.rb
|
225
|
+
- spec/watchr.rb
|
210
226
|
homepage: http://puppetlabs.com
|
211
227
|
licenses: []
|
212
228
|
|