facter 1.6.0 → 1.6.1

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 (63) hide show
  1. data/CHANGELOG +53 -0
  2. data/CONTRIBUTING.md +299 -0
  3. data/Rakefile +3 -3
  4. data/conf/redhat/facter.spec +1 -1
  5. data/install.rb +25 -10
  6. data/lib/facter.rb +16 -1
  7. data/lib/facter/arp.rb +1 -1
  8. data/lib/facter/augeasversion.rb +29 -0
  9. data/lib/facter/domain.rb +9 -10
  10. data/lib/facter/hardwareisa.rb +2 -2
  11. data/lib/facter/hostname.rb +4 -9
  12. data/lib/facter/ipaddress6.rb +9 -0
  13. data/lib/facter/kernel.rb +3 -3
  14. data/lib/facter/kernelrelease.rb +2 -4
  15. data/lib/facter/lsbmajdistrelease.rb +1 -1
  16. data/lib/facter/macaddress.rb +11 -31
  17. data/lib/facter/manufacturer.rb +5 -0
  18. data/lib/facter/memory.rb +32 -4
  19. data/lib/facter/operatingsystem.rb +6 -0
  20. data/lib/facter/operatingsystemrelease.rb +11 -2
  21. data/lib/facter/physicalprocessorcount.rb +8 -0
  22. data/lib/facter/processor.rb +38 -0
  23. data/lib/facter/ps.rb +5 -0
  24. data/lib/facter/selinux.rb +63 -48
  25. data/lib/facter/uniqueid.rb +2 -2
  26. data/lib/facter/util/config.rb +9 -0
  27. data/lib/facter/util/ip.rb +26 -3
  28. data/lib/facter/util/loader.rb +11 -0
  29. data/lib/facter/util/macaddress.rb +20 -0
  30. data/lib/facter/util/manufacturer.rb +10 -5
  31. data/lib/facter/util/resolution.rb +18 -9
  32. data/lib/facter/util/uptime.rb +6 -5
  33. data/lib/facter/util/wmi.rb +16 -0
  34. data/lib/facter/virtual.rb +15 -8
  35. data/spec/fixtures/netsh/windows_netsh_addresses_with_multiple_interfaces +35 -0
  36. data/spec/fixtures/unit/util/loader/nosuchfact.rb +1 -0
  37. data/spec/spec_helper.rb +1 -0
  38. data/spec/unit/data/windows_netsh_all_interfaces +12 -0
  39. data/spec/unit/data/windows_netsh_single_interface +7 -0
  40. data/spec/unit/data/windows_netsh_single_interface6 +18 -0
  41. data/spec/unit/domain_spec.rb +91 -0
  42. data/spec/unit/facter_spec.rb +21 -0
  43. data/spec/unit/hostname_spec.rb +38 -0
  44. data/spec/unit/id_spec.rb +6 -5
  45. data/spec/unit/interfaces_spec.rb +7 -0
  46. data/spec/unit/ipaddress6_spec.rb +19 -0
  47. data/spec/unit/macaddress_spec.rb +38 -0
  48. data/spec/unit/memory_spec.rb +26 -0
  49. data/spec/unit/operatingsystem_spec.rb +28 -0
  50. data/spec/unit/operatingsystemrelease_spec.rb +19 -8
  51. data/spec/unit/physicalprocessorcount_spec.rb +11 -0
  52. data/spec/unit/processor_spec.rb +66 -0
  53. data/spec/unit/selinux_spec.rb +1 -0
  54. data/spec/unit/util/ip_spec.rb +83 -21
  55. data/spec/unit/util/loader_spec.rb +8 -0
  56. data/spec/unit/util/macaddress_spec.rb +28 -1
  57. data/spec/unit/util/manufacturer_spec.rb +21 -0
  58. data/spec/unit/util/resolution_spec.rb +26 -14
  59. data/spec/unit/util/uptime_spec.rb +7 -1
  60. data/spec/unit/util/wmi_spec.rb +20 -0
  61. data/spec/unit/virtual_spec.rb +41 -5
  62. metadata +19 -8
  63. data/spec/spec.opts +0 -5
data/CHANGELOG CHANGED
@@ -1,3 +1,56 @@
1
+ 1.6.1
2
+ ===
3
+ 1f009e0 Updated CHANGELOG for 1.6.1rc4
4
+ 3117e82 (#9517) Fix physicalprocessorcount on windows
5
+ ef0a9aa Updated CHANGELOG for 1.6.1rc3
6
+ 4d93745 (#8491) Prevent repeated loading of fact files
7
+ 6db71d4 (#9457) Fix logic for domain fact so hostname, then dnsdomainname and finally resolv.conf is used.
8
+ 18cd964 Updated CHANGELOG for 1.6.1rc2
9
+ 7edef60 Change count to length for compatibility
10
+ 88f343c (#2344) VMware version parsing fix
11
+ 7457fe5 SELinux spec test fix for ubuntu
12
+ 8bed5bb Clear messages between test runs
13
+ f4ad6bf Macaddress spec test needed operatingsystem fact
14
+ 6c098cc Rakefile should fail on error
15
+ 42c5471 Updated CHANGELOG for 1.6.1rc1.
16
+ 6d47012 (#4869) Implement productname as Darwin hw.model
17
+ d28d96c (#4508) Xen HVM domU not detected as virtual
18
+ d55983e (#9178) Add Oracle Linux identification
19
+ 1cb9cb6 (#6610) Fix Autotest proper run
20
+ ec04277 (#4228) Ensure MAC address octets have leading zeroes.
21
+ 241cddc (#6610) Fix rSpec output format
22
+ 3eb3628 Add Scientific Linux CERN detection to facter. Fixes #9260
23
+ 0bf827f (maint) Add kernel stubbing for is_virtual fact spec
24
+ f810170 (#7957) is_virtual should be false for openvz host nodes
25
+ 1414e0b (#9059) is_virtual should be false on vmware_server
26
+ 7fb0e6a (#8439) Add interface-specific ip facts for Windows
27
+ 5d5848c (#8439) Add ipaddress6 fact on Windows
28
+ 7531a2b (#8439) Add ps fact on Windows
29
+ ddb67c5 (#8439) Move macaddress resolution on Windows
30
+ 0721f2f (#7682) Add complete support for Scientific Linux
31
+ a347920 (#9183) Add support for Alpine linux detection
32
+ 824fac0 (#8439) Add physicalprocessorcount and processor facts on Windows
33
+ 9ef56d6 (#8439) Implement total and free physical memory on Windows
34
+ b3e2274 (#8439) Add Facter::Util::WMI module
35
+ 00bed7a (#8964) Search mountinfo for selinux mount point
36
+ cceb74b (maint) Add stubbing and corrections for domain spec
37
+ f7daae3 (maint) Remove global var from domain and hostname
38
+ e8d00ec (#8964) Search mountinfo for selinux mount point
39
+ 46cbd68 Fix the SPEC file (COPYING no longer shipped, README -> README.md)
40
+ c5d63d4 Fix #2766 - silence unknown sysctl values
41
+ 2ba8e7b Add document outlining preferred contribution methods
42
+ 5d9cc84 (#8660) Fix destdir option on Windows
43
+ e329450 (#8247) Fixing arp DNS timeout issue.
44
+ bdd9e39 Maint: Fix tests to run on Windows
45
+ c1b631d Maint: Refactor detection of windows platform
46
+ 9b7a41d Maint: Deprecate facter resolution interpreter parameter
47
+ 0356a2a Maint: Fix facter install on Windows
48
+ 15d0406 use each_line instead of each for strings in ruby 1.9
49
+ 08b3f77 (#7854) Add Augeas library version fact
50
+ e84c051 Fixed #7307 - Added serial number fact to Solaris
51
+ 6fb6ee5 (#4869) Implement productname as Darwin hw.model
52
+ 63c8b11 (#4508) Xen HVM domU not detected as virtual
53
+
1
54
  1.6.0
2
55
  ===
3
56
  9404a7a (#7670) Add an acceptance test
@@ -0,0 +1,299 @@
1
+ Checklist (and a short version for the impatient)
2
+ =================================================
3
+
4
+ * Commits:
5
+
6
+ - Make commits of logical units.
7
+
8
+ - Check for unnecessary whitespace with "git diff --check" before
9
+ committing.
10
+
11
+ - Commit using Unix line endings (check the settings around "crlf" in
12
+ git-config(1)).
13
+
14
+ - Do not check in commented out code or unneeded files.
15
+
16
+ - The first line of the commit message should be a short
17
+ description (50 characters is the soft limit, excluding ticket
18
+ number(s)), and should skip the full stop.
19
+
20
+ - If there is an associated Redmine ticket then the first line
21
+ should include the ticket number in the form "(#XXXX) Rest of
22
+ message".
23
+
24
+ - The body should provide a meaningful commit message, which:
25
+
26
+ - uses the imperative, present tense: "change", not "changed" or
27
+ "changes".
28
+
29
+ - includes motivation for the change, and contrasts its
30
+ implementation with the previous behavior.
31
+
32
+ - Make sure that you have tests for the bug you are fixing, or
33
+ feature you are adding.
34
+
35
+ - Make sure the test suite passes after your commit (rake spec unit).
36
+
37
+ * Submission:
38
+
39
+ * Pre-requisites:
40
+
41
+ - Make sure you have a [Redmine account](http://projects.puppetlabs.com)
42
+
43
+ - Sign the [Contributor License Agreement](https://projects.puppetlabs.com/contributor_licenses/sign)
44
+
45
+ * Preferred method:
46
+
47
+ - Fork the repository on GitHub.
48
+
49
+ - Push your changes to a topic branch in your fork of the
50
+ repository.
51
+
52
+ - Submit a pull request to the repository in the puppetlabs
53
+ organization.
54
+
55
+ * Alternate methods:
56
+
57
+ - Mail patches to puppet-dev mailing list using `rake mail_patches`,
58
+ or `git-format-patch(1)` & `git-send-email(1)`.
59
+
60
+ - Attach patches to Redmine ticket.
61
+
62
+ The long version
63
+ ================
64
+
65
+ 0. Decide what to base your work on.
66
+
67
+ In general, you should always base your work on the oldest
68
+ branch that your change is relevant to.
69
+
70
+ - A bug fix should be based on the current stable series. If the
71
+ bug is not present in the current stable release, then base it on
72
+ `master`.
73
+
74
+ - A new feature should be based on `master`.
75
+
76
+ - Security fixes should be based on the current maintenance series
77
+ (that is, the previous stable series). If the security issue
78
+ was not present in the maintenance series, then it should be
79
+ based on the current stable series if it was introduced there,
80
+ or on `master` if it is not yet present in a stable release.
81
+
82
+ The current stable series is 2.7.x, and the current maintenance
83
+ series is 2.6.x.
84
+
85
+ 1. Make separate commits for logically separate changes.
86
+
87
+ Please break your commits down into logically consistent units
88
+ which include new or changed tests relevent to the rest of the
89
+ change. The goal of doing this is to make the diff easier to
90
+ read for whoever is reviewing your code. In general, the easier
91
+ your diff is to read, the more likely someone will be happy to
92
+ review it and get it into the code base.
93
+
94
+ If you're going to refactor a piece of code, please do so as a
95
+ separate commit from your feature or bug fix changes.
96
+
97
+ We also really appreciate changes that include tests to make
98
+ sure the bug isn't re-introduced, and that the feature isn't
99
+ accidentally broken.
100
+
101
+ Describe the technical detail of the change(s). If your
102
+ description starts to get too long, that's a good sign that you
103
+ probably need to split up your commit into more finely grained
104
+ pieces.
105
+
106
+ Commits which plainly describe the the things which help
107
+ reviewers check the patch and future developers understand the
108
+ code are much more likely to be merged in with a minimum of
109
+ bike-shedding or requested changes. Ideally, the commit message
110
+ would include information, and be in a form suitable for
111
+ inclusion in the release notes for the version of Puppet that
112
+ includes them.
113
+
114
+ Please also check that you are not introducing any trailing
115
+ whitespaces or other "whitespace errors". You can do this by
116
+ running "git diff --check" on your changes before you commit.
117
+
118
+ 2. Sign the Contributor License Agreement
119
+
120
+ Before we can accept your changes, we do need a signed Puppet
121
+ Labs Contributor License Agreement (CLA).
122
+
123
+ You can access the CLA via the
124
+ [Contributor License Agreement link](https://projects.puppetlabs.com/contributor_licenses/sign)
125
+ in the top menu bar of our Redmine instance. Once you've signed
126
+ the CLA, a badge will show up next to your name on the
127
+ [Puppet Project Overview Page](http://projects.puppetlabs.com/projects/puppet?jump=welcome),
128
+ and your name will be listed under "Contributor License Signers"
129
+ section.
130
+
131
+ If you have any questions about the CLA, please feel free to
132
+ contact Puppet Labs via email at cla-submissions@puppetlabs.com.
133
+
134
+ 3. Sending your patches
135
+
136
+ We accept multiple ways of submitting your changes for
137
+ inclusion. They are listed below in order of preference.
138
+
139
+ Please keep in mind that any method that involves sending email
140
+ to the mailing list directly requires you to be subscribed to
141
+ the mailing list, and that your first post to the list will be
142
+ held in a moderation queue.
143
+
144
+ * GitHub Pull Requests
145
+
146
+ To submit your changes via a GitHub pull request, we _highly_
147
+ recommend that you have them on a topic branch, instead of
148
+ directly on "master" or one of the release, or RC branches.
149
+ It makes things much easier to keep track of, especially if
150
+ you decide to work on another thing before your first change
151
+ is merged in.
152
+
153
+ GitHub has some pretty good
154
+ [general documentation](http://help.github.com/) on using
155
+ their site. They also have documentation on
156
+ [creating pull requests](http://help.github.com/send-pull-requests/).
157
+
158
+ In general, after pushing your topic branch up to your
159
+ repository on GitHub, you'll switch to the branch in the
160
+ GitHub UI and click "Pull Request" towards the top of the page
161
+ in order to open a pull request.
162
+
163
+ You'll want to make sure that you have the appropriate
164
+ destination branch in the repository under the puppetlabs
165
+ organization. This should be the same branch that you based
166
+ your changes off of.
167
+
168
+ * Other pull requests
169
+
170
+ If you already have a publicly accessible version of the
171
+ repository hosted elsewhere, and don't wish to or cannot use
172
+ GitHub, you can submit your change by requesting that we pull
173
+ the changes from your repository by sending an email to the
174
+ puppet-dev Google Groups mailing list.
175
+
176
+ `git-request-pull(1)` provides a handy way to generate the text
177
+ for the email requesting that we pull your changes (and does
178
+ some helpful sanity checks in the process).
179
+
180
+ * Mailing patches to the mailing list
181
+
182
+ If neither of the previous methods works for you, then you can
183
+ also mail the patches inline to the puppet-dev Google Group
184
+ using either `rake mail_patches`, or by using
185
+ `git-format-patch(1)`, and `git-send-email(1)` directly.
186
+
187
+ `rake mail_patches` handles setting the appropriate flags to
188
+ `git-format-patch(1)` and `git-send-email(1)` for you, but
189
+ doesn't allow adding any commentary between the '---', and the
190
+ diffstat in the resulting email. It also requires that you
191
+ have created your topic branch in the form
192
+ `<type>/<parent>/<name>`.
193
+
194
+ If you decide to use `git-format-patch(1)` and
195
+ `git-send-email(1)` directly, please be sure to use the
196
+ following flags for `git-format-patch(1)`: -C -M -s -n
197
+ --subject-prefix='PATCH/puppet'
198
+
199
+ * Attaching patches to Redmine
200
+
201
+ As a method of last resort you can also directly attach the
202
+ output of `git-format-patch(1)`, or `git-diff(1)` to a Redmine
203
+ ticket.
204
+
205
+ If you are generating the diff outside of Git, please be sure
206
+ to generate a unified diff.
207
+
208
+ 4. Update the related Redmine ticket.
209
+
210
+ If there's a Redmine ticket associated with the change you
211
+ submitted, then you should update the ticket to include the
212
+ location of your branch, and change the status to "In Topic
213
+ Branch Pending Merge", along with any other commentary you may
214
+ wish to make.
215
+
216
+ How to track the status of your change after it's been submitted
217
+ ================================================================
218
+
219
+ Shortly after opening a pull request on GitHub, there should be an
220
+ automatic message sent to the puppet-dev Google Groups mailing list
221
+ notifying people of this. This notification is used to let the Puppet
222
+ development community know about your requested change to give them a
223
+ chance to review, test, and comment on the change(s).
224
+
225
+ If you submitted your change via manually sending a pull request or
226
+ mailing the patches, then we keep track of these using
227
+ [patchwork](https://patchwork.puppetlabs.com). When code is merged
228
+ into the project it is automatically removed from patchwork, and the
229
+ Redmine ticket is manually updated with the commit SHA1. In addition,
230
+ the ticket status must be updated by the person who merges the topic
231
+ branch to a status of "Merged - Pending Release"
232
+
233
+ We do our best to comment on or merge submitted changes within a week.
234
+ However, if there hasn't been any commentary on the pull request or
235
+ mailed patches, and it hasn't been merged in after a week, then feel
236
+ free to ask for an update by replying on the mailing list to the
237
+ automatic notification or mailed patches. It probably wasn't
238
+ intentional, and probably just slipped through the cracks.
239
+
240
+ Additional Resources
241
+ ====================
242
+
243
+ * [Getting additional help](http://projects.puppetlabs.com/projects/puppet/wiki/Getting_Help)
244
+
245
+ * [Writing tests](http://projects.puppetlabs.com/projects/puppet/wiki/Development_Writing_Tests)
246
+
247
+ * [Bug tracker (Redmine)](http://projects.puppetlabs.com)
248
+
249
+ * [Patchwork](https://patchwork.puppetlabs.com)
250
+
251
+ * [Contributor License Agreement](https://projects.puppetlabs.com/contributor_licenses/sign)
252
+
253
+ * [General GitHub documentation](http://help.github.com/)
254
+
255
+ * [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
256
+
257
+ If you have commit access to the repository
258
+ ===========================================
259
+
260
+ Even if you have commit access to the repository, you'll still need to
261
+ go through the process above, and have someone else review and merge
262
+ in your changes. The rule is that all changes must be reviewed by a
263
+ developer on the project (that didn't write the code) to ensure that
264
+ all changes go through a code review process.
265
+
266
+ Having someone other than the author of the topic branch recorded as
267
+ performing the merge is the record that they performed the code
268
+ review.
269
+
270
+ * Merging topic branches
271
+
272
+ When merging code from a topic branch into the integration branch
273
+ (Ex: master, 2.7.x, 1.6.x, etc.), there should always be a merge
274
+ commit. You can accomplish this by always providing the `--no-ff`
275
+ flag to `git merge`.
276
+
277
+ git merge --no-ff --log tickets/master/1234-fix-something-broken
278
+
279
+ The reason for always forcing this merge commit is that it
280
+ provides a consistent way to look up what changes & commits were
281
+ in a topic branch, whether that topic branch had one, or 500
282
+ commits. For example, if the merge commit had an abbreviated
283
+ SHA-1 of `coffeebad`, then you could use the following `git log`
284
+ invocation to show you which commits it brought in:
285
+
286
+ git log coffeebad^1..coffeebad^2
287
+
288
+ The following would show you which changes were made on the topic
289
+ branch:
290
+
291
+ git diff coffeebad^1...coffeebad^2
292
+
293
+ Because we _always_ merge the topic branch into the integration
294
+ branch the first parent (`^1`) of a merge commit will be the most
295
+ recent commit on the integration branch from just before we merged
296
+ in the topic, and the second parent (`^2`) will always be the most
297
+ recent commit that was made in the topic branch. This also serves
298
+ as the record of who performed the code review, as mentioned
299
+ above.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  rescue LoadError
12
12
  end
13
13
 
14
- Dir['tasks/**/*.rake'].each { |t| load t }
14
+ Dir['tasks/**/*.rake'].each { |t| load t }
15
15
 
16
16
  require 'rake'
17
17
  require 'rake/packagetask'
@@ -64,12 +64,12 @@ end
64
64
 
65
65
  RSpec::Core::RakeTask.new do |t|
66
66
  t.pattern ='spec/{unit,integration}/**/*_spec.rb'
67
- t.fail_on_error = false
67
+ t.fail_on_error = true
68
68
  end
69
69
 
70
70
  RSpec::Core::RakeTask.new('spec:rcov') do |t|
71
71
  t.pattern ='spec/{unit,integration}/**/*_spec.rb'
72
- t.fail_on_error = false
72
+ t.fail_on_error = true
73
73
  if defined?(Rcov)
74
74
  t.rcov = true
75
75
  t.rcov_opts = ['--exclude', 'spec/*,test/*,results/*,/usr/lib/*,/usr/local/lib/*,gems/*']
@@ -48,7 +48,7 @@ rm -rf %{buildroot}
48
48
  %{_bindir}/facter
49
49
  %{ruby_sitelibdir}/facter.rb
50
50
  %{ruby_sitelibdir}/facter
51
- %doc CHANGELOG COPYING INSTALL LICENSE README
51
+ %doc CHANGELOG INSTALL LICENSE README.md
52
52
 
53
53
 
54
54
  %changelog
data/install.rb CHANGED
@@ -58,6 +58,10 @@ rescue
58
58
  $haveman = false
59
59
  end
60
60
 
61
+ $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
62
+ require 'facter'
63
+ @operatingsystem = Facter[:operatingsystem].value
64
+
61
65
  PREREQS = %w{openssl xmlrpc/client xmlrpc/server cgi}
62
66
 
63
67
  InstallOptions = OpenStruct.new
@@ -126,7 +130,7 @@ def check_prereqs
126
130
  end
127
131
 
128
132
  def is_windows?
129
- RUBY_PLATFORM.to_s.match(/mswin|win32|dos|cygwin|mingw/)
133
+ @operatingsystem == 'windows'
130
134
  end
131
135
 
132
136
  ##
@@ -256,10 +260,11 @@ def prepare_installation
256
260
 
257
261
  # To be deprecated once people move over to using --destdir option
258
262
  if (destdir = ENV['DESTDIR'])
259
- bindir = "#{destdir}#{bindir}"
260
- sbindir = "#{destdir}#{sbindir}"
261
- mandir = "#{destdir}#{mandir}"
262
- sitelibdir = "#{destdir}#{sitelibdir}"
263
+ warn "DESTDIR is deprecated. Use --destdir instead."
264
+ bindir = join(destdir, bindir)
265
+ sbindir = join(destdir, sbindir)
266
+ mandir = join(destdir, mandir)
267
+ sitelibdir = join(destdir, sitelibdir)
263
268
 
264
269
  FileUtils.makedirs(bindir)
265
270
  FileUtils.makedirs(sbindir)
@@ -267,10 +272,10 @@ def prepare_installation
267
272
  FileUtils.makedirs(sitelibdir)
268
273
  # This is the new way forward
269
274
  elsif (destdir = InstallOptions.destdir)
270
- bindir = "#{destdir}#{bindir}"
271
- sbindir = "#{destdir}#{sbindir}"
272
- mandir = "#{destdir}#{mandir}"
273
- sitelibdir = "#{destdir}#{sitelibdir}"
275
+ bindir = join(destdir, bindir)
276
+ sbindir = join(destdir, sbindir)
277
+ mandir = join(destdir, mandir)
278
+ sitelibdir = join(destdir, sitelibdir)
274
279
 
275
280
  FileUtils.makedirs(bindir)
276
281
  FileUtils.makedirs(sbindir)
@@ -288,6 +293,16 @@ def prepare_installation
288
293
  InstallOptions.man_dir = mandir
289
294
  end
290
295
 
296
+ ##
297
+ # Join two paths. On Windows, dir must be converted to a relative path,
298
+ # by stripping the drive letter, but only if the basedir is not empty.
299
+ #
300
+ def join(basedir, dir)
301
+ return "#{basedir}#{dir[2..-1]}" if is_windows? and basedir.length > 0 and dir.length > 2
302
+
303
+ "#{basedir}#{dir}"
304
+ end
305
+
291
306
  ##
292
307
  # Build the rdoc documentation. Also, try to build the RI documentation.
293
308
  #
@@ -387,7 +402,7 @@ def install_binfile(from, op_file, target)
387
402
  end
388
403
  end
389
404
 
390
- if Config::CONFIG["target_os"] =~ /win/io and Config::CONFIG["target_os"] !~ /darwin/io
405
+ if is_windows?
391
406
  installed_wrapper = false
392
407
 
393
408
  if File.exists?("#{from}.bat")