Created
October 27, 2011 04:31
-
-
Save cleonte/1318780 to your computer and use it in GitHub Desktop.
solo.py patch for rhel6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/littlechef/solo.py b/littlechef/solo.py | |
index 977231b..fc21d50 100644 | |
--- a/littlechef/solo.py | |
+++ b/littlechef/solo.py | |
@@ -14,6 +14,7 @@ | |
# | |
"""Chef Solo deployment""" | |
import os | |
+import re | |
from fabric.api import * | |
from fabric import colors | |
@@ -91,7 +92,6 @@ def configure(current_node=None): | |
with hide('stdout'): | |
sudo('chown root:root {0}'.format('/etc/chef/solo.rb')) | |
- | |
def check_distro(): | |
"""Check that the given distro is supported and return the distro type""" | |
debian_distros = ['wheezy', 'squeeze', 'lenny'] | |
@@ -257,22 +257,43 @@ def _add_rpm_repos(): | |
""" | |
with show('running'): | |
- # Install the EPEL Yum Repository. | |
- with settings(hide('warnings', 'running'), warn_only=True): | |
- repo_url = "http://download.fedora.redhat.com" | |
- repo_path = "/pub/epel/5/i386/epel-release-5-4.noarch.rpm" | |
- output = sudo('rpm -Uvh {0}{1}'.format(repo_url, repo_path)) | |
- installed = "package epel-release-5-4.noarch is already installed" | |
- if output.failed and installed not in output: | |
- abort(output) | |
- # Install the FrameOS RBEL Yum Repository. | |
+ #get rhel version | |
with settings(hide('warnings', 'running'), warn_only=True): | |
- repo_url = "http://rbel.co/rbel5" | |
- repo_path = "" | |
- output = sudo('rpm -Uvh {0}{1}'.format(repo_url, repo_path)) | |
- installed = "package rbel5-release-1.0-2.el5.noarch is already installed" | |
- if output.failed and installed not in output: | |
- abort(output) | |
+ output = sudo('cat /etc/redhat-release') | |
+ rhel_version = re.findall("\d[\d.]*",output)[0].split('.')[0] | |
+ if rhel_version =='5': | |
+ # Install the EPEL Yum Repository.with settings(hide('warnings', 'running'), warn_only=True): | |
+ repo_url = "http://download.fedora.redhat.com" | |
+ repo_path = "/pub/epel/5/i386/epel-release-5-4.noarch.rpm" | |
+ output = sudo('rpm -Uvh {0}{1}'.format(repo_url, repo_path)) | |
+ installed = "package epel-release-5-4.noarch is already installed" | |
+ if output.failed and installed not in output: | |
+ abort(output) | |
+ # Install the FrameOS RBEL Yum Repository. | |
+ with settings(hide('warnings', 'running'), warn_only=True): | |
+ repo_url = "http://rbel.co/rbel5" | |
+ repo_path = "" | |
+ output = sudo('rpm -Uvh {0}{1}'.format(repo_url, repo_path)) | |
+ installed = "package rbel5-release-1.0-2.el5.noarch is already installed" | |
+ if output.failed and installed not in output: | |
+ abort(output) | |
+ elif rhel_version =='6': | |
+ with settings(hide('warnings', 'running'), warn_only=True): | |
+ repo_url = "http://download.fedora.redhat.com" | |
+ repo_path = "/pub/epel/6/i386/epel-release-6-5.noarch.rpm" | |
+ output = sudo('rpm -Uvh {0}{1}'.format(repo_url, repo_path)) | |
+ installed = "package epel-release-6-5.noarch is already installed" | |
+ if output.failed and installed not in output: | |
+ abort(output) | |
+ # Install the FrameOS RBEL Yum Repository. | |
+ with settings(hide('warnings', 'running'), warn_only=True): | |
+ repo_url = "http://rbel.co/rbel6" | |
+ repo_path = "" | |
+ output = sudo('rpm -Uvh {0}{1}'.format(repo_url, repo_path)) | |
+ installed = "package rbel6-release-1.0-2.el6.noarch is already installed" | |
+ if output.failed and installed not in output: | |
+ abort(output) | |
def _rpm_install(): | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment