On 9 March 2011 01:32, Adrien Thebo <adr...@puppetlabs.com> wrote:
>  - Adds support for Slamd64 and Bluewhite64 for the operatingsystem
>   fact
>  - Adds support for Slamd64 and Bluewhite64 for the
>   operatingsystemrelease fact

+1

The duplication is a bit of a code smell, we probably should improve
this fact some longer term as there are classes of thing (redhat
release derived) that basically act very similarly.

Paul
>
> Signed-off-by: Adrien Thebo <adr...@puppetlabs.com>
> ---
> Local-branch: tickets/next/2721
>  lib/facter/operatingsystem.rb        |    8 ++++++--
>  lib/facter/operatingsystemrelease.rb |   26 +++++++++++++++++++++++++-
>  2 files changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/lib/facter/operatingsystem.rb b/lib/facter/operatingsystem.rb
> index c5a3dc1..061e18e 100644
> --- a/lib/facter/operatingsystem.rb
> +++ b/lib/facter/operatingsystem.rb
> @@ -50,8 +50,12 @@ Facter.add(:operatingsystem) do
>             else
>                 "SuSE"
>             end
> -       elsif FileTest.exists?("/etc/slackware-version")
> -           "Slackware"
> +        elsif FileTest.exists?("/etc/bluewhite64-version")
> +            "Bluewhite64"
> +        elsif FileTest.exists?("/etc/slamd64-version")
> +            "Slamd64"
> +        elsif FileTest.exists?("/etc/slackware-version")
> +            "Slackware"
>         end
>     end
>  end
> diff --git a/lib/facter/operatingsystemrelease.rb 
> b/lib/facter/operatingsystemrelease.rb
> index 280208b..ac9be65 100644
> --- a/lib/facter/operatingsystemrelease.rb
> +++ b/lib/facter/operatingsystemrelease.rb
> @@ -72,5 +72,29 @@ Facter.add(:operatingsystemrelease) do
>  end
>
>  Facter.add(:operatingsystemrelease) do
> -    setcode do Facter[:kernelrelease].value end
> +    confine :operatingsystem => %w{Bluewhite64}
> +    setcode do
> +        releasefile = Facter::Util::Resolution.exec('cat 
> /etc/bluewhite64-version')
> +        if releasefile =~ /^\s*\w+\s+(\d+)\.(\d+)/
> +            $1 + "." + $2
> +        else
> +            "unknown"
> +        end
> +    end
> +end
> +
> +Facter.add(:operatingsystemrelease) do
> +    confine :operatingsystem => %w{Slamd64}
> +    setcode do
> +        releasefile = Facter::Util::Resolution.exec('cat 
> /etc/slamd64-version')
> +        if releasefile =~ /^\s*\w+\s+(\d+)\.(\d+)/
> +            $1 + "." + $2
> +        else
> +            "unknown"
> +        end
> +    end
> +end
> +
> +Facter.add(:operatingsystemrelease) do
> +  setcode do Facter[:kernelrelease].value end
>  end
> --
> 1.7.4.1
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Developers" group.
> To post to this group, send email to puppet-dev@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-dev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to