<commit_before>#!/usr/bin/env bash
#
# Copyright 2016 IBM Corp.
#
# All Rights Reserved.
#
#    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.

# User can override the git urls
GIT_OPSMGR_URL=${GIT_OPSMGR_URL:-"git://github.com/open-power-ref-design/opsmgr"}
GIT_CEPH_URL=${GIT_CEPH_URL:-"git://github.com/open-power-ref-design/ceph-services"}
export GIT_GENESIS_URL=${GIT_GENESIS_URL:-"git://github.com/open-power-ref-design/cluster-genesis"}

# User can override the revision of ulysses sub-projects by specifying a branch, tag, or commit
source <(grep = subproject-requirements.txt)
CEPH_TAG=${CEPH_TAG:-$__ceph_tag}
OPSMGR_TAG=${OPSMGR_TAG:-$__opsmgr_tag}
export GENESIS_TAG=${GENESIS_TAG:-$__genesis_tag}

# User can override the location of the cluster-genesis project.
export GENESIS_DIR=${GENESIS_DIR:-"/opt/cluster-genesis"}

# Note help text assumes the end user is invoking this script as Genesis is fully automated
# Default value (yes) is reversed for Genesis

if [ "$1" == "--help" ]; then
    echo "Usage: bootstrap-cluster.sh"
    echo ""
    echo "export DEPLOY_CEPH=yes|no                          Default is no"
    echo "export DEPLOY_OPSMGR=yes|no                        Default is no"
    echo "export DEPLOY_HARDENING=yes|no                     Default is no"
    echo "export DEPLOY_TEMPEST=yes|no                       Default is no"
    echo "export ADMIN_PASSWORD=                             Not applicable unless set"
    echo ""
    echo "See the README.rst file for more information"
    exit 1
fi

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root."
    exit 1
fi

if [ ! -e scripts/bootstrap-cluster.sh ]; then
    echo "This script must be run in the root directory of the project.  ie. /root/os-services"
    exit 1
fi

# Install some prerequisite packages
DISTO=`lsb_release -r | awk '{print $2}'`
if [ $? != 0 ]; then
    echo "Unsupported Linux distribution.  Must be Ubuntu 14.04"
    exit 1
fi

type apt-get >/dev/null 2>&1
if [ $? != 0 ]; then
    echo "Unsupported Linux distribution.  Must be Ubuntu 14.04"
    exit 1
fi
PCLD_DIR=`pwd`

# Save command arguments as source script parses command arguments using optind
ARGS=$@
source osa/scripts/process-args.sh

echo DEPLOY_CEPH=$DEPLOY_CEPH
echo DEPLOY_OPSMGR=$DEPLOY_OPSMGR

apt-get -qq update
apt-get -qq -y install build-essential libssl-dev libffi-dev python-dev \
    python3-dev bridge-utils debootstrap ifenslave ifenslave-2.6 lsof lvm2 \
    ntp ntpdate tcpdump vlan

CODENAME=`lsb_release -c | awk '{print $2}'`
if [ $? != 0 ] || [ "$CODENAME" != "xenial" ]; then
    echo "Unsupported Linux distribution.  Must be Ubuntu 16.04"
else
    # XXX Does this need to be done on each controller node?
    # Sequentially invoke build/install/wget scripts to replace
    # non-openstack related pkgs
    pushd pkgs >/dev/null 2>&1
    for script in *.sh; do
        command ./$script
        rc=$?
        if [ $rc != 0 ]; then<commit_msg>Update linux distro error messages to Ubuntu 16.04<commit_after>#!/usr/bin/env bash
#
# Copyright 2016 IBM Corp.
#
# All Rights Reserved.
#
#    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.

# User can override the git urls
GIT_OPSMGR_URL=${GIT_OPSMGR_URL:-"git://github.com/open-power-ref-design/opsmgr"}
GIT_CEPH_URL=${GIT_CEPH_URL:-"git://github.com/open-power-ref-design/ceph-services"}
export GIT_GENESIS_URL=${GIT_GENESIS_URL:-"git://github.com/open-power-ref-design/cluster-genesis"}

# User can override the revision of ulysses sub-projects by specifying a branch, tag, or commit
source <(grep = subproject-requirements.txt)
CEPH_TAG=${CEPH_TAG:-$__ceph_tag}
OPSMGR_TAG=${OPSMGR_TAG:-$__opsmgr_tag}
export GENESIS_TAG=${GENESIS_TAG:-$__genesis_tag}

# User can override the location of the cluster-genesis project.
export GENESIS_DIR=${GENESIS_DIR:-"/opt/cluster-genesis"}

# Note help text assumes the end user is invoking this script as Genesis is fully automated
# Default value (yes) is reversed for Genesis

if [ "$1" == "--help" ]; then
    echo "Usage: bootstrap-cluster.sh"
    echo ""
    echo "export DEPLOY_CEPH=yes|no                          Default is no"
    echo "export DEPLOY_OPSMGR=yes|no                        Default is no"
    echo "export DEPLOY_HARDENING=yes|no                     Default is no"
    echo "export DEPLOY_TEMPEST=yes|no                       Default is no"
    echo "export ADMIN_PASSWORD=                             Not applicable unless set"
    echo ""
    echo "See the README.rst file for more information"
    exit 1
fi

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root."
    exit 1
fi

if [ ! -e scripts/bootstrap-cluster.sh ]; then
    echo "This script must be run in the root directory of the project.  ie. /root/os-services"
    exit 1
fi

# Install some prerequisite packages
DISTO=`lsb_release -r | awk '{print $2}'`
if [ $? != 0 ]; then
    echo "Unsupported Linux distribution.  Must be Ubuntu 16.04"
    exit 1
fi

type apt-get >/dev/null 2>&1
if [ $? != 0 ]; then
    echo "Unsupported Linux distribution.  Must be Ubuntu 16.04"
    exit 1
fi
PCLD_DIR=`pwd`

# Save command arguments as source script parses command arguments using optind
ARGS=$@
source osa/scripts/process-args.sh

echo DEPLOY_CEPH=$DEPLOY_CEPH
echo DEPLOY_OPSMGR=$DEPLOY_OPSMGR

apt-get -qq update
apt-get -qq -y install build-essential libssl-dev libffi-dev python-dev \
    python3-dev bridge-utils debootstrap ifenslave ifenslave-2.6 lsof lvm2 \
    ntp ntpdate tcpdump vlan

CODENAME=`lsb_release -c | awk '{print $2}'`
if [ $? != 0 ] || [ "$CODENAME" != "xenial" ]; then
    echo "Unsupported Linux distribution.  Must be Ubuntu 16.04"
else
    # XXX Does this need to be done on each controller node?
    # Sequentially invoke build/install/wget scripts to replace
    # non-openstack related pkgs
    pushd pkgs >/dev/null 2>&1
    for script in *.sh; do
        command ./$script
        rc=$?
        if [ $rc != 0 ]; then
{'fraction_non_alphanumeric': 0.10012892135797163, 'fraction_numerical': 0.012319151983956453, 'mean_word_length': 3.109476162448499, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6060242', 'n_tokens_mistral': 2358, 'n_tokens_neox': 2210, 'n_words': 764}