There are other uses of hard-coded python sitelib paths in various
config files. These should be reviewed and converted to use the
pythonsitelib fact to help ensure the move from RHEL5 to RHEL6 goes
smoothly.
---
Mike McGrath wrote:
commit 2c0c1c94c856adb644560427ed4cd8bbf972105f
Author: Mike McGrath <mmcgrath(a)redhat.com>
Date: Wed Aug 18 15:32:38 2010 -0500
updating for RHEL6 python paths
modules/fas/files/fas.wsgi | 2 +-
modules/fas/manifests/init.pp | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
---
- # TODO: python2.4 should not be hardcoded, make a fact?
- file { "/usr/lib/python2.4/site-packages/fas/fas.wsgi":
+ # TODO: python2.6 should not be hardcoded, make a fact?
+ file { "/usr/lib/python2.6/site-packages/fas/fas.wsgi":
Like this perhaps? I've used this pythonsitelib at home and work and
found it useful.
modules/custom/lib/facter/pythonsitelib.rb | 5 +++++
modules/fas/manifests/init.pp | 9 ++++-----
.../fas-app.conf => templates/fas-app.conf.erb} | 4 ++--
.../fas/{files/fas.wsgi => templates/fas.wsgi.erb} | 2 +-
.../templates/fedoracommunity-prod.ini.erb | 2 +-
5 files changed, 13 insertions(+), 9 deletions(-)
create mode 100644 modules/custom/lib/facter/pythonsitelib.rb
rename modules/fas/{files/fas-app.conf => templates/fas-app.conf.erb} (85%)
rename modules/fas/{files/fas.wsgi => templates/fas.wsgi.erb} (95%)
diff --git a/modules/custom/lib/facter/pythonsitelib.rb
b/modules/custom/lib/facter/pythonsitelib.rb
new file mode 100644
index 0000000..b40a095
--- /dev/null
+++ b/modules/custom/lib/facter/pythonsitelib.rb
@@ -0,0 +1,5 @@
+Facter.add(:pythonsitelib) do
+ setcode do
+ Facter::Util::Resolution.exec('python -c "from distutils.sysconfig
import get_python_lib; print get_python_lib()"')
+ end
+end
diff --git a/modules/fas/manifests/init.pp b/modules/fas/manifests/init.pp
index db428c3..ae7306a 100644
--- a/modules/fas/manifests/init.pp
+++ b/modules/fas/manifests/init.pp
@@ -124,12 +124,11 @@ class fas::app {
value => on,
}
- # TODO: python2.4 should not be hardcoded, make a fact?
- file { "/usr/lib/python2.4/site-packages/fas/fas.wsgi":
+ file { "$pythonsitelib/fas/fas.wsgi":
owner => "root",
group => "root",
mode => 0755,
- source => "puppet:///fas/fas.wsgi",
+ content => template("fas/fas.wsgi"),
require => Package["fas"],
notify => Service["httpd"],
}
@@ -171,7 +170,7 @@ class fas::app {
owner => "root",
group => "root",
mode => 0644,
- source => "puppet:///fas/fas-app.conf",
+ content => template("fas/fas-app.conf.erb"),
require => Package["httpd"],
notify => Service["httpd"],
}
@@ -224,7 +223,7 @@ class fas::app {
require => Package["fas"],
}
- file { "/usr/lib/python2.4/site-packages/fas/config/log.cfg":
+ file { "$pythonsitelib/fas/config/log.cfg":
source => "puppet:///fas/fas-log.cfg",
owner => "root",
group => "root",
diff --git a/modules/fas/files/fas-app.conf b/modules/fas/templates/fas-app.conf.erb
similarity index 85%
rename from modules/fas/files/fas-app.conf
rename to modules/fas/templates/fas-app.conf.erb
index e271a07..8747138 100644
--- a/modules/fas/files/fas-app.conf
+++ b/modules/fas/templates/fas-app.conf.erb
@@ -19,9 +19,9 @@ WSGIRestrictSignal Off
WSGIDaemonProcess fas processes=32 threads=1 maximum-requests=1000 user=fas group=fas
display-name=fas inactivity-timeout=300 shutdown-timeout=10
WSGIPythonOptimize 1
-WSGIScriptAlias /accounts /usr/lib/python2.4/site-packages/fas/fas.wsgi/accounts
+WSGIScriptAlias /accounts <%= pythonsitelib %>/fas/fas.wsgi/accounts
-<Directory /usr/lib/python2.4/site-packages/fas/>
+<Directory <%= pythonsitelib %>/fas/>
WSGIProcessGroup fas
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
diff --git a/modules/fas/files/fas.wsgi b/modules/fas/templates/fas.wsgi.erb
similarity index 95%
rename from modules/fas/files/fas.wsgi
rename to modules/fas/templates/fas.wsgi.erb
index 569d5ac..8f3aa4a 100644
--- a/modules/fas/files/fas.wsgi
+++ b/modules/fas/templates/fas.wsgi.erb
@@ -1,6 +1,6 @@
#!/usr/bin/python
import sys
-sys.path.append('/usr/lib/python2.4/site-packages/fas/')
+sys.path.append('<%= pythonsitelib %>/fas/')
sys.stdout = sys.stderr
import pkg_resources
diff --git a/modules/fedoracommunity/templates/fedoracommunity-prod.ini.erb
b/modules/fedoracommunity/templates/fedoracommunity-prod.ini.erb
index c30af26..4054912 100644
--- a/modules/fedoracommunity/templates/fedoracommunity-prod.ini.erb
+++ b/modules/fedoracommunity/templates/fedoracommunity-prod.ini.erb
@@ -28,7 +28,7 @@ fedoracommunity.mainnav.apps = (MokshaApp('Overview',
'fedoracommunity.overviewr
# The overview application default dashboard layout
fedoracommunity.overview.layout.default = (MokshaApp('Login',
'fedoracommunity.login'))
-fedoracommunity.extensions_dir =
/usr/lib/python2.4/site-packages/fedoracommunity/plugins/extensions
+fedoracommunity.extensions_dir = <%= pythonsitelib
%>/fedoracommunity/plugins/extensions
fedoracommunity.connector.kojihub.baseurl =
http://koji.fedoraproject.org/kojihub
fedoracommunity.connector.bugzilla.baseurl =
https://bugzilla.redhat.com/xmlrpc.cgi
--
1.7.2.1
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL:
www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Life is a gamble at terrible odds -- if it was a bet, you wouldn't
take it.
-- Tom Stoppard, Rosencrantz and Guildenstern Are Dead