summaryrefslogtreecommitdiffstats
path: root/lib/facter/util
Commit message (Collapse)AuthorAgeFilesLines
* (#7670) Never fail to find a fact that is presentNick Lewis2011-05-311-1/+5
| | | | | | | | | | | | | | | | | | | | | With the previous behavior, any fact which depended on another fact in a file not matching its name would fail to properly load the required fact, resulting in missing, incorrect, or inconsistent values. For instance, the operatingsystem fact depends on the lsbdistid fact found in lsb.rb. The first time the operatingsystem fact is requested, it requires lsb.rb, and so the required fact is loaded first. But if Facter is subsequently cleared and the operatingsystem fact requested again, the require will not occur, and the fact will not be automatically loaded because it doesn't match its filename. Now if a fact is requested and can't be found, we will attempt to load all the facts to find it. Such an approach appears heavy-handed, but in the case where we want a particular fact, this is the only way to make sure we've found it. In the case where we eventually want other facts, we are conveniently eagerly loading them. Paired-With: Jacob Helwig <jacob@puppetlabs.com>
* Merge branch ↵Max Martin2011-04-281-1/+1
|\ | | | | | | | | | | | | | | 'ticket/next/6728-facter_improperly_detects_openvzve_on_cloudlinux_systems' into next * ticket/next/6728-facter_improperly_detects_openvzve_on_cloudlinux_systems: (#6728) Facter improperly detects openvzve on CloudLinux systems (#6883) Update Facter install.rb to be slightly more informative.
| * (#6728) Facter improperly detects openvzve on CloudLinux systemsBen Hughes2011-04-071-1/+1
| | | | | | | | | | | | | | | | Make the openvz check for more than just the vz directory to be sure it's OpenVZ. Update the OpenVZ fact to be slightly more resilient in it's checking of OpenVZ, so it doesn't clash with CloudLinux's LVE container system.
* | Fixed #6974 - Moved to Apache 2.0 licenseJames Turnbull2011-04-062-22/+0
| | | | | | | | | | | | | | | | | | This is in line with our proposed plan to change from the GPL license to Apache 2.0. Please see this link for further explanation: https://groups.google.com/d/topic/puppet-users/NuspYhMpE5o/discussion
* | refactor the mechanism for allowing for resolution ordering to be influencedRichard Clamp2011-04-063-14/+9
| | | | | | | | | | renames Facter::Util::Resolution#length to weight as a more generic mechanism for allowing resolutions to state their importance
* | (#6740) facter doesn't always respect facts in environment variablesRichard Clamp2011-04-062-1/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | On an OSX host: $ facter operatingsystem Darwin $ facter_operatingsystem=Not_Darwin facter operatingsystem Not_Darwin But on a linux/solaris host: $ facter operatingsystem CentOS $ facter_operatingsystem=Not_CentOS facter operatingsystem CentOS As the operatingsystem fact resolution for linux-based kernels has higher precedence than the environment variable as it has more matching confines than the value from the environment variable. This patch adds from_environment to the resolution mechanism, which makes the resolution have an artificially high weight by claiming the length of its confines array is 1 billion.
* (#6817) Fix for Ruby 1.9 by calling .each_line on a stringMatt Robinson2011-03-221-1/+1
|
* maint: cleanup whitespaceMatt Robinson2011-03-221-1/+0
|
* (#6795) xendomains: Ignore error output from xm listTodd Zullinger2011-03-211-1/+1
| | | | | If xend is not running, xm list writes to stderr and facter propagates this to the user. Redirect stderr to /dev/null.
* Merge branch 'tickets/next/6716-osx-ipv6-macaddress' into nextJacob Helwig2011-03-171-1/+1
|\ | | | | | | | | | | * tickets/next/6716-osx-ipv6-macaddress: Clean up indentation, and alignment in macaddress_spec.rb (#6716) fix facter issues on OSX with ipv6 in macaddress.rb.
| * (#6716) fix facter issues on OSX with ipv6 in macaddress.rb.Ben Hughes2011-03-171-1/+1
| | | | | | | | | | | | Due to "netstat -rn" returning multiple protocols (IPv4 and IPv6) the "default_interface" can get more than one entry in to it, causing the macaddress resolving to break. This limits it to just one interface.
* | Fixed #2346 - Part 1: Added arp fact for LinuxJames Turnbull2011-03-171-0/+7
| | | | | | | | | | Added facts arp (like the ipaddress etc) facts Added facts arp_interfacename
* | (#6327) Memory facts should be available on Mac DarwinBen H2011-03-171-0/+31
| | | | | | | | | | | | | | | | | | | | There's no easy defined way of getting memory information from the command line. Copying mainly the OpenBSD facts, but having to pull in memory free from the vm_stat utility, and parsing the weird vm.swapusage sysctl value for swap. Parsing "top -l 1 -n 0" seemed an option, but that took over a second to run each time, so this appears cheaper.
* | Merge branch 'tickets/master/5699' into nextJames Turnbull2011-03-151-0/+3
|\ \
| * | Fixed #5699 - Added virtual support for s390x/ZlinuxJames Turnbull2011-03-071-0/+3
| |/ | | | | | | Patch modified from Hector Rivas
* / Fix for #6495 - Updated interface detectionJames Turnbull2011-03-091-10/+8
|/ | | | | | | | | | 1. Fixed IP return to not filter lo/localhost and return it as a proper interface 2. Fixed HP-UX netstat return to remove extraneous first line of naming. 3. Updated tests to reflect changes
* Merge branch 'tickets/master/6521'James Turnbull2011-03-071-2/+2
|\
| * Fixes #6521 and other Ruby 1.9 issuesJames Turnbull2011-03-022-4/+4
| | | | | | | | Tested on Ruby 1.9.2p180
* | Merge commit '84fa3c440edefd117ce8a7fa5fb13d76b66ec7db'James Turnbull2011-03-071-2/+2
|\ \
| * | (#6525) change semicolons to 'then' in case statement for ruby 1.9.2 ↵Matt2011-03-051-2/+2
| |/ | | | | | | compatibility
* / (#2270) add IPv6 support to facter core.Daniel Pittman2011-02-171-0/+3
|/ | | | | | | | | | | | | | | | | | Now that IPocalypse has happened, IPv6 support in Facter core would be nice to have. So, we add the appropriate code to start handling that. The ipaddress6 fact as supplied included some smart code to try determining the "primary" address using DNS to resolve the AAAA record for the host FQDN. While this was smart, it actually didn't work: facter prefers the longest confine list, so the *stupid* mechanisms that were kernel-specific would override the smarter and more portable mechanisms. We strip that code out for now, which also brings this into line with the existing ipaddress fact; improving both would be good, but it should be uniform. Paired-With: Matt Robinson <matt@puppetlabs.com> Paired-With: Max Martin <max@puppetlabs.com>
* Fix #4755: add support for GNU/kFreeBSD platform where missing.Marc Fournier2011-01-314-9/+13
| | | | | | | | | Merged manually to the current state of the art. Minimal conflicts resolved by adding both Darwin and GNU/KFreeBSD to the confine lines. Author: Marc Fournier <marc.fournier@camptocamp.com> Signed-off-by: Daniel Pittman <daniel@puppetlabs.com> Signed-off-by: Rick Bradley <rick@rickbradley.com>
* (#5510) Facter should load custom fact definitions in filename order.Rick Bradley2011-01-311-2/+2
| | | | | | | | | | | | | | | | Ruby's Dir.entries will return files in different orders depending on the OS and/or filesystem. As a result Facter::Util::Loader will load ruby custom fact definitions in different orders on different platforms. Specs to expose the bugs, and code to ensure that custom fact files are loaded in alphabetical order. Addresses redmine issue #5510 http://projects.puppetlabs.com/issues/5510 Signed-off-by: Rick Bradley <rick@rickbradley.com> Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* (#5086) Try using kstat before falling back to 'who -b' to determine uptime.Jacob Helwig2011-01-241-1/+11
| | | | | | | | | 'who -b' doesn't report the year of the last system boot on (at least) Solaris 10, and OpenSolaris 2009.06. Try using 'kstat -p unix:::boot_time', which reports as seconds since the epoch on these systems before falling back to 'who -b'. Reviewed-by: Paul Berry <paul@puppetlabs.com>
* (#4575) win32 support for manufacturer, productname, & serialnumberWilliam Van Hevelingen2010-12-211-0/+17
| | | | Signed-off-by: William Van Hevelingen <wvan13@gmail.com>
* (#1423) Memory facts for SolarisDominic Cleal2010-12-061-0/+12
| | | | | Add total memory from prtconf output, free from vmstat plus swap free and total from swap -l listing.
* (#5325) Manufacturer and product name on SPARCDominic Cleal2010-11-221-0/+20
| | | | | Use prtdiag output on Solaris/SPARC to determine manufacturer and productname as smbios is unavailable.
* (#4989) Add xendomains factRein Henrichs2010-11-091-0/+10
| | | | | Parses `/usr/sbin/xm list` and returns a comma-separated list of domains. Based on a patch submitted by Jonas Genannt.
* Merge remote branch 'stschulte/feature/master/5040' into nextPaul Berry2010-11-091-0/+4
|\ | | | | | | | | | | Manually resolved conflicts: lib/facter/virtual.rb spec/unit/virtual.rb
| * (#5040) fact virtual should detect hpvmStefan Schulte2010-11-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With HP-UX you can build virtual machines that are often refered to as HP-VMs. This patch detecs HP-VMs by introducing a new function hpvm? that will check the output of /usr/bin/getconf MACHINE_MODEL. This should not depend on any tools that might be not installed. If inside a HP-VM the command will say something like ia64 hp server Integrity Virtual Machine while on real hardware the output could be ia64 hp server rx660 so searching for "Virtual Machine" should work. Currently it only works if the guest is also running HP-UX. (I guess this is the most common usecase).
* | Merge branch 'ticket/master/4552' into nextRein Henrichs2010-10-051-0/+7
|\ \ | | | | | | | | | | | | | | | Conflicts: bin/facter lib/facter/application.rb
| * | [#4552] Updating --timing to report in milliseconds instead of secondsRein Henrichs2010-10-041-6/+4
| | |
| * | [#4552] Apply patch from Dean WilsonRein Henrichs2010-10-041-0/+9
| | |
| * | Better fix for Bug 4569: Uptime Fact is incorrect on WindowsWilliam Van Hevelingen2010-10-041-3/+6
| | | | | | | | | | | | | | | | | | Patch removes reliance on clock ticks and instead queries for last boot time and subtracts from Time.now Signed-off-by: William Van Hevelingen <wvan13@gmail.com>
| * | Fix for bug #4569William Van Hevelingen2010-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | * getTickCount.call() is not an epoch time value so compute_uptime is not necessary Signed-off-by: William Van Hevelingen <wvan13@gmail.com>
* | | Merge branch 'master' into nextRein Henrichs2010-10-051-3/+3
|\ \ \ | | |/ | |/|
| * | [#4583] Refactor uptime to use Resolution.execRein Henrichs2010-08-241-3/+3
| | | | | | | | | | | | Resolution.exec used to ensure that any shell errors are suppressed.
* | | Merge branch 'master' into nextRein Henrichs2010-08-191-3/+6
|\| |
| * | Better fix for Bug 4569: Uptime Fact is incorrect on WindowsWilliam Van Hevelingen2010-08-191-3/+6
| | | | | | | | | | | | | | | | | | Patch removes reliance on clock ticks and instead queries for last boot time and subtracts from Time.now Signed-off-by: William Van Hevelingen <wvan13@gmail.com>
| * | Fix for bug #4569William Van Hevelingen2010-08-181-1/+1
| |/ | | | | | | | | | | | | * getTickCount.call() is not an epoch time value so compute_uptime is not necessary Signed-off-by: William Van Hevelingen <wvan13@gmail.com>
* | Merge branch 'ticket/master/3703-macaddress-on-mac' into nextRein Henrichs2010-08-181-0/+28
|\ \
| * | [#3703] Fix macaddress fact for DarwinRein Henrichs2010-08-111-0/+28
| |/ | | | | | | * With tests for 9.8.0, 10.3.0 and 10.6.4
* / [#2865] Fix reporting of virtual factsRein Henrichs2010-08-181-1/+1
|/ | | | | | | | | Regexp tested the s_context or VxID field if /proc/self/status and returned false for 0 and true for any other number. 0 indicates a host, which is still virtual. Fix changes regexp to correctly report hosts as virtual. Tested against vserver 2.1 and 2.3.
* [#4156] Applying patch by KaiRein Henrichs2010-08-061-1/+1
| | | | | | | | | | Patch from the ticket[1] checks for /proc/vz instead of /proc/vz/vzinfo. NOTE that this causes a spec failure since the spec was not changed to match. [1] http://projects.reductivelabs.com/issues/4156 Signed-off-by: Rein Henrichs <rein@puppetlabs.com>
* Merge remote branch 'kubicek/ticket/master/4352'Rein Henrichs2010-08-061-4/+8
|\
| * Fix #4352 - Support for detecting KVM virtuals on FreeBSDJiri Kubicek2010-07-261-4/+5
| | | | | | | | | | | | There was no support for detecting FreeBSD running in KVM as a virtual in facter. This patch detects KVM by getting "hw.model" kernel state via sysctl. Jails running in KVM are also correctly detected as "jail" not "kvm". Signed-off-by: Jiri Kubicek <jiri.kubicek@kraxnet.cz>
| * Fix #4352 - Support for detecting virtuals (jails) on FreeBSDJiri Kubicek2010-07-261-0/+3
| | | | | | | | | | | | There was no support for detecting FreeBSD jails as a virtual in facter. This patch detects jail by getting "security.jail.jailed" kernel state via sysctl. Signed-off-by: Jiri Kubicek <jiri.kubicek@kraxnet.cz>
| |
| \
| \
| \
*---. | Merge branches 'ticket/master/2330-uptime', 'ticket/master/4062-meego' and ↵Rein Henrichs2010-08-061-23/+42
|\ \ \| | | | | | | | | | | | | 'ticket/master/4453-rakefile'
| * | | [#2330] Update uptime calculation to use /bin/catRein Henrichs2010-08-051-7/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | * Per #4466, Ruby has trouble reading files in /proc [1]. The alternative is to use `bin/cat`. * Also refactored methods to explicitly redirect standard error to /dev/null for *nix and BSD system calls. [1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/155745
| * / [#2330] Uptime should not make redundant system callsRein Henrichs2010-08-031-23/+43
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite of uptime facts and supporting utility methods. Works on unix, BSD, windows. No longer makes redundant system calls. Uses Facter::Util::Uptime utility methods: * Implemented uptime_seconds_unix using /proc/uptime or who -b on unix, sysctl on BSD. Added unit tests for the behaviors of get_uptime_seconds_unix: read from proc/uptime, read uptime from "sysctl -b kern.boottime", read uptime from "who -b", and return nil if nothing else works. * Implemented uptime_seconds_win using the Win32 API. Facts implemented: * uptime_{seconds,hours,days} Returns the respective integer value. * uptime Returns human readable uptime statistic that preserves original behavior. Examples: 3 days 1 day 5:08 hours 0:35 hours