#!/bin/bash # # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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. NODEPOOL_KEY=$HOME/.ssh/id_nodepool NODEPOOL_KEY_NAME=root NODEPOOL_PUBKEY=$HOME/.ssh/id_nodepool.pub NODEPOOL_INSTALL=$HOME/nodepool-venv NODEPOOL_CACHE_GET_PIP=/opt/stack/cache/files/get-pip.py # Install shade from git if requested. If not requested # nodepool install will pull it in. function install_shade { if use_library_from_git "shade"; then GITREPO["shade"]=$SHADE_REPO_URL GITDIR["shade"]=$DEST/shade GITBRANCH["shade"]=$SHADE_REPO_REF git_clone_by_name "shade" # Install shade globally, because the job config has LIBS_FROM_GIT # and if we don't install it globally, all hell breaks loose setup_dev_lib "shade" # BUT - install shade into a virtualenv so that we don't have issues # with OpenStack constraints affecting the shade dependency install. # This particularly shows up with os-client-config $NODEPOOL_INSTALL/bin/pip install -e $DEST/shade fi } function install_diskimage_builder { if use_library_from_git "diskimage-builder"; then GITREPO["diskimage-builder"]=$DISKIMAGE_BUILDER_REPO_URL GITDIR["diskimage-builder"]=$DEST/diskimage-builder GITBRANCH["diskimage-builder"]=$DISKIMAGE_BUILDER_REPO_REF git_clone_by_name "diskimage-builder" setup_dev_lib "diskimage-builder" $NODEPOOL_INSTALL/bin/pip install -e $DEST/diskimage-builder fi } function install_glean { if use_library_from_git "glean"; then GITREPO["glean"]=$GLEAN_REPO_URL GITDIR["glean"]=$DEST/glean GITBRANCH["glean"]=$GLEAN_REPO_REF git_clone_by_name "glean" setup_dev_lib "glean" $NODEPOOL_INSTALL/bin/pip install -e $DEST/glean fi } # Install nodepool code function install_nodepool { virtualenv $NODEPOOL_INSTALL install_shade install_diskimage_builder install_glean setup_develop $DEST/nodepool $NODEPOOL_INSTALL/bin/pip install -e $DEST/nodepool } # requires some globals from devstack, which *might* not be stable api # points. If things break, investigate changes in those globals first. function nodepool_create_keypairs { if [[ ! -f $NODEPOOL_KEY ]]; then ssh-keygen -f $NODEPOOL_KEY -P "" fi cat > /tmp/ssh_wrapper < /tmp/01-nodepool-setup < /tmp/50-apt-allow-unauthenticated < /tmp/logging.conf < /tmp/secure.conf << EOF [database] # The mysql password here may be different depending on your # devstack install, you should double check it (the devstack var # is MYSQL_PASSWORD and if unset devstack should prompt you for # the value). dburi: $dburi EOF sudo mv /tmp/secure.conf $NODEPOOL_SECURE if use_library_from_git "glean"; then git --git-dir=$DEST/glean/.git checkout -b devstack DIB_GLEAN_INSTALLTYPE="DIB_INSTALLTYPE_simple_init: 'repo'" DIB_GLEAN_REPOLOCATION="DIB_REPOLOCATION_glean: '$DEST/glean'" DIB_GLEAN_REPOREF="DIB_REPOREF_glean: 'devstack'" fi if [ -f $NODEPOOL_CACHE_GET_PIP ] ; then DIB_GET_PIP="DIB_REPOLOCATION_pip_and_virtualenv: file://$NODEPOOL_CACHE_GET_PIP" fi if [ -f /etc/ci/mirror_info.sh ] ; then source /etc/ci/mirror_info.sh DIB_DISTRIBUTION_MIRROR_CENTOS="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_CENTOS_MIRROR" DIB_DISTRIBUTION_MIRROR_DEBIAN="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_DEBIAN_MIRROR" DIB_DISTRIBUTION_MIRROR_FEDORA="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_FEDORA_MIRROR" DIB_DISTRIBUTION_MIRROR_UBUNTU="DIB_DISTRIBUTION_MIRROR: $NODEPOOL_UBUNTU_MIRROR" DIB_DEBOOTSTRAP_EXTRA_ARGS="DIB_DEBOOTSTRAP_EXTRA_ARGS: '--no-check-gpg'" fi cat > /tmp/nodepool.yaml <>/tmp/clouds.yaml <