Skip to content

Commit

Permalink
Merge pull request #116 from MsysTechnologiesllc/ali/add_rhel_support
Browse files Browse the repository at this point in the history
Added AzureChefExtension support for RHEL platform.
  • Loading branch information
Nimisha Sharad committed Mar 28, 2016
2 parents bb3e55c + 4edad4c commit ca5dea9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
11 changes: 8 additions & 3 deletions ChefExtensionHandler/bin/chef-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ curl_check(){
echo "Detected curl..."
else
echo "Installing curl..."
if [ "$1" = "centos" ]; then
if [ "$1" = "centos" -o "$1" = "rhel" ]; then
yum install -d0 -e0 -y curl
else
apt-get install -q -y curl
Expand Down Expand Up @@ -122,7 +122,7 @@ get_chef_package_from_omnitruck() {
#check if chef-client is already installed
if [ "$platform" = "ubuntu" -o "$platform" = "debian" ]; then
dpkg-query -s chef
elif [ "$platform" = "centos" ]; then
elif [ "$platform" = "centos" -o "$platform" = "rhel" ]; then
yum list installed | grep -w "chef"
fi

Expand All @@ -147,6 +147,9 @@ get_chef_package_from_omnitruck() {
elif [ $platform = "debian" ]; then
platform_version=$(cat /etc/debian_version)
p=$platform
elif [ $platform = "rhel" ]; then
platform_version=`sed -r 's/.* ([0-9]).*/\1/' /etc/redhat-release`
p="el"
else
platform_version=$(lsb_release -sr)
p=$platform
Expand Down Expand Up @@ -179,7 +182,7 @@ get_chef_package_from_omnitruck() {
install_chef(){
if [ "$2" = "ubuntu" -o "$2" = "debian" ]; then
dpkg -i "$1/chef"
elif [ "$2" = "centos" ]; then
elif [ "$2" = "centos" -o "$2" = "rhel" ]; then
rpm -ivh "$1/chef"
fi
}
Expand All @@ -200,6 +203,8 @@ get_linux_distributor(){
linux_distributor='ubuntu'
elif python -mplatform | grep debian > /dev/null; then
linux_distributor='debian'
elif python -mplatform | grep redhat > /dev/null; then
linux_distributor='rhel'
fi
echo "${linux_distributor}"
}
Expand Down
10 changes: 6 additions & 4 deletions ChefExtensionHandler/bin/chef-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ uninstall_ubuntu_or_debian_chef_package(){
check_uninstallation_status
}

# Function to Uninstall centOS chef_pkg
uninstall_centos_chef_package(){
# Function to Uninstall centOS or RHEL chef_pkg
uninstall_centos_or_rhel_chef_package(){
pkg_name=`rpm -qi chef | grep Name | awk '{print $3}'`
if test "$pkg_name" = "chef" ; then
echo "[$(date)] Uninstalling package $pkg_name ..."
Expand Down Expand Up @@ -45,6 +45,8 @@ get_linux_distributor(){
linux_distributor='ubuntu'
elif python -mplatform | grep debian > /dev/null; then
linux_distributor='debian'
elif python -mplatform | grep redhat > /dev/null; then
linux_distributor='rhel'
fi
echo "${linux_distributor}"
}
Expand Down Expand Up @@ -116,10 +118,10 @@ else
remove_chef_config
uninstall_ubuntu_or_debian_chef_package
;;
"centos")
"centos"|"rhel")
echo "Linux Distributor: ${linux_distributor}"
remove_chef_config
uninstall_centos_chef_package
uninstall_centos_or_rhel_chef_package
;;
*)
echo "Unknown Distributor: $linux_distributor"
Expand Down

0 comments on commit ca5dea9

Please sign in to comment.