Created shared elements functions lib.
Share functions needed by all elements in a common lib. install_packages can be used lately to support other non-debian based distributions. Change-Id: I9fa0b833c34a614fe498c6c6ae599733a69c1309
This commit is contained in:
@@ -58,6 +58,7 @@ for arg do IMAGE_ELEMENT="$IMAGE_ELEMENT $arg" ; done
|
|||||||
source $_LIB/img-defaults
|
source $_LIB/img-defaults
|
||||||
source $_LIB/common-functions
|
source $_LIB/common-functions
|
||||||
source $_LIB/img-functions
|
source $_LIB/img-functions
|
||||||
|
source $_LIB/elements-functions
|
||||||
|
|
||||||
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info --expand-dependencies $IMAGE_ELEMENT)
|
IMAGE_ELEMENT=$($SCRIPT_HOME/element-info --expand-dependencies $IMAGE_ELEMENT)
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ sudo mkfs -F -t $FS_TYPE -L cloudimg-rootfs ${IMAGE_BLOCK_DEVICE}
|
|||||||
mount_tmp_image ${IMAGE_BLOCK_DEVICE}
|
mount_tmp_image ${IMAGE_BLOCK_DEVICE}
|
||||||
|
|
||||||
create_base
|
create_base
|
||||||
|
copy_elements_lib
|
||||||
run_d extra-data
|
run_d extra-data
|
||||||
do_pre_install
|
do_pre_install
|
||||||
do_extra_package_install
|
do_extra_package_install
|
||||||
|
|||||||
@@ -3,4 +3,6 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
apt-get -y install linux-image-generic vlan open-iscsi
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages linux-image-generic vlan open-iscsi
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
apt-get -y update
|
apt-get -y update
|
||||||
apt-get -y install python-software-properties language-pack-en
|
install_packages python-software-properties language-pack-en
|
||||||
add-apt-repository -y ppa:tripleo/demo
|
add-apt-repository -y ppa:tripleo/demo
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install git
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages git
|
||||||
if [ -n "$http_proxy" ]; then
|
if [ -n "$http_proxy" ]; then
|
||||||
sudo -Hiu stack git config --global http.proxy $http_proxy
|
sudo -Hiu stack git config --global http.proxy $http_proxy
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install git
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages git
|
||||||
if [ -n "$http_proxy" ]; then
|
if [ -n "$http_proxy" ]; then
|
||||||
sudo -Hiu stack git config --global http.proxy $http_proxy
|
sudo -Hiu stack git config --global http.proxy $http_proxy
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,4 +4,6 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install haveged
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages haveged
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages
|
||||||
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
||||||
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
||||||
python-greenlet python-routes python-simplejson python-webob rabbitmq-server
|
python-greenlet python-routes python-simplejson python-webob rabbitmq-server
|
||||||
@@ -30,4 +32,3 @@ cp $GLANCE_ROOT/etc/glance-api.conf /etc/glance
|
|||||||
cp $GLANCE_ROOT/etc/policy.json /etc/glance
|
cp $GLANCE_ROOT/etc/policy.json /etc/glance
|
||||||
cp $GLANCE_ROOT/etc/glance-api-paste.ini /etc/glance
|
cp $GLANCE_ROOT/etc/glance-api-paste.ini /etc/glance
|
||||||
cp $GLANCE_ROOT/etc/logging.cnf.sample /etc/glance/logging.conf
|
cp $GLANCE_ROOT/etc/logging.cnf.sample /etc/glance/logging.conf
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
set -uex
|
set -uex
|
||||||
|
|
||||||
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
CFN_TOOLS_ROOT=/opt/aws/bin # Heat hard codes this
|
CFN_TOOLS_ROOT=/opt/aws/bin # Heat hard codes this
|
||||||
|
|
||||||
HEAT_API_SOURCE=https://github.com/heat-api/heat-jeos.git
|
HEAT_API_SOURCE=https://github.com/heat-api/heat-jeos.git
|
||||||
@@ -9,7 +11,7 @@ HEAT_API_SOURCE=https://github.com/heat-api/heat-jeos.git
|
|||||||
OS_ROOT=/opt/stack
|
OS_ROOT=/opt/stack
|
||||||
JEOS_ROOT=$OS_ROOT/heat-jeos
|
JEOS_ROOT=$OS_ROOT/heat-jeos
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install git-core python-psutil
|
install_packages git-core python-psutil
|
||||||
|
|
||||||
mkdir -p $OS_ROOT
|
mkdir -p $OS_ROOT
|
||||||
git clone $HEAT_API_SOURCE $JEOS_ROOT
|
git clone $HEAT_API_SOURCE $JEOS_ROOT
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
set -uex
|
set -uex
|
||||||
|
|
||||||
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
# Setup ec2-user as expected by HEAT
|
# Setup ec2-user as expected by HEAT
|
||||||
if ! getent passwd ec2-user ; then
|
if ! getent passwd ec2-user ; then
|
||||||
useradd -m -G admin ec2-user -s /bin/bash
|
useradd -m -G admin ec2-user -s /bin/bash
|
||||||
@@ -23,4 +25,4 @@ Pin: release o=LP-PPA-tripleo-demo
|
|||||||
Pin-Priority: 900
|
Pin-Priority: 900
|
||||||
EOF
|
EOF
|
||||||
# Should pull from demo PPA if cloud-init exists there.
|
# Should pull from demo PPA if cloud-init exists there.
|
||||||
apt-get -y install cloud-init
|
install_packages cloud-init
|
||||||
|
|||||||
@@ -4,4 +4,5 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install hwinfo
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages hwinfo
|
||||||
|
|||||||
@@ -5,4 +5,5 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install icinga-core
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages icinga-core
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install icinga-web icinga-cgi
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages icinga-web icinga-cgi
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install jenkins
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages jenkins
|
||||||
|
|
||||||
# jenkins installs into /var/lib/jenkins which is rather restrictive.
|
# jenkins installs into /var/lib/jenkins which is rather restrictive.
|
||||||
mv /var/lib/jenkins /mnt/
|
mv /var/lib/jenkins /mnt/
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
|
install_packages \
|
||||||
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
||||||
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
||||||
python-greenlet python-routes python-simplejson python-webob
|
python-greenlet python-routes python-simplejson python-webob
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
|
source /lib/diskimage-builder/elements-functions
|
||||||
#DEBIAN_FRONTEND=noninteractive apt-get -y install sysstat mytop percona-toolkit percona-server-server-5.5 percona-server-client-5.5
|
#DEBIAN_FRONTEND=noninteractive apt-get -y install sysstat mytop percona-toolkit percona-server-server-5.5 percona-server-client-5.5
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install sysstat mytop percona-toolkit mysql-server-5.5 mysql-client-5.5
|
install_packages sysstat mytop percona-toolkit mysql-server-5.5 mysql-client-5.5
|
||||||
|
|||||||
@@ -4,4 +4,5 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install haveged
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages haveged
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
useradd -G admin -m nova -s /bin/false
|
useradd -G admin -m nova -s /bin/false
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
install_packages \
|
||||||
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
||||||
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
||||||
python-greenlet python-routes python-simplejson python-webob rabbitmq-server
|
python-greenlet python-routes python-simplejson python-webob rabbitmq-server
|
||||||
|
|||||||
@@ -5,4 +5,5 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install haproxy rabbitmq-server mysql-server ntp dkms
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages haproxy rabbitmq-server mysql-server ntp dkms
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install keystone glance nova-api nova-cert nova-common nova-scheduler python-nova python-novaclient nova-consoleauth novnc nova-novncproxy cinder-api cinder-scheduler cinder-volume iscsitarget open-iscsi iscsitarget-dkms python-cinderclient nova-network
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages keystone glance nova-api nova-cert nova-common nova-scheduler python-nova python-novaclient nova-consoleauth novnc nova-novncproxy cinder-api cinder-scheduler cinder-volume iscsitarget open-iscsi iscsitarget-dkms python-cinderclient nova-network
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
|
||||||
useradd -G admin -m quantum -s /bin/false
|
useradd -G admin -m quantum -s /bin/false
|
||||||
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
install_packages \
|
||||||
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
python-pip git-core python-setuptools python-dev python-lxml python-netaddr \
|
||||||
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
python-pastescript python-pastedeploy python-paste python-sqlalchemy \
|
||||||
python-greenlet python-routes python-simplejson python-webob rabbitmq-server
|
python-greenlet python-routes python-simplejson python-webob rabbitmq-server
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
B#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install salt-master
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages salt-master
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install salt-minion
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages salt-minion
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get -y install swift rsync memcached python-netifaces python-xattr python-memcache
|
source /lib/diskimage-builder/elements-functions
|
||||||
|
install_packages swift rsync memcached python-netifaces python-xattr python-memcache
|
||||||
|
|
||||||
|
|||||||
24
lib/elements-functions
Normal file
24
lib/elements-functions
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Copyright 2012 Hewlett-Packard Development Company, L.P.
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# install_packages package [package ...]
|
||||||
|
function install_packages() {
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
http_proxy=$http_proxy https_proxy=$https_proxy \
|
||||||
|
no_proxy=$no_proxy \
|
||||||
|
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes install "$@"
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ function ensure_nbd () {
|
|||||||
NBD=`which qemu-nbd` || true
|
NBD=`which qemu-nbd` || true
|
||||||
if [ -z "$NBD" ]; then
|
if [ -z "$NBD" ]; then
|
||||||
echo "Need qemu-nbd to build qcow2 files."
|
echo "Need qemu-nbd to build qcow2 files."
|
||||||
sudo apt-get install qemu-utils
|
sudo install_packages qemu-utils
|
||||||
fi
|
fi
|
||||||
# prep nbd for mounting
|
# prep nbd for mounting
|
||||||
(lsmod | grep '^nbd ') || sudo modprobe nbd max_part=16
|
(lsmod | grep '^nbd ') || sudo modprobe nbd max_part=16
|
||||||
@@ -235,6 +235,11 @@ function do_install () {
|
|||||||
function do_extra_package_install () {
|
function do_extra_package_install () {
|
||||||
# Install any packages that were requested with the -p command line option
|
# Install any packages that were requested with the -p command line option
|
||||||
if [ "$INSTALL_PACKAGES" != "" ]; then
|
if [ "$INSTALL_PACKAGES" != "" ]; then
|
||||||
run_in_target apt-get -y install ${INSTALL_PACKAGES[@]}
|
run_in_target install_packages ${INSTALL_PACKAGES[@]}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copy_elements_lib () {
|
||||||
|
sudo mkdir -p $TMP_MOUNT_PATH/lib/diskimage-builder
|
||||||
|
sudo cp $_LIB/elements-functions $TMP_MOUNT_PATH/lib/diskimage-builder
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user