From 68d68c27dd80391d7cb48aec213a3582d5df66e2 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 13 Jul 2016 08:43:08 -0500 Subject: [PATCH] Remove os-detection script The os-detection script has been removed because it will cause issues on a base system that does not have python pre-installed Example: Ubuntu Xenial. Change-Id: I9770d51c97ba3f1657976aee4bda5d7db9c13b2e Signed-off-by: Kevin Carter --- scripts/bootstrap-ansible.sh | 6 +++--- scripts/os-detection.py | 25 ------------------------- scripts/scripts-library.sh | 6 ------ 3 files changed, 3 insertions(+), 34 deletions(-) delete mode 100755 scripts/os-detection.py diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index b51cd4b1ae..488f8a1d02 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -46,11 +46,11 @@ ANSIBLE_ROLE_FILE="$(readlink -f ${ANSIBLE_ROLE_FILE})" ssh_key_create # Install the base packages -if [[ $HOST_DISTRO =~ ^(Ubuntu|Debian) ]]; then +if [[ -f "/etc/os-release" ]]; then apt-get update && apt-get -y install git python-all python-dev curl python2.7-dev build-essential libssl-dev libffi-dev python-requests < /dev/null -elif [[ $HOST_DISTRO =~ ^(CentOS|Red Hat) ]]; then +elif [[ -f "/etc/redhat-release" ]]; then yum check-update && yum -y install git python2 curl autoconf gcc-c++ python2-devel gcc libffi-devel openssl-devel python-requests -elif [[ $HOST_DISTRO =~ ^Fedora ]]; then +elif [[ -f "/etc/fedora-release" ]]; then dnf -y install git python curl autoconf gcc-c++ python-devel gcc libffi-devel openssl-devel python-requests fi diff --git a/scripts/os-detection.py b/scripts/os-detection.py deleted file mode 100755 index 2e457e8009..0000000000 --- a/scripts/os-detection.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# Copyright 2015, Rackspace US, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Determines the operating system of a host and returns bash variables.""" -import platform - - -template = """ -HOST_DISTRO="{0}" -HOST_VERSION="{1}" -HOST_CODENAME="{2}" -""".format(*platform.linux_distribution()) - -print(template) diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index a8df6cb4cb..2ffdf03193 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -262,12 +262,6 @@ function get_pip { trap "exit_fail ${LINENO} $? 'Received STOP Signal'" SIGHUP SIGINT SIGTERM trap "exit_fail ${LINENO} $?" ERR -## Determine OS -------------------------------------------------------------- -# Determine the operating system of the base host -# Adds the $HOST_DISTRO, $HOST_VERSION, and $HOST_CODENAME bash variables. -eval "$(python $(dirname ${BASH_SOURCE})/os-detection.py)" -echo "Detected ${HOST_DISTRO} ${HOST_VERSION} (codename: ${HOST_CODENAME})" - ## Pre-flight check ---------------------------------------------------------- # Make sure only root can run our script if [ "$(id -u)" != "0" ]; then