Issue #7670 has been updated by Ken Bowley.

I know this isn't the correct way to submit a diff, but here are the changes I 
made:

    --- operatingsystem.rb.bak  2011-05-25 16:10:50.430250113 -0700
    +++ operatingsystem.rb      2011-05-25 16:16:43.730442789 -0700
    @@ -11,7 +11,14 @@
             if Facter.value(:lsbdistid) == "Ubuntu"
                "Ubuntu"
             elsif FileTest.exists?("/etc/debian_version")
    -            "Debian"
    +       if FileTest.exists?("/etc/lsb-release")
    +           txt = File.read("/etc/lsb-release")
    +           if txt =~ /Ubuntu/
    +               "Ubuntu"
    +           end
    +       else
    +           "Debian"
    +       end
             elsif FileTest.exists?("/etc/gentoo-release")
                 "Gentoo"
             elsif FileTest.exists?("/etc/fedora-release")

and to get rid of the horrible idea of looking at /etc/issue for the release:

    --- operatingsystemrelease.rb.bak   2011-05-25 16:17:07.910684798 -0700
    +++ operatingsystemrelease.rb       2011-05-25 16:19:42.811902393 -0700
    @@ -34,7 +34,7 @@
     Facter.add(:operatingsystemrelease) do
         confine :operatingsystem => %w{Ubuntu}
         setcode do
    -        release = Facter::Util::Resolution.exec('cat /etc/issue')
    +        release = Facter::Util::Resolution.exec('cat /etc/lsb-release')
             if release =~ /Ubuntu (\d+.\d+)/
                 $1
             end

----------------------------------------
Bug #7670: operatingsystem fact incorrect after clear on Ubuntu
https://projects.puppetlabs.com/issues/7670

Author: Ken Bowley
Status: Accepted
Priority: Immediate
Assignee: 
Category: library
Target version: 
Keywords: 
Branch: 
Affected Facter version: 1.5.9


Facter returns incorrect facts for "operatingsystem" and 
"operatingsystemrelease" after Facter.clear is called when running on Ubuntu.

    $ irb
    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> require 'facter'
    => true
    irb(main):003:0> Facter["operatingsystem"].value
    => "Ubuntu"
    irb(main):004:0> Facter.clear
    => nil
    irb(main):005:0> Facter["operatingsystem"].value
    => "Debian"

This causes puppet to report the wrong operatingsystem, and breaks many 
manifests on our current deployment.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to