diff options
| author | luke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a> | 2006-01-03 18:51:31 +0000 |
|---|---|---|
| committer | luke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a> | 2006-01-03 18:51:31 +0000 |
| commit | 7df3411c2ef986f40592e12fa5588b5dbd4e6902 (patch) | |
| tree | c3a880d8c0e730e9e64c0909fbcc3221d80c9142 /lib | |
| parent | c64643480d0c4b1b05774f6e210cc58ebb246244 (diff) | |
adding fixes Eric Sorenson found with cygwin
git-svn-id: http://reductivelabs.com/svn/facter/trunk@66 1f5c1d6a-bddf-0310-8f58-fc49e503516a
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/facter.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/facter.rb b/lib/facter.rb index 7beb291..f8bd8b9 100644 --- a/lib/facter.rb +++ b/lib/facter.rb @@ -13,7 +13,7 @@ class Facter include Comparable include Enumerable - FACTERVERSION="1.0.1" +FACTERVERSION = '1.0.1' # = Facter 1.0 # Functions as a hash of 'facts' you might care about about your # system, such as mac address, IP address, Video card, etc. @@ -332,6 +332,7 @@ class Facter out = %x{#{code}}.chomp rescue => detail $stderr.puts detail + return nil end if out == "" return nil @@ -495,6 +496,7 @@ class Facter Facter["Domain"].add { |obj| obj.code = proc { domain = Resolution.exec('domainname') + return nil unless domain # make sure it's a real domain if domain =~ /.+\..+/ domain @@ -565,9 +567,10 @@ class Facter Facter["IPHostNumber"].add { |obj| obj.code = proc { hostname = Facter["hostname"].value - # crap, we need Hostname to exist for this to - # work + # we need Hostname to exist for this to work list = Resolution.exec("host #{hostname}").chomp.split(/\s/) + + return nil unless list if defined? list[-1] and list[-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ list[-1] end @@ -743,6 +746,8 @@ class Facter return "Fedora" elsif FileTest.exists?("/etc/redhat-release") return "RedHat" + elsif FileTest.exists?("/etc/SuSE-release") + return "SuSE" end } } |
