Allow to not manage Tempest code in Puppet

In the case you are using a package, you may want the flexibility to not
use VCS to manage Tempest code and just use the Puppet module to
configure Tempest itself.

Adding a new parameter, true by default to keep backward compatibility.

Change-Id: I6d5c17393630fda156bebc55fe28f97bcabecca4
This commit is contained in:
Emilien Macchi 2014-12-03 14:54:05 -05:00
parent 12cd4dcd68
commit 05fc037265
1 changed files with 57 additions and 48 deletions

View File

@ -6,6 +6,9 @@
# managed in tempest.conf.
#
class tempest(
$install_from_source = true,
$tempest_config_file = '/var/lib/tempest/etc/tempest.conf',
# Clone config
#
$tempest_repo_uri = 'git://github.com/openstack/tempest.git',
@ -72,60 +75,66 @@ class tempest(
include 'tempest::params'
ensure_packages([
'git',
'python-setuptools',
])
if $install_from_source {
ensure_packages([
'git',
'python-setuptools',
])
ensure_packages($tempest::params::dev_packages)
ensure_packages($tempest::params::dev_packages)
exec { 'install-pip':
command => '/usr/bin/easy_install pip',
unless => '/usr/bin/which pip',
require => Package['python-setuptools'],
}
exec { 'install-tox':
command => "${tempest::params::pip_bin_path}/pip install -U tox",
unless => '/usr/bin/which tox',
require => Exec['install-pip'],
}
vcsrepo { $tempest_clone_path:
ensure => 'present',
source => $tempest_repo_uri,
revision => $tempest_repo_revision,
provider => 'git',
require => Package['git'],
user => $tempest_clone_owner,
}
if $setup_venv {
# virtualenv will be installed along with tox
exec { 'setup-venv':
command => "/usr/bin/python ${tempest_clone_path}/tools/install_venv.py",
cwd => $tempest_clone_path,
unless => "/usr/bin/test -d ${tempest_clone_path}/.venv",
require => [
Vcsrepo[$tempest_clone_path],
Exec['install-tox'],
Package[$tempest::params::dev_packages],
],
exec { 'install-pip':
command => '/usr/bin/easy_install pip',
unless => '/usr/bin/which pip',
require => Package['python-setuptools'],
}
}
$tempest_conf = "${tempest_clone_path}/etc/tempest.conf"
exec { 'install-tox':
command => "${tempest::params::pip_bin_path}/pip install -U tox",
unless => '/usr/bin/which tox',
require => Exec['install-pip'],
}
file { $tempest_conf:
replace => false,
source => "${tempest_conf}.sample",
require => Vcsrepo[$tempest_clone_path],
owner => $tempest_clone_owner,
}
vcsrepo { $tempest_clone_path:
ensure => 'present',
source => $tempest_repo_uri,
revision => $tempest_repo_revision,
provider => 'git',
require => Package['git'],
user => $tempest_clone_owner,
}
Tempest_config {
path => $tempest_conf,
require => File[$tempest_conf],
if $setup_venv {
# virtualenv will be installed along with tox
exec { 'setup-venv':
command => "/usr/bin/python ${tempest_clone_path}/tools/install_venv.py",
cwd => $tempest_clone_path,
unless => "/usr/bin/test -d ${tempest_clone_path}/.venv",
require => [
Vcsrepo[$tempest_clone_path],
Exec['install-tox'],
Package[$tempest::params::dev_packages],
],
}
}
$tempest_conf = "${tempest_clone_path}/etc/tempest.conf"
file { $tempest_conf:
replace => false,
source => "${tempest_conf}.sample",
require => Vcsrepo[$tempest_clone_path],
owner => $tempest_clone_owner,
}
Tempest_config {
path => $tempest_conf,
require => File[$tempest_conf],
}
} else {
Tempest_config {
path => $tempest_config_file,
}
}
tempest_config {