Embed puppet modules necessary for plugin into plugin package
- Specify upstream modules that plugin use in Puppetfile; right now this file is taken from fuel-library/ repository on 05 Feb 2016 - upstream modules that plugin use are: puppet-neutron puppet-nova puppetlabs-stdlib puppetlabs-inifile puppet-openstacklib puppet-keystone - for modules update we utilize modified update_modules.sh script from fuel-library/ - add remove_modules.sh script that will clean repository - hook update_modules.sh and remove_modules.sh into pre_build_hook - add note about puppet-librarian in plugin build guidelines Change-Id: Ib38037c77a981d74c4da0e8d74652b51947e2203
This commit is contained in:
parent
ca8edefd1b
commit
436a11952a
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env ruby
|
||||
#^syntax detection
|
||||
# See https://github.com/bodepd/librarian-puppet-simple for additional docs
|
||||
#
|
||||
# Important information for fuel-library:
|
||||
# With librarian-puppet-simple you *must* remove the existing folder from the
|
||||
# repo prior to trying to run librarian-puppet as it will not remove the folder
|
||||
# for you and you may run into some errors.
|
||||
|
||||
# Pull in puppetlabs-stdlib
|
||||
mod 'stdlib',
|
||||
:git => 'https://review.fuel-infra.org/p/puppet-modules/puppetlabs-stdlib.git',
|
||||
:ref => '4.9.0'
|
||||
|
||||
# Pull in puppet-neutron
|
||||
mod 'neutron',
|
||||
:git => 'https://review.fuel-infra.org/p/puppet-modules/puppet-neutron.git',
|
||||
:ref => '7.0.0-rc7'
|
||||
|
||||
# Pull in puppet-nova
|
||||
mod 'nova',
|
||||
:git => 'https://review.fuel-infra.org/p/puppet-modules/puppet-nova.git',
|
||||
:ref => '7.0.0-mos-rc2'
|
||||
|
||||
# Pull in puppetlabs-inifile
|
||||
mod 'inifile',
|
||||
:git => 'https://review.fuel-infra.org/p/puppet-modules/puppetlabs-inifile.git',
|
||||
:ref => '1.4.2'
|
||||
|
||||
# Pull in puppet-openstacklib
|
||||
mod 'openstacklib',
|
||||
:git => 'https://review.fuel-infra.org/p/puppet-modules/puppet-openstacklib.git',
|
||||
:ref => '7.0.0-mos-rc4'
|
||||
|
||||
# Pull in puppet-keystone
|
||||
mod 'keystone',
|
||||
:git => 'https://review.fuel-infra.org/p/puppet-modules/puppet-keystone.git',
|
||||
:ref => '7.0.0-mos-rc3'
|
|
@ -5,7 +5,7 @@
|
|||
requires: [globals]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/hiera-override.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 120
|
||||
- id: gem-install
|
||||
type: puppet
|
||||
|
@ -23,7 +23,7 @@
|
|||
requires: [top-role-compute]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/compute-vmware-nova-config.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 300
|
||||
- id: openstack-haproxy-nova-metadata-public_vip
|
||||
type: puppet
|
||||
|
@ -32,7 +32,7 @@
|
|||
requires: [openstack-haproxy-nova]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/haproxy-nova-metadata-config.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 120
|
||||
- id: nsxv-install
|
||||
type: puppet
|
||||
|
@ -41,7 +41,7 @@
|
|||
requires: [hiera-override,openstack-network-server-config]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/nsxv-config.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 300
|
||||
- id: openstack-haproxy-neutron-nsxv
|
||||
type: puppet
|
||||
|
@ -87,7 +87,7 @@
|
|||
requires: [openstack-network-neutron-policy]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/neutron-server-start.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 1800
|
||||
- id: openstack-network-networks-nsxv
|
||||
type: puppet
|
||||
|
@ -96,7 +96,7 @@
|
|||
requires: [openstack-network-neutron-start]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/neutron-network-create.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 600
|
||||
- id: horizon-enable-lbaas
|
||||
type: puppet
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ To build the plugin you first need to install fuel-plugin-build 4.0.0[1_]
|
|||
|
||||
$ pip install fuel-plugin-builder==4.0.0
|
||||
|
||||
After that you can build plugin:
|
||||
After that you can build the plugin:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -15,10 +15,20 @@ After that you can build plugin:
|
|||
|
||||
$ cd fuel-plugin-nsxv/
|
||||
|
||||
puppet-librarian_ ruby package is required to installed. It is used to fetch
|
||||
upstream fuel-library_ puppet modules that plugin use. It can be installed via
|
||||
gem package manager:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ gem install puppet-librarian
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ fpb --build .
|
||||
|
||||
fuel-plugin-builder will produce .rpm package of the plugin which you need to upload
|
||||
to Fuel master node:
|
||||
fuel-plugin-builder will produce .rpm package of the plugin which you need to
|
||||
upload to Fuel master node:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -27,3 +37,5 @@ to Fuel master node:
|
|||
nsxv-2.0-2.0.0-1.noarch.rpm
|
||||
|
||||
.. [1] https://pypi.python.org/pypi/fuel-plugin-builder/4.0.0
|
||||
.. _puppet-librarian: https://librarian-puppet.com
|
||||
.. _fuel-library: https://github.com/openstack/fuel-library
|
||||
|
|
|
@ -6,9 +6,20 @@
|
|||
set -eux
|
||||
|
||||
ROOT="$(dirname `readlink -f $0`)"
|
||||
PLUGIN_MOD_DIR="$ROOT/deployment_scripts/puppet/modules/upstream"
|
||||
|
||||
version=$(sed -rn 's/^version:\s*([0-9.])/\1/p' $ROOT/metadata.yaml)
|
||||
name=$(sed -rn 's/^name:\s*(.*)/\1/p' $ROOT/metadata.yaml)
|
||||
|
||||
sed -i "s/'NAME'/'$name'/" $ROOT/deployment_scripts/puppet/manifests/*.pp
|
||||
sed -i "s/'NAME'/'$name'/" $ROOT/deployment_scripts/puppet/modules/nsxv/files/reconf_neutron_with_new_compute.sh
|
||||
|
||||
# Download upstream puppet modules that are not in fuel-library/
|
||||
$ROOT/remove_modules.sh
|
||||
$ROOT/update_modules.sh -d $PLUGIN_MOD_DIR
|
||||
|
||||
# Remove .git directory
|
||||
rm -fr $(find $PLUGIN_MOD_DIR -name '.git' )
|
||||
|
||||
mv $PLUGIN_MOD_DIR/* $(dirname $PLUGIN_MOD_DIR)
|
||||
rmdir $PLUGIN_MOD_DIR
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
# remove all external puppet modules
|
||||
|
||||
PLUGIN_MOD_DIR="deployment_scripts/puppet/modules"
|
||||
|
||||
dir=`dirname $0`
|
||||
cd "${dir}" || exit 1
|
||||
|
||||
cat Puppetfile | grep "^mod '" | awk -F "'" '{ print $2 }' | while read module; do
|
||||
if [ -d "${PLUGIN_MOD_DIR}/${module}" ]; then
|
||||
echo "Remove: ${PLUGIN_MOD_DIR}/${module}"
|
||||
rm -rf "${PLUGIN_MOD_DIR}/${module}"
|
||||
fi
|
||||
done
|
||||
rm -f 'Puppetfile.lock'
|
|
@ -3,7 +3,7 @@
|
|||
type: puppet
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/add-public-key-to-controller.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
puppet_modules: puppet/modules
|
||||
timeout: 120
|
||||
- role: ['compute-vmware']
|
||||
stage: post_deployment/6010
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
#!/bin/bash
|
||||
###############################################################################
|
||||
#
|
||||
# Copyright 2015 Mirantis, 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.
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# update_modules.sh
|
||||
#
|
||||
# This script uses librarian-puppet-simple to populate the puppet folder with
|
||||
# upstream puppet modules. By default, it assumes librarian-puppet-simple is
|
||||
# already available to the environment or it will fail. You can provide command
|
||||
# line options to have the script use bundler to install librarian-puppet-simple
|
||||
# if neccessary.
|
||||
#
|
||||
# Parameters:
|
||||
# -b - Use bundler to install librarian-puppet (optional)
|
||||
# -r - Hard git reset of librarian managed modules back to specified version (optional)
|
||||
# -p <puppet_version> - Puppet version to use with bundler (optional)
|
||||
# -h <bundle_dir> - Folder to be used as the home directory for bundler (optional)
|
||||
# -g <gem_home> - Folder to be used as the gem directory (optional)
|
||||
# -u - Run librarian update (optional)
|
||||
# -v - Verbose printing, turns on set -x (optional)
|
||||
# -? - This usage information
|
||||
#
|
||||
# Variables:
|
||||
# PUPPET_GEM_VERSION - the version of puppet to be pulled down by bundler
|
||||
# Defaults to '3.4.3'
|
||||
# BUNDLE_DIR - The folder to store the bundle gems in.
|
||||
# Defaults to '/var/tmp/.bundle_home'
|
||||
# GEM_HOME - The folder to store the gems in to not require root.
|
||||
# Defaults to '/var/tmp/.gem_home'
|
||||
#
|
||||
# NOTE: These variables can be overriden via bash environment variable with the
|
||||
# same name or via the command line paramters.
|
||||
#
|
||||
# Author: Alex Schultz <aschultz@mirantis.com>
|
||||
#
|
||||
###############################################################################
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename $0) [-b] [-r] [-p <puppet_version>] [-h <bundle_dir>] [-g <gem_home>] [-u] [-?]
|
||||
|
||||
Options:
|
||||
-b - Use bundler instead of assuming librarian-puppet is available
|
||||
-r - Hard git reset of librarian managed modules back to specified version
|
||||
-p <puppet_version> - Puppet version to use with bundler
|
||||
-h <bundle_dir> - Folder to be used as the home directory for bundler
|
||||
-g <gem_home> - Folder to be used as the gem directory
|
||||
-u - Run librarian update
|
||||
-v - Verbose printing of commands
|
||||
-d - Patch where modules to install
|
||||
-? - This usage information
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts ":bp:g:h:vru:d:" opt; do
|
||||
case $opt in
|
||||
b)
|
||||
USE_BUNDLER=true
|
||||
BUNDLER_EXEC="bundle exec"
|
||||
;;
|
||||
p)
|
||||
PUPPET_GEM_VERSION=$OPTARG
|
||||
;;
|
||||
h)
|
||||
BUNDLE_DIR=$OPTARG
|
||||
;;
|
||||
g)
|
||||
GEM_HOME=$OPTARG
|
||||
;;
|
||||
r)
|
||||
RESET_HARD=true
|
||||
;;
|
||||
u)
|
||||
UPDATE=true
|
||||
;;
|
||||
v)
|
||||
VERBOSE='--verbose'
|
||||
set -x
|
||||
;;
|
||||
d)
|
||||
PLUGIN_MOD_DIR=$OPTARG
|
||||
;;
|
||||
\?)
|
||||
usage
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift "$((OPTIND-1))"
|
||||
|
||||
DEPLOYMENT_DIR=$(cd `dirname $0` && pwd -P)
|
||||
# Timeout in seconds for running puppet librarian
|
||||
TIMEOUT=600
|
||||
export PUPPET_GEM_VERSION=${PUPPET_GEM_VERSION:-'3.4.3'}
|
||||
export BUNDLE_DIR=${BUNDLE_DIR:-'/var/tmp/.bundle_home'}
|
||||
export GEM_HOME=${GEM_HOME:-'/var/tmp/.gem_home'}
|
||||
|
||||
# We need to be in the deployment directory to run librarian-puppet-simple
|
||||
cd $DEPLOYMENT_DIR
|
||||
|
||||
if [ "$USE_BUNDLER" = true ]; then
|
||||
# ensure bundler is installed
|
||||
bundle --version
|
||||
|
||||
# update bundler modules
|
||||
bundle update
|
||||
fi
|
||||
|
||||
# if no timeout command, return true so we don't fail this script (LP#1510665)
|
||||
TIMEOUT_CMD=`type -P timeout || true`
|
||||
if [ -n "$TIMEOUT_CMD" ]; then
|
||||
TIMEOUT_CMD="$TIMEOUT_CMD $TIMEOUT"
|
||||
fi
|
||||
|
||||
# Check to make sure if the folder already exists, it has a .git so we can
|
||||
# use git on it. If the mod folder exists, but .git doesn't then remove the mod
|
||||
# folder so it can be properly installed via librarian.
|
||||
for MOD in $(grep "^mod" Puppetfile | tr -d '[:punct:]' | awk '{ print $2 }'); do
|
||||
MOD_DIR="${PLUGIN_MOD_DIR}/${MOD}"
|
||||
if [ -d $MOD_DIR ] && [ ! -d "${MOD_DIR}/.git" ];
|
||||
then
|
||||
rm -rf "${MOD_DIR}"
|
||||
fi
|
||||
done
|
||||
|
||||
# run librarian-puppet install to populate the modules if they do not already
|
||||
# exist
|
||||
$TIMEOUT_CMD $BUNDLER_EXEC librarian-puppet install $VERBOSE --path=${PLUGIN_MOD_DIR}
|
||||
|
||||
# run librarian-puppet update to ensure the modules are checked out to the
|
||||
# correct version
|
||||
if [ "$UPDATE" = true ]; then
|
||||
$TIMEOUT_CMD $BUNDLER_EXEC librarian-puppet update $VERBOSE --path=${PLUGIN_MOD_DIR}
|
||||
fi
|
||||
|
||||
# do a hard reset on the librarian managed modules LP#1489542
|
||||
if [ "$RESET_HARD" = true ]; then
|
||||
for MOD in $(grep "^mod " Puppetfile | tr -d '[:punct:]' | awk '{ print $2 }'); do
|
||||
cd "${PLUGIN_MOD_DIR}/${MOD}"
|
||||
git reset --hard
|
||||
done
|
||||
cd $DEPLOYMENT_DIR
|
||||
fi
|
Loading…
Reference in New Issue