Cleanups and warmup movings arounds

This commit is contained in:
Joshua Harlow
2012-05-29 12:23:59 -07:00
parent dade649777
commit dc0d7c46d3
6 changed files with 103 additions and 82 deletions

View File

@@ -106,8 +106,12 @@ def make_url(scheme, host, port=None,
netloc = ''
if host:
netloc = str(host)
port_i = None
if port is not None:
netloc += ":%s" % (port)
port_i = int(port)
if port_i is not None:
netloc += ":" + "%s" % (port_i)
pieces.append(netloc or '')
pieces.append(path or '')
@@ -196,17 +200,6 @@ def to_bytes(text):
return byte_val
def mark_unexecute_file(fn, kvs, comment_start='#'):
add_lines = list()
add_lines.append('')
add_lines.append(comment_start + ' Ran on %s by %s' % (date.rcf8222date(), sh.getuser()))
add_lines.append(comment_start + ' With data:')
for (k, v) in kvs.items():
add_lines.append(comment_start + ' %s => %s' % (k, v))
sh.append_file(fn, joinlinesep(*add_lines))
sh.chmod(fn, 0644)
def log_iterable(to_log, header=None, logger=None, do_color=True):
if not to_log:
return

View File

@@ -165,11 +165,11 @@ Well grab the latest version of ANVIL via git:
$ git clone git://github.com/yahoo/Openstack-Anvil.git anvil
Now setup the prerequisites needed to run:
Now setup the prerequisites needed to run (select the appropriate shell script for your distro):
::
$ cd anvil && sudo ./warmup.sh
$ cd anvil/warmup && sudo ./$DISTRO.sh
Configuration
-------------

View File

@@ -1,68 +0,0 @@
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root!" 1>&2
exit 1
fi
# This should follow what is on the following website.
ME=`basename $0`
if [[ `cat /etc/issue | grep -i "ubuntu"` ]] ; then
PKGS="gcc git pep8 pylint python python-dev python-iniparse python-pip python-progressbar python-yaml"
PIPS="netifaces termcolor"
APT="apt-get -y -qq"
PIP="pip -q"
# Now do it!
echo "Preparing ANVIL for ubuntu."
echo "Installing packages: $PKGS"
$APT install $PKGS
echo "Installing pypi packages: $PIPS"
$PIP install netifaces termcolor --upgrade
elif [[ `cat /etc/issue | grep -i "red hat enterprise.*release.*6.*"` ]] ; then
EPEL_RPM="epel-release-6-6.noarch.rpm"
PKGS="gcc git pylint python python-netifaces python-pep8 python-pip python-progressbar PyYAML"
PIPS="termcolor iniparse"
PIP="pip-python -q"
YUM="yum install -q -y"
WGET="wget -q"
# Now do it!
echo "Preparing ANVIL for RHEL 6"
URI="http://download.fedoraproject.org/pub/epel/6/i386/$EPEL_RPM"
echo "Fetching epel rpm: $EPEL_RPM from $URI"
TMP_DIR=`mktemp -d`
$WGET $URI -O $TMP_DIR/$EPEL_RPM
if [ "$?" -ne "0" ]; then
echo "Sorry, stopping since download from $URI failed."
exit 1
fi
echo "Installing $TMP_DIR/$EPEL_RPM"
OUT=$($YUM install $TMP_DIR/$EPEL_RPM 2>&1)
if [[ "$OUT" =~ "Nothing to do" ]]
then
echo "It appears $EPEL_RPM is already installed."
elif [ "$?" -ne "0" ]
then
echo "Sorry, stopping since install of $TMP_DIR/$EPEL_RPM failed."
exit 1
fi
echo "Installing packages: $PKGS"
$YUM install $PKGS
echo "Installing pypi packages: $PIPS"
$PIP install $PIPS --upgrade
elif [[ `cat /etc/issue | grep -i "fedora.*release.*16"` ]] ; then
PKGS="gcc git pylint python python-netifaces python-pep8 python-pip python-progressbar PyYAML python-iniparse"
PIPS="termcolor"
PIP="pip-python -q"
YUM="yum install -q -y"
# Now do it!
echo "Preparing ANVIL for Fedora 16"
echo "Installing packages: $PKGS"
$YUM install $PKGS
echo "Installing pypi packages: $PIPS"
$PIP install $PIPS --upgrade
else
echo "ANVIL '$ME' is being ran on an unknown distribution."
fi

21
warmups/fedora.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root!" 1>&2
exit 1
fi
set -x
# Now do it!
echo "Preparing ANVIL for Fedora"
# Install the needed yum packages
PKGS="gcc git pylint python python-netifaces python-pep8 python-pip python-progressbar PyYAML python-iniparse"
echo "Installing packages: $PKGS"
yum install -q -y install $PKGS
# Install the needed pypi packages
PIPS="termcolor"
echo "Installing pypi packages: $PIPS"
pip-python -q install $PIPS --upgrade

54
warmups/rhel6.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root!" 1>&2
exit 1
fi
set -x
# Figure out the epel rpm, as it seems to change alot...
# Just use the following epel http mirror
EPEL_RPM=$(curl -s "http://epel.mirror.freedomvoice.com/6/i386/" | \
grep -Pi "(epel-release(.*).rpm)" | perl -ne 'm/(epel.*?rpm)/; print "$1";')
if [ -z "$EPEL_RPM" ]; then
echo "Sorry no epel rpm found!"
exit 1
fi
# Now do it!
echo "Preparing ANVIL for RHEL 6"
URI="http://epel.mirror.freedomvoice.com/6/i386/$EPEL_RPM"
echo "Fetching epel rpm: $EPEL_RPM from $URI"
TMP_DIR=`mktemp -d`
wget -q $URI -O $TMP_DIR/$EPEL_RPM
if [ "$?" -ne "0" ]; then
echo "Sorry, stopping since download from $URI failed."
exit 1
fi
echo "Installing $TMP_DIR/$EPEL_RPM"
OUT=$(yum install -y -q install $TMP_DIR/$EPEL_RPM 2>&1)
if [[ "$OUT" =~ "Nothing to do" ]]
then
echo "It appears $EPEL_RPM is already installed."
elif [ "$OUT" =~ "Nothing to do" ]
then
echo "Installed!"
elif [ "$?" -ne "0" ]
then
echo "Sorry, stopping since install of $TMP_DIR/$EPEL_RPM failed."
exit 1
fi
# Install the needed yum packages
PKGS="gcc git pylint python python-netifaces python-pep8 python-pip python-progressbar PyYAML"
echo "Installing packages: $PKGS"
yum install -y -q install $PKGS
# Install the needed pypi packages
PIPS="termcolor iniparse"
echo "Installing pypi packages: $PIPS"
pip-python -q install $PIPS --upgrade
exit 0

21
warmups/ubuntu.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root!" 1>&2
exit 1
fi
set -x
# Now do it!
echo "Preparing ANVIL for ubuntu."
# Install the needed apt packages
PKGS="gcc git pep8 pylint python python-dev python-iniparse python-pip python-progressbar python-yaml"
echo "Installing packages: $PKGS"
apt-get -y -qq install $PKGS
# Install the needed pypi packages
PIPS="netifaces termcolor"
echo "Installing pypi packages: $PIPS"
pip -q install netifaces termcolor --upgrade