From e1482bf0683357bf245d75f19e5b1f79ddbcbb86 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Mon, 24 Aug 2015 16:45:45 -0700 Subject: [PATCH] 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 --- Modulefile | 1 - manifests/apache/http.pp | 2 -- manifests/apache/https.pp | 2 -- manifests/api.pp | 42 +++++++----------------------- manifests/params.pp | 4 --- metadata.json | 4 --- templates/refstack_http.vhost.erb | 5 ---- templates/refstack_https.vhost.erb | 5 ---- vagrant.sh | 7 ++--- 9 files changed, 14 insertions(+), 58 deletions(-) diff --git a/Modulefile b/Modulefile index c9dd6cb..4c15674 100644 --- a/Modulefile +++ b/Modulefile @@ -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' diff --git a/manifests/apache/http.pp b/manifests/apache/http.pp index 1ee246d..488bf20 100644 --- a/manifests/apache/http.pp +++ b/manifests/apache/http.pp @@ -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 diff --git a/manifests/apache/https.pp b/manifests/apache/https.pp index c240d9f..ccd0070 100644 --- a/manifests/apache/https.pp +++ b/manifests/apache/https.pp @@ -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 diff --git a/manifests/api.pp b/manifests/api.pp index 2f20e8c..cd4a2fa 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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'], diff --git a/manifests/params.pp b/manifests/params.pp index 3d39a68..528d2b1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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}" diff --git a/metadata.json b/metadata.json index 03494e0..5d0ba5f 100644 --- a/metadata.json +++ b/metadata.json @@ -23,10 +23,6 @@ { "name": "openstackci/vcsrepo", "version_requirement": ">= 0.0.8" - }, - { - "name": "stankevich/python", - "version_requirement": ">= 1.6.6" } ] } diff --git a/templates/refstack_http.vhost.erb b/templates/refstack_http.vhost.erb index d668b66..089dd2c 100644 --- a/templates/refstack_http.vhost.erb +++ b/templates/refstack_http.vhost.erb @@ -1,5 +1,3 @@ -WSGIPythonHome <%= @install_api_root %> - :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 - "> - Require all granted - Require all granted diff --git a/templates/refstack_https.vhost.erb b/templates/refstack_https.vhost.erb index 6a6b954..65444af 100644 --- a/templates/refstack_https.vhost.erb +++ b/templates/refstack_https.vhost.erb @@ -1,5 +1,3 @@ -WSGIPythonHome <%= @install_api_root %> - :80> <% if !!@server_admin %> ServerAdmin <%= @server_admin %> @@ -53,9 +51,6 @@ WSGIPythonHome <%= @install_api_root %> WSGIScriptAlias /api /etc/refstack/app.wsgi WSGIPassAuthorization On - "> - Require all granted - Require all granted diff --git a/vagrant.sh b/vagrant.sh index be676b0..94c827f 100644 --- a/vagrant.sh +++ b/vagrant.sh @@ -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 \ No newline at end of file