From 46ebfa525ed7097b050e4a846ca96112f1e234ec Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 2 Aug 2017 14:09:03 -0400 Subject: [PATCH] Switch api server to use system python instead of venv This commit removes the venv handling from the api puppet module. The venv added unecessary complexity to the puppet module and made things a bit fragile. Since this is typically deployed on a standalone server there wasn't really a reason to do this. Change-Id: Ifa3a0c8ece479534115d8905f5faf831d8bb88ae --- manifests/api.pp | 18 +++++++----------- templates/openstack-health-api.vhost.erb | 5 ++--- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index 9e9978c..19d2452 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -42,7 +42,6 @@ class openstack_health::api( } $api_dir = "${source_dir}/openstack_health" - $virtualenv_dir = "${source_dir}/.venv" class { '::python': dev => true, @@ -66,11 +65,6 @@ class openstack_health::api( require => Class['::openstack_health::user'], } - ::python::virtualenv { $virtualenv_dir: - ensure => present, - require => Class['::python'], - } - package {'apache2-utils': ensure => present, } @@ -110,9 +104,9 @@ class openstack_health::api( } exec { 'requirements': - command => "${virtualenv_dir}/bin/pip install -U -r ${source_dir}/requirements.txt", + command => "pip install -U -r ${source_dir}/requirements.txt", + path => '/usr/local/bin:/usr/bin:/bin/', require => [ - Python::Virtualenv[$virtualenv_dir], Package['libmemcached-dev'], Package['cython'], ], @@ -122,9 +116,9 @@ class openstack_health::api( } exec { 'elastic-recheck-install': - command => "${virtualenv_dir}/bin/pip install -U ${elastic_recheck_dir}", + command => "pip install -U ${elastic_recheck_dir}", + path => '/usr/local/bin:/usr/bin:/bin/', require => [ - Python::Virtualenv[$virtualenv_dir], Package['libffi-dev'], ], subscribe => Vcsrepo[$elastic_recheck_dir], @@ -133,8 +127,10 @@ class openstack_health::api( } exec { 'package-application': - command => "${virtualenv_dir}/bin/pip install -e ${source_dir}", + command => "pip install -U ${source_dir}", + path => '/usr/local/bin:/usr/bin:/bin/', refreshonly => true, + require => Exec['elastic-recheck-install'], subscribe => Exec['requirements'], } diff --git a/templates/openstack-health-api.vhost.erb b/templates/openstack-health-api.vhost.erb index 9d6bcc6..8c6c3cd 100644 --- a/templates/openstack-health-api.vhost.erb +++ b/templates/openstack-health-api.vhost.erb @@ -1,7 +1,6 @@ <% unless [443, 80].include?(scope.lookupvar("openstack_health::api::vhost_port").to_i) %> Listen <%= scope.lookupvar("openstack_health::api::vhost_port") %> <% end %> -WSGIPythonHome <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %> > ServerName <%= scope.lookupvar("openstack_health::api::vhost_name") %> ServerAdmin <%= scope.lookupvar("openstack_health::api::server_admin") %> @@ -11,9 +10,9 @@ WSGIPythonHome <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %> ErrorLog ${APACHE_LOG_DIR}/openstack-health-api-error.log WSGIDaemonProcess flask user=openstack_health group=openstack_health threads=5 home=<%= scope.lookupvar("openstack_health::api::source_dir") %> - WSGIScriptAlias / <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %>/bin/openstack-health + WSGIScriptAlias / /usr/local/bin/openstack-health - /bin> + WSGIProcessGroup flask WSGIApplicationGroup %{GLOBAL} WSGIScriptReloading On