From 85ce2c42db50bd68a1203dbe08febf7dab04ad8c Mon Sep 17 00:00:00 2001
From: Brett Porter <brett@apache.org>
Date: Sun, 2 Sep 2012 00:50:57 -0700
Subject: [PATCH 1/3] correct class name in README

---
 README.markdown | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.markdown b/README.markdown
index 784621e24..c4146c85c 100644
--- a/README.markdown
+++ b/README.markdown
@@ -18,7 +18,7 @@ Setup a new virtual host
 
 <pre>
     node default {
-      class { 'mcollective': }
+      class { 'nginx': }
       nginx::resource::vhost { 'www.puppetlabs.com':
         ensure   => present,
         www_root => '/var/www/www.puppetlabs.com',
@@ -29,7 +29,7 @@ Setup a new virtual host
 Add a Proxy Server(s)
 <pre>
    node default {
-     class { 'mcollective': }
+     class { 'nginx': }
      nginx::resource::upstream { 'puppet_rack_app':
        ensure  => present,
        members => [

From f2a14b996141c7aebaa3a26cfdb1c47cfde43b8a Mon Sep 17 00:00:00 2001
From: Brett Porter <brett@maestrodev.com>
Date: Sun, 2 Sep 2012 00:55:34 -0700
Subject: [PATCH 2/3] support redhat as operating system in addition to rhel

---
 manifests/package.pp        | 2 +-
 manifests/package/redhat.pp | 6 +++++-
 manifests/params.pp         | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/manifests/package.pp b/manifests/package.pp
index 2751f18c7..5b9fbb6df 100644
--- a/manifests/package.pp
+++ b/manifests/package.pp
@@ -18,7 +18,7 @@
   anchor { 'nginx::package::end': }
 
   case $::operatingsystem {
-    centos,fedora,rhel: {
+    centos,fedora,rhel,redhat: {
       class { 'nginx::package::redhat':
         require => Anchor['nginx::package::begin'],
         before  => Anchor['nginx::package::end'],
diff --git a/manifests/package/redhat.pp b/manifests/package/redhat.pp
index bee254963..9084d6494 100644
--- a/manifests/package/redhat.pp
+++ b/manifests/package/redhat.pp
@@ -16,7 +16,11 @@
 class nginx::package::redhat {
   $redhat_packages = ['nginx', 'GeoIP', 'gd', 'libXpm', 'libxslt']
 
-  $os_type = downcase($::operatingsystem)
+  if downcase($::operatingsystem) == "redhat" {
+    $os_type = "rhel"
+  } else {
+    $os_type = downcase($::operatingsystem)
+  }
 
   yumrepo { "nginx-release":
     baseurl  => "http://nginx.org/packages/${os_type}/${::lsbmajdistrelease}/\$basearch/",
diff --git a/manifests/params.pp b/manifests/params.pp
index 5ea00c189..b5c3a6ae2 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -50,7 +50,7 @@
   }
 
   $nx_daemon_user = $::operatingsystem ? {
-    /(?i-mx:debian|ubuntu)/                    => 'www-data',
-    /(?i-mx:fedora|rhel|centos|suse|opensuse)/ => 'nginx',
+    /(?i-mx:debian|ubuntu)/                           => 'www-data',
+    /(?i-mx:fedora|rhel|redhat|centos|suse|opensuse)/ => 'nginx',
   }
 }

From b9afd221a3c2b922c29818689196ba562486ceab Mon Sep 17 00:00:00 2001
From: Brett Porter <brett@apache.org>
Date: Mon, 3 Sep 2012 11:31:40 -0700
Subject: [PATCH 3/3] support platforms that don't supply lsbmajdistrelease
 fact

---
 manifests/package/redhat.pp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/manifests/package/redhat.pp b/manifests/package/redhat.pp
index 9084d6494..f44df2d58 100644
--- a/manifests/package/redhat.pp
+++ b/manifests/package/redhat.pp
@@ -22,8 +22,14 @@
     $os_type = downcase($::operatingsystem)
   }
 
+  if $::lsbmajdistrelease == undef {
+    $os_rel = regsubst($::operatingsystemrelease, '\..*$', '')
+  } else {
+    $os_rel = $::lsbmajdistrelease
+  }
+
   yumrepo { "nginx-release":
-    baseurl  => "http://nginx.org/packages/${os_type}/${::lsbmajdistrelease}/\$basearch/",
+    baseurl  => "http://nginx.org/packages/${os_type}/${os_rel}/\$basearch/",
     descr    => 'nginx repo',
     enabled  => '1',
     gpgcheck => '0',