give install_modules options for loading requirements externally
Use case: Our team would like to use install_modules.sh in other places beyond openstack-infra/config, we would also like to provide some control over what install_modules.sh installs beyond what is given as defaults. * Added a copyright notice so we can use it in other projects * if a modules.env file is found in the same directory as install_modules.sh then source the modules.env * an export called MODULE_ENV_FILE can be included to augment the name of the file from modules.env to an alternative file name like modules.test.env. This gives users of the script an option to provide different modules on different test environments. * as export to change the path from the default directory to an alternate directory can be specified with the export MODULE_ENV_PATH var. The default directory is the same location as the install_modules.sh script. Change-Id: I0c3f9bcb3e91236ceca492426ee6105242a2c8eb
This commit is contained in:
parent
b4b5724a0b
commit
7299bf0326
@ -1,6 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Copyright 2014 OpenStack Foundation.
|
||||||
|
# Copyright 2014 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.
|
||||||
|
|
||||||
MODULE_PATH=/etc/puppet/modules
|
MODULE_PATH=/etc/puppet/modules
|
||||||
|
SCRIPT_NAME=$(basename $0)
|
||||||
|
SCRIPT_DIR=$(readlink -f "$(dirname $0)")
|
||||||
|
|
||||||
function remove_module {
|
function remove_module {
|
||||||
local SHORT_MODULE_NAME=$1
|
local SHORT_MODULE_NAME=$1
|
||||||
@ -27,42 +43,21 @@ fi
|
|||||||
remove_module "gearman" #remove old saz-gearman
|
remove_module "gearman" #remove old saz-gearman
|
||||||
remove_module "limits" # remove saz-limits (required by saz-gearman)
|
remove_module "limits" # remove saz-limits (required by saz-gearman)
|
||||||
|
|
||||||
MODULES["puppetlabs-ntp"]="0.2.0"
|
# load modules.env to populate MODULES[*] and SOURCE_MODULES[*]
|
||||||
|
# for processing.
|
||||||
|
MODULE_ENV_FILE=${MODULE_FILE:-modules.env}
|
||||||
|
MODULE_ENV_PATH=${MODULE_ENV_PATH:-${SCRIPT_DIR}}
|
||||||
|
if [ -f "${MODULE_ENV_PATH}/${MODULE_ENV_FILE}" ] ; then
|
||||||
|
. "${MODULE_ENV_PATH}/${MODULE_ENV_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
# freenode #puppet 2012-09-25:
|
if [ -z "${!MODULES[*]}" ] && [ -z "${!SOURCE_MODULES[*]}" ] ; then
|
||||||
# 18:25 < jeblair> i would like to use some code that someone wrote,
|
echo ""
|
||||||
# but it's important that i understand how the author wants me to use
|
echo "WARNING: nothing to do, unable to find MODULES or SOURCE_MODULES"
|
||||||
# it...
|
echo " export options, try setting MODULE_ENV_PATH or MODULE_ENV_FILE"
|
||||||
# 18:25 < jeblair> in the case of the vcsrepo module, there is
|
echo " export to the proper location of modules.env file."
|
||||||
# ambiguity, and so we are trying to determine what the author(s)
|
echo ""
|
||||||
# intent is
|
exit 0
|
||||||
# 18:30 < jamesturnbull> jeblair: since we - being PL - are the author
|
|
||||||
# - our intent was not to limit it's use and it should be Apache
|
|
||||||
# licensed
|
|
||||||
MODULES["openstackci-vcsrepo"]="0.0.8"
|
|
||||||
|
|
||||||
MODULES["puppetlabs-apache"]="0.0.4"
|
|
||||||
MODULES["puppetlabs-apt"]="1.4.2"
|
|
||||||
MODULES["puppetlabs-haproxy"]="0.4.1"
|
|
||||||
MODULES["puppetlabs-mysql"]="0.6.1"
|
|
||||||
MODULES["puppetlabs-postgresql"]="4.0.0"
|
|
||||||
MODULES["puppetlabs-stdlib"]="4.3.2"
|
|
||||||
MODULES["saz-memcached"]="2.0.2"
|
|
||||||
MODULES["spiette-selinux"]="0.5.1"
|
|
||||||
MODULES["rafaelfc-pear"]="1.0.3"
|
|
||||||
MODULES["puppetlabs-inifile"]="1.0.0"
|
|
||||||
MODULES["puppetlabs-firewall"]="0.0.4"
|
|
||||||
MODULES["puppetlabs-puppetdb"]="3.0.1"
|
|
||||||
MODULES["stankevich-python"]="1.6.6"
|
|
||||||
MODULES["puppetlabs-rabbitmq"]="4.0.0"
|
|
||||||
|
|
||||||
# Source modules should use tags, explicit refs or remote branches because
|
|
||||||
# we do not update local branches in this script.
|
|
||||||
SOURCE_MODULES["https://github.com/puppet-community/puppet-module-puppetboard"]="2.4.0"
|
|
||||||
|
|
||||||
# Add modules that should be part of the openstack-infra integration test here
|
|
||||||
if [[ "$PUPPET_INTEGRATION_TEST" -ne "1" ]]; then
|
|
||||||
SOURCE_MODULES["https://git.openstack.org/openstack-infra/puppet-storyboard"]="origin/master"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MODULE_LIST=`puppet module list`
|
MODULE_LIST=`puppet module list`
|
||||||
|
61
modules.env
Normal file
61
modules.env
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# Copyright 2014 OpenStack Foundation.
|
||||||
|
# Copyright 2014 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.
|
||||||
|
#
|
||||||
|
# load additional modules from modules.env
|
||||||
|
# modules.env should exist in the same folder as install_modules.sh
|
||||||
|
#
|
||||||
|
# - use export MODULE_FILE to specify an alternate config
|
||||||
|
# when calling install_modules.sh.
|
||||||
|
# This allows for testing environments that are configured with alternate
|
||||||
|
# module configuration.
|
||||||
|
|
||||||
|
MODULES["puppetlabs-ntp"]="0.2.0"
|
||||||
|
|
||||||
|
# freenode #puppet 2012-09-25:
|
||||||
|
# 18:25 < jeblair> i would like to use some code that someone wrote,
|
||||||
|
# but it's important that i understand how the author wants me to use
|
||||||
|
# it...
|
||||||
|
# 18:25 < jeblair> in the case of the vcsrepo module, there is
|
||||||
|
# ambiguity, and so we are trying to determine what the author(s)
|
||||||
|
# intent is
|
||||||
|
# 18:30 < jamesturnbull> jeblair: since we - being PL - are the author
|
||||||
|
# - our intent was not to limit it's use and it should be Apache
|
||||||
|
# licensed
|
||||||
|
MODULES["openstackci-vcsrepo"]="0.0.8"
|
||||||
|
|
||||||
|
MODULES["puppetlabs-apache"]="0.0.4"
|
||||||
|
MODULES["puppetlabs-apt"]="1.4.2"
|
||||||
|
MODULES["puppetlabs-haproxy"]="0.4.1"
|
||||||
|
MODULES["puppetlabs-mysql"]="0.6.1"
|
||||||
|
MODULES["puppetlabs-postgresql"]="4.0.0"
|
||||||
|
MODULES["puppetlabs-stdlib"]="4.3.2"
|
||||||
|
MODULES["saz-memcached"]="2.0.2"
|
||||||
|
MODULES["spiette-selinux"]="0.5.1"
|
||||||
|
MODULES["rafaelfc-pear"]="1.0.3"
|
||||||
|
MODULES["puppetlabs-inifile"]="1.0.0"
|
||||||
|
MODULES["puppetlabs-firewall"]="0.0.4"
|
||||||
|
MODULES["puppetlabs-puppetdb"]="3.0.1"
|
||||||
|
MODULES["stankevich-python"]="1.6.6"
|
||||||
|
MODULES["puppetlabs-rabbitmq"]="4.0.0"
|
||||||
|
|
||||||
|
# Source modules should use tags, explicit refs or remote branches because
|
||||||
|
# we do not update local branches in this script.
|
||||||
|
SOURCE_MODULES["https://github.com/puppet-community/puppet-module-puppetboard"]="2.4.0"
|
||||||
|
|
||||||
|
# Add modules that should be part of the openstack-infra integration test here
|
||||||
|
if [[ "$PUPPET_INTEGRATION_TEST" -ne "1" ]]; then
|
||||||
|
SOURCE_MODULES["https://git.openstack.org/openstack-infra/puppet-storyboard"]="origin/master"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user