Remove virtualenv and install RefStack on system
The stankevich/puppet-python module was causing issues, so this patch removed the dependency on it. Now pip is used to install directly onto the system instead of in a virtualenv. Change-Id: I8f9922ab05429f15cc718561ed3b324ffe8ea746
This commit is contained in:
parent
8f2a27de12
commit
e1482bf068
@ -12,4 +12,3 @@ dependency 'puppetlabs/stdlib', '= 3.2.0'
|
||||
dependency 'puppetlabs/mysql', '= 0.6.1'
|
||||
dependency 'puppetlabs/apache', '= 0.0.4'
|
||||
dependency 'openstackci/vcsrepo', '= 0.0.8'
|
||||
dependency 'stankevich/python', '= 1.6.6'
|
||||
|
@ -23,14 +23,12 @@ class refstack::apache::http () {
|
||||
require ::refstack::app
|
||||
|
||||
# Pull various variables into this module, for slightly saner templates.
|
||||
$install_api_root = $::refstack::params::install_api_root
|
||||
$install_www_root = $::refstack::params::install_www_root
|
||||
$src_www_root = $::refstack::params::src_www_root
|
||||
$hostname = $::refstack::params::hostname
|
||||
$user = $::refstack::params::user
|
||||
$group = $::refstack::params::group
|
||||
$server_admin = $::refstack::params::server_admin
|
||||
$python_version = $::refstack::params::python_version
|
||||
|
||||
# Install apache
|
||||
include ::apache
|
||||
|
@ -23,14 +23,12 @@ class refstack::apache::https () {
|
||||
require ::refstack::app
|
||||
|
||||
# Pull various variables into this module, for slightly saner templates.
|
||||
$install_api_root = $::refstack::params::install_api_root
|
||||
$install_www_root = $::refstack::params::install_www_root
|
||||
$src_www_root = $::refstack::params::src_www_root
|
||||
$hostname = $::refstack::params::hostname
|
||||
$user = $::refstack::params::user
|
||||
$group = $::refstack::params::group
|
||||
$server_admin = $::refstack::params::server_admin
|
||||
$python_version = $::refstack::params::python_version
|
||||
|
||||
$ssl_cert_content = $::refstack::params::ssl_cert_content
|
||||
$ssl_cert = $::refstack::params::ssl_cert
|
||||
|
@ -21,20 +21,10 @@ class refstack::api () {
|
||||
require ::refstack::user
|
||||
|
||||
# Import parameters into local scope.
|
||||
$python_version = $::refstack::params::python_version
|
||||
$src_api_root = $::refstack::params::src_api_root
|
||||
$install_api_root = $::refstack::params::install_api_root
|
||||
$user = $::refstack::params::user
|
||||
$group = $::refstack::params::group
|
||||
|
||||
class { '::python':
|
||||
version => $python_version,
|
||||
pip => true,
|
||||
dev => true,
|
||||
virtualenv => true,
|
||||
}
|
||||
include ::python::install
|
||||
|
||||
# Ensure Git is present
|
||||
if !defined(Package['git']) {
|
||||
package { 'git':
|
||||
@ -42,6 +32,13 @@ class refstack::api () {
|
||||
}
|
||||
}
|
||||
|
||||
# Ensure python-dev is present
|
||||
if !defined(Package['python-dev']) {
|
||||
package { 'python-dev':
|
||||
ensure => present
|
||||
}
|
||||
}
|
||||
|
||||
# Ensure OpenSSL is present
|
||||
if !defined(Package['libssl-dev']) {
|
||||
package { 'libssl-dev':
|
||||
@ -78,29 +75,10 @@ class refstack::api () {
|
||||
require => Package['git']
|
||||
}
|
||||
|
||||
# Create the install directory and virtual environment.
|
||||
file { $install_api_root:
|
||||
ensure => directory,
|
||||
owner => $user,
|
||||
group => $group,
|
||||
}
|
||||
python::virtualenv { $install_api_root:
|
||||
ensure => present,
|
||||
version => $python_version,
|
||||
owner => $user,
|
||||
group => $group,
|
||||
require => [
|
||||
File[$install_api_root],
|
||||
Class['python::install'],
|
||||
],
|
||||
systempkgs => true,
|
||||
}
|
||||
|
||||
# Install RefStack using pip.
|
||||
exec { 'install-refstack':
|
||||
command => "${install_api_root}/bin/pip install ${src_api_root}",
|
||||
user => $user,
|
||||
group => $group,
|
||||
command => "pip install ${src_api_root}",
|
||||
path => '/usr/local/bin:/usr/bin:/bin',
|
||||
refreshonly => true,
|
||||
require => Vcsrepo[$src_api_root],
|
||||
subscribe => Vcsrepo[$src_api_root],
|
||||
@ -109,7 +87,7 @@ class refstack::api () {
|
||||
# Migrate the database.
|
||||
exec { 'migrate-refstack-db':
|
||||
command => 'refstack-manage --config-file /etc/refstack/refstack.conf upgrade --revision head',
|
||||
path => "${install_api_root}/bin/:/usr/local/bin:/usr/bin:/bin/",
|
||||
path => '/usr/local/bin:/usr/bin:/bin',
|
||||
refreshonly => true,
|
||||
subscribe => [
|
||||
Exec['install-refstack'],
|
||||
|
@ -17,7 +17,6 @@
|
||||
# Centralized configuration management for the Refstack module.
|
||||
#
|
||||
class refstack::params (
|
||||
$python_version = '2.7',
|
||||
|
||||
# Source and install directories.
|
||||
$src_api_root = '/opt/refstack-api',
|
||||
@ -51,9 +50,6 @@ class refstack::params (
|
||||
fail("${::operatingsystem} ${::operatingsystemrelease} is not supported.")
|
||||
}
|
||||
|
||||
# Create our install directory with a python-versioned name (because venv).
|
||||
$install_api_root = "/var/lib/refstack-py${python_version}"
|
||||
|
||||
# Build the connection string from individual parameters
|
||||
$mysql_connection_string = "mysql+pymysql://${mysql_user}:${mysql_user_password}@${mysql_host}:${mysql_port}/${mysql_database}"
|
||||
|
||||
|
@ -23,10 +23,6 @@
|
||||
{
|
||||
"name": "openstackci/vcsrepo",
|
||||
"version_requirement": ">= 0.0.8"
|
||||
},
|
||||
{
|
||||
"name": "stankevich/python",
|
||||
"version_requirement": ">= 1.6.6"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
WSGIPythonHome <%= @install_api_root %>
|
||||
|
||||
<VirtualHost <%= @hostname %>:80>
|
||||
<% if !!@server_admin %>
|
||||
ServerAdmin <%= @server_admin %>
|
||||
@ -15,9 +13,6 @@ WSGIPythonHome <%= @install_api_root %>
|
||||
ErrorLog ${APACHE_LOG_DIR}/refstack-error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/refstack-access.log combined
|
||||
|
||||
<Directory "<%= @install_api_root %>">
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Directory "/etc/refstack">
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
@ -1,5 +1,3 @@
|
||||
WSGIPythonHome <%= @install_api_root %>
|
||||
|
||||
<VirtualHost <%= @hostname %>:80>
|
||||
<% if !!@server_admin %>
|
||||
ServerAdmin <%= @server_admin %>
|
||||
@ -53,9 +51,6 @@ WSGIPythonHome <%= @install_api_root %>
|
||||
WSGIScriptAlias /api /etc/refstack/app.wsgi
|
||||
WSGIPassAuthorization On
|
||||
|
||||
<Directory "<%= @install_api_root %>">
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Directory "/etc/refstack">
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
@ -9,6 +9,10 @@ if [ ! -f /etc/apt/sources.list.d/puppetlabs.list ]; then
|
||||
sudo apt-get dist-upgrade -y
|
||||
fi
|
||||
|
||||
# Install pip.
|
||||
wget https://bootstrap.pypa.io/get-pip.py
|
||||
sudo python get-pip.py
|
||||
|
||||
# Create a symlink to the vagrant directory, so puppet can find our module.
|
||||
if [ ! -d /etc/puppet/modules/refstack ]; then
|
||||
sudo ln -s /vagrant /etc/puppet/modules/refstack
|
||||
@ -27,6 +31,3 @@ fi
|
||||
if [ ! -d /etc/puppet/modules/vcsrepo ]; then
|
||||
puppet module install openstackci-vcsrepo --version 0.0.8
|
||||
fi
|
||||
if [ ! -d /etc/puppet/modules/python ]; then
|
||||
puppet module install stankevich-python --version 1.6.6
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user