Change way of cloning OPM from source
Up to now, we were using a consolidated openstack-puppet-modules repository. Since we are moving to individual packages, that repo will no longer be maintained, and we will switch to cloning the puppet modules themselves. The code to install Puppet modules has been adapted from https://github.com/openstack/puppet-openstack-integration/blob/master/functions, to also benefit from the Zuul cache for OpenStack puppet modules. In the current patch, all Puppet modules are taken from their master branches. This is consistent with the way they are handled in RDO Trunk packaging. Change-Id: I7cc6f5ec138dd7e8d9ef06fc7e59ad8e3d5d58e8
This commit is contained in:
parent
36361ee7cc
commit
f3a5db5991
|
@ -0,0 +1,162 @@
|
|||
moduledir '/usr/share/openstack-puppet/modules'
|
||||
|
||||
## OpenStack modules
|
||||
|
||||
mod 'aodh',
|
||||
:git => 'https://github.com/openstack/puppet-aodh',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'ceilometer',
|
||||
:git => 'https://github.com/openstack/puppet-ceilometer',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'cinder',
|
||||
:git => 'https://github.com/openstack/puppet-cinder',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'glance',
|
||||
:git => 'https://github.com/openstack/puppet-glance',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'gnocchi',
|
||||
:git => 'https://github.com/openstack/puppet-gnocchi',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'heat',
|
||||
:git => 'https://github.com/openstack/puppet-heat',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'horizon',
|
||||
:git => 'https://github.com/openstack/puppet-horizon',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'ironic',
|
||||
:git => 'https://github.com/openstack/puppet-ironic',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'keystone',
|
||||
:git => 'https://github.com/openstack/puppet-keystone',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'manila',
|
||||
:git => 'https://github.com/openstack/puppet-manila',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'neutron',
|
||||
:git => 'https://github.com/openstack/puppet-neutron',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'nova',
|
||||
:git => 'https://github.com/openstack/puppet-nova',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'openstack_extras',
|
||||
:git => 'https://github.com/openstack/puppet-openstack_extras',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'openstacklib',
|
||||
:git => 'https://github.com/openstack/puppet-openstacklib',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'oslo',
|
||||
:git => 'https://github.com/openstack/puppet-oslo',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'sahara',
|
||||
:git => 'https://github.com/openstack/puppet-sahara',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'swift',
|
||||
:git => 'https://github.com/openstack/puppet-swift',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'tempest',
|
||||
:git => 'https://github.com/openstack/puppet-tempest',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'trove',
|
||||
:git => 'https://github.com/openstack/puppet-trove',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'vswitch',
|
||||
:git => 'https://github.com/openstack/puppet-vswitch',
|
||||
:ref => 'master'
|
||||
|
||||
## Non-OpenStack modules
|
||||
|
||||
mod 'apache',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'certmonger',
|
||||
:git => 'https://github.com/rcritten/puppet-certmonger',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'concat',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-concat',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'firewall',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-firewall',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'inifile',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-inifile',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'memcached',
|
||||
:git => 'https://github.com/saz/puppet-memcached',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'mongodb',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-mongodb',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'mysql',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-mysql',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'nssdb',
|
||||
:git => 'https://github.com/rcritten/puppet-nssdb',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'rabbitmq',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'redis',
|
||||
:git => 'https://github.com/arioch/puppet-redis',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'remote',
|
||||
:git => 'https://github.com/paramite/puppet-remote',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'rsync',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-rsync',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'ssh',
|
||||
:git => 'https://github.com/saz/puppet-ssh',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'stdlib',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'sysctl',
|
||||
:git => 'https://github.com/duritong/puppet-sysctl',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'vcsrepo',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-vcsrepo',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'vlan',
|
||||
:git => 'https://github.com/derekhiggins/puppet-vlan',
|
||||
:ref => 'master'
|
||||
|
||||
mod 'xinetd',
|
||||
:git => 'https://github.com/puppetlabs/puppetlabs-xinetd',
|
||||
:ref => 'master'
|
||||
|
|
@ -22,7 +22,10 @@ options have yet to be added.
|
|||
|
||||
## Installation of openstack-puppet-modules (REQUIRED if running packstack from source):
|
||||
|
||||
$ sudo python setup.py install_puppet_modules
|
||||
$ export GEM_HOME=/tmp/somedir
|
||||
$ gem install r10k
|
||||
$ sudo /tmp/somedir/bin/r10k puppetfile install -v
|
||||
$ sudo cp -r packstack/puppet/modules/packstack /usr/share/openstack-puppet/modules
|
||||
|
||||
### Option 1 (all-in-one)
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ def copy_puppet_modules(config, messages):
|
|||
'gnocchi', 'heat', 'horizon', 'inifile', 'ironic',
|
||||
'keystone', 'manila', 'memcached', 'mongodb',
|
||||
'mysql', 'neutron', 'nova', 'nssdb', 'openstack',
|
||||
'openstacklib', 'packstack', 'rabbitmq',
|
||||
'openstacklib', 'oslo', 'packstack', 'rabbitmq',
|
||||
'redis', 'remote', 'rsync', 'sahara', 'ssh',
|
||||
'stdlib', 'swift', 'sysctl', 'tempest', 'trove',
|
||||
'vcsrepo', 'vlan', 'vswitch', 'xinetd', ))
|
||||
|
|
83
run_tests.sh
83
run_tests.sh
|
@ -22,12 +22,82 @@ INSTALL_FROM_SOURCE=${INSTALL_FROM_SOURCE:-true}
|
|||
MANAGE_REPOS=${MANAGE_REPOS:-true}
|
||||
DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7-mitaka/current-passed-ci/delorean.repo}
|
||||
DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7-mitaka/delorean-deps.repo}
|
||||
|
||||
GIT_BASE_URL=${GIT_BASE_URL:-git://git.openstack.org}
|
||||
# If logs should be retrieved automatically
|
||||
COPY_LOGS=${COPY_LOGS:-true}
|
||||
|
||||
|
||||
# Install external Puppet modules with r10k
|
||||
# Uses the following variables:
|
||||
#
|
||||
# - ``GEM_BIN_DIR`` must be set to Gem bin directory
|
||||
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory
|
||||
install_external() {
|
||||
$SUDO ${GEM_BIN_DIR}r10k puppetfile install -v --moduledir ${PUPPETFILE_DIR} --puppetfile Puppetfile1
|
||||
}
|
||||
|
||||
# Install Puppet OpenStack modules with zuul-cloner
|
||||
# Uses the following variables:
|
||||
#
|
||||
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory
|
||||
# - ``ZUUL_REF`` must be set to Zuul ref. Fallback to 'None'.
|
||||
# - ``ZUUL_BRANCH`` must be set to Zuul branch. Fallback to 'master'.
|
||||
# - ``ZUUL_URL`` must be set to Zuul URL
|
||||
install_openstack() {
|
||||
cat > clonemap.yaml <<EOF
|
||||
clonemap:
|
||||
- name: '(.*?)/puppet-(.*)'
|
||||
dest: '$PUPPETFILE_DIR/\2'
|
||||
EOF
|
||||
|
||||
# Periodic jobs run without ref on master
|
||||
ZUUL_REF=${ZUUL_REF:-None}
|
||||
ZUUL_BRANCH=${ZUUL_BRANCH:-master}
|
||||
|
||||
local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
|
||||
Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs
|
||||
)
|
||||
$SUDO /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml \
|
||||
--cache-dir /opt/git \
|
||||
--zuul-ref $ZUUL_REF \
|
||||
--zuul-branch $ZUUL_BRANCH \
|
||||
--zuul-url $ZUUL_URL \
|
||||
$GIT_BASE_URL $project_names
|
||||
}
|
||||
|
||||
# Install all Puppet modules with r10k
|
||||
# Uses the following variables:
|
||||
#
|
||||
# - ``GEM_BIN_DIR`` must be set to Gem bin directory
|
||||
install_all() {
|
||||
$SUDO ${GEM_BIN_DIR}r10k puppetfile install -v --puppetfile Puppetfile
|
||||
}
|
||||
|
||||
# Install Puppet OpenStack modules and dependencies by using
|
||||
# zuul-cloner or r10k.
|
||||
# Uses the following variables:
|
||||
#
|
||||
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory
|
||||
# - ``ZUUL_REF`` must be set to Zuul ref
|
||||
# - ``ZUUL_BRANCH`` must be set to Zuul branch
|
||||
# - ``ZUUL_URL`` must be set to Zuul URL
|
||||
install_modules() {
|
||||
# If zuul-cloner is there, have it install modules using zuul refs
|
||||
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
|
||||
csplit Puppetfile /'Non-OpenStack modules'/ \
|
||||
--prefix Puppetfile \
|
||||
--suffix '%d'
|
||||
install_external
|
||||
install_openstack
|
||||
else
|
||||
install_all
|
||||
fi
|
||||
# Copy the Packstack Puppet module
|
||||
$SUDO cp -r packstack/puppet/modules/packstack ${PUPPETFILE_DIR}
|
||||
}
|
||||
|
||||
if [ $(id -u) != 0 ]; then
|
||||
SUDO='sudo'
|
||||
SUDO='sudo -E'
|
||||
|
||||
# Packstack will connect as root to localhost, set-up the keypair and sshd
|
||||
ssh-keygen -t rsa -C "packstack-integration-test" -N "" -f ~/.ssh/id_rsa
|
||||
|
@ -75,6 +145,7 @@ $SUDO yum -y install puppet \
|
|||
ruby-devel \
|
||||
openstack-selinux \
|
||||
policycoreutils \
|
||||
rubygems \
|
||||
"@Development Tools"
|
||||
|
||||
# Don't assume pip is installed
|
||||
|
@ -124,7 +195,13 @@ fi
|
|||
# Setup packstack
|
||||
if [ "${INSTALL_FROM_SOURCE}" = true ]; then
|
||||
$SUDO pip install .
|
||||
$SUDO python setup.py install_puppet_modules
|
||||
export GEM_BIN_DIR=/tmp/packstackgems/bin/
|
||||
export PUPPETFILE_DIR=/usr/share/openstack-puppet/modules
|
||||
export GEM_HOME=/tmp/packstackgems
|
||||
$SUDO gem install r10k --no-ri --no-rdoc
|
||||
# make sure there is no puppet module pre-installed
|
||||
$SUDO rm -rf "${PUPPETFILE_DIR:?}/"*
|
||||
install_modules
|
||||
else
|
||||
$SUDO yum -y install openstack-packstack
|
||||
fi
|
||||
|
|
64
setup.py
64
setup.py
|
@ -14,74 +14,13 @@
|
|||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools import find_packages
|
||||
from setuptools import Command
|
||||
|
||||
from packstack import version
|
||||
|
||||
|
||||
MODULES_DIR = os.environ.get('PACKSTACK_PUPPETDIR',
|
||||
'/usr/share/openstack-puppet/modules')
|
||||
MODULES_REPO = ('https://github.com/redhat-openstack/'
|
||||
'openstack-puppet-modules.git')
|
||||
MODULES_BRANCH = 'stable/mitaka'
|
||||
|
||||
|
||||
class InstallModulesCommand(Command):
|
||||
description = 'install Puppet modules required to run Packstack'
|
||||
user_options = [
|
||||
('destination=', None, 'Directory where to install modules'),
|
||||
('branch=', None, 'Branch which should be used'),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.destination = None
|
||||
self.branch = None
|
||||
self.repo = MODULES_REPO
|
||||
|
||||
def finalize_options(self):
|
||||
self.destination = self.destination or MODULES_DIR
|
||||
self.branch = self.branch or MODULES_BRANCH
|
||||
|
||||
def run(self):
|
||||
destination = self.destination
|
||||
basedir = os.path.dirname(self.destination.rstrip(' /'))
|
||||
repodir = os.path.basename(self.destination.rstrip(' /'))
|
||||
repo = self.repo
|
||||
branch = self.branch
|
||||
# install third-party modules from openstack-puppet-modules repo
|
||||
if not os.path.exists(self.destination):
|
||||
try:
|
||||
os.makedirs(basedir, 0o755)
|
||||
except OSError:
|
||||
# base directory exists
|
||||
pass
|
||||
print('Cloning %(repo)s to %(destination)s' % locals())
|
||||
cmd = ('cd %(basedir)s; git clone %(repo)s %(repodir)s; '
|
||||
'cd %(repodir)s; git checkout %(branch)s; ' % locals())
|
||||
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = proc.communicate()
|
||||
if proc.returncode:
|
||||
raise RuntimeError('Failed:\n%s' % err)
|
||||
# install Packstack modules
|
||||
module_source = os.path.join(os.path.dirname(__file__),
|
||||
'packstack/puppet/modules')
|
||||
for module in os.listdir(module_source):
|
||||
source = os.path.join(module_source, module)
|
||||
if not os.path.isdir(source):
|
||||
continue
|
||||
|
||||
dest = os.path.join(self.destination, module)
|
||||
print('Copying module %(module)s to %(dest)s' % locals())
|
||||
shutil.rmtree(dest, ignore_errors=True)
|
||||
shutil.copytree(source, dest)
|
||||
|
||||
|
||||
# Utility function to read the README file.
|
||||
# Used for the long_description. It's nice, because now 1) we have a top level
|
||||
# README file and 2) it's easier to type in the README file than to put a raw
|
||||
|
@ -111,6 +50,5 @@ setup(
|
|||
"Topic :: Utilities",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
],
|
||||
scripts=["bin/packstack"],
|
||||
cmdclass={'install_puppet_modules': InstallModulesCommand}
|
||||
scripts=["bin/packstack"]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue