Opened 13 years ago

Closed 12 years ago

#252 closed defect (fixed)

TurboGears FCGI stub needs to be updated for F15

Reported by: geofft Owned by:
Priority: major Milestone: Fedora 15
Component: autoinstallers Keywords:
Cc:

Description

Apparently commands.py is now command.py, so you need this tiny patch to flup.fcgi and everything works:

  • flup.fcgi

     
    1616
    1717sys.path.append(code_dir)
    1818
    19 __import__(package_name+'.commands') # Make sure its requirements get satisfied
     19__import__(package_name+'.command') # Make sure its requirements get satisfied
    2020
    2121# -- END USER EDIT SECTION

But it looks like flup.fcgi is in /mit/scripts/deploy/turbogears.tar.gz and not particularly versioned?

Also, in any case, the app seems to think its root directory is /, not the directory you installed it into.

Change History (19)

comment:1 Changed 13 years ago by xavid

The canonical flup.fcgi is supposed to be in /mit/scripts/deploy/turbogears/flup.fcgi. I haven't touched the autoinstaller in ages, though, and don't remember how they're versioned. Also, unless we have evidence that people are still using TubroGears? 1 on scripts, it might make sense to just retire the autoinstaller.

comment:2 Changed 12 years ago by ezyang

We should convert all existing flups to be symlinks to the canonical version, and fix the canonical version. This should be doable by hand.

comment:3 Changed 12 years ago by andersk

Use wrapper scripts, not symlinks. See #86.

comment:4 Changed 12 years ago by ezyang

There are 21 TG installs.

comment:5 Changed 12 years ago by ezyang

This appears to already be broken in F13:

Traceback (most recent call last):
  File "flup.fcgi", line 19, in <module>
    __import__(package_name+'.commands') # Make sure its requirements get satisfied
ImportError: No module named forms.commands

(from p-b)

comment:6 Changed 12 years ago by ezyang

Also seems to be differently broken on F15 (vanilla install):

Page handler: <bound method Root.index of <tugboat.controllers.Root object at 0x26ae5d0>>
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/CherryPy-2.3.0-py2.7.egg/cherrypy/_cphttptools.py", line 121, in _run
    self.main()
  File "/usr/lib/python2.7/site-packages/CherryPy-2.3.0-py2.7.egg/cherrypy/_cphttptools.py", line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in index
  File "/usr/lib/python2.7/site-packages/turbogears/controllers.py", line 361, in expose
    *args, **kw)
  File "<generated code>", line 0, in run_with_transaction
  File "/usr/lib/python2.7/site-packages/peak/rules/core.py", line 153, in __call__
    return self.body(*args, **kw)
  File "/usr/lib/python2.7/site-packages/turbogears/database.py", line 458, in sa_rwt
    retval = func(*args, **kw)
  File "<generated code>", line 0, in _expose
  File "/usr/lib/python2.7/site-packages/peak/rules/core.py", line 153, in __call__
    return self.body(*args, **kw)
  File "/usr/lib/python2.7/site-packages/turbogears/controllers.py", line 390, in <lambda>
    fragment, options, args, kw)))
  File "/usr/lib/python2.7/site-packages/turbogears/controllers.py", line 451, in _execute_func
    fragment, **options)
  File "/usr/lib/python2.7/site-packages/turbogears/controllers.py", line 100, in _process_output
    headers=headers, fragment=fragment, **options)
  File "/usr/lib/python2.7/site-packages/turbogears/view/base.py", line 203, in render
    return engine.render(**kw)
  File "/usr/lib/python2.7/site-packages/turbogears/view/genshisupport.py", line 31, in render
    return self.transform(info, template).render(**kwargs)
  File "/usr/lib64/python2.7/site-packages/genshi/template/plugin.py", line 156, in transform
    return super(MarkupTemplateEnginePlugin, self).transform(data, template)
  File "/usr/lib64/python2.7/site-packages/genshi/template/plugin.py", line 116, in transform
    template = self.load_template(template)
  File "/usr/lib64/python2.7/site-packages/genshi/template/plugin.py", line 98, in load_template
    return self.loader.load(templatename)
  File "/usr/lib64/python2.7/site-packages/genshi/template/loader.py", line 246, in load
    raise TemplateNotFound(filename, search_path)
TemplateNotFound: Template "/afs/athena.mit.edu/user/e/z/ezyang/web_scripts/footugboat/tugboat/templates/welcome.html" not found

comment:7 Changed 12 years ago by ezyang

Also, converting to an exec doesn't work well with Python module loading:

ezyang@javelin:~/Dev/labs/dell$ cat bar.py
print "baz"
ezyang@javelin:~/Dev/labs/dell$ cat del
#!/bin/sh
exec python /home/ezyang/Dev/labs/dell/subd/foo.py
ezyang@javelin:~/Dev/labs/dell$ cat subd/foo.py 
import bar

print "done"
ezyang@javelin:~/Dev/labs/dell$ ./del 
Traceback (most recent call last):
  File "/home/ezyang/Dev/labs/dell/subd/foo.py", line 1, in <module>
    import bar
ImportError: No module named bar

comment:8 Changed 12 years ago by ezyang

And geofft's "fix" doesn't actually work.

[Sat Nov 05 20:02:24 2011] [error] [client 173.228.28.38] Premature end of script headers: flup.fcgi
Traceback (most recent call last):
  File "flup.fcgi", line 19, in <module>
    __import__(package_name+'.command') # Make sure its requirements get satisfied
ImportError: No module named command

on b-b

comment:9 Changed 12 years ago by ezyang

OK, here's what happened: TurboGears? moved from Kid templates to Genshi templates. So all your template are now not working. Fuuuuu.

comment:10 Changed 12 years ago by ezyang

All we need to do is force usage of Kid templating engine, this is done by editing tg.defaultview = "kid" in config/app.cfg

comment:11 Changed 12 years ago by ezyang

OK, more nuanced view on the situation: it appears to be the case that old installs will still use 'commands.py', but new installs will use 'command.py'. So, we need to test *both*. ImportError? to the rescue.

comment:12 Changed 12 years ago by ezyang

I'm wrong about the "broken on F13", experimental method was wrong.

comment:13 Changed 12 years ago by ezyang

Suggest stub:

{{{#!/bin/sh PYTHONPATH="pwd:$PYTHONPATH" exec /afs/athena.mit.edu/contrib/scripts/deploy/turbogears/flup.fcgi "$@"}}}

comment:14 Changed 12 years ago by ezyang

#!/bin/sh
PYTHONPATH="pwd:$PYTHONPATH" exec /afs/athena.mit.edu/contrib/scripts/deploy/turbogears/flup.fcgi "$@"

comment:15 Changed 12 years ago by ezyang

All non-test TurboGears? parallel-find knows about have been converted.

comment:16 Changed 12 years ago by ezyang

Suggested patch:

diff -ru turbogears/flup.fcgi ../deploy/turbogears/flup.fcgi
--- turbogears/flup.fcgi	2011-11-05 21:44:07.000000000 -0400
+++ ../deploy/turbogears/flup.fcgi	2009-07-08 12:59:08.000000000 -0400
@@ -5,7 +5,6 @@
 
 import os, sys
 from os.path import *
-import imp
 
 from flupconfig import code_dir, package_name
 
@@ -17,14 +16,7 @@
 
 sys.path.append(code_dir)
 
-# Make sure its requirements get satisfied
-old_modname = package_name+'.commands'
-try:
-    imp.find_module(old_modname)
-except ImportError as e:
-    __import__(package_name+'.command')
-else:
-    __import__(old_modname)
+__import__(package_name+'.commands') # Make sure its requirements get satisfied
 
 # -- END USER EDIT SECTION
 
Only in ../deploy/turbogears: .htaccess
Only in ../deploy/turbogears: README
diff -ru turbogears/regen-tar.sh ../deploy/turbogears/regen-tar.sh
--- turbogears/regen-tar.sh	2011-11-05 21:28:30.000000000 -0400
+++ ../deploy/turbogears/regen-tar.sh	2009-07-08 13:04:21.000000000 -0400
@@ -1,3 +1,3 @@
 #!/bin/bash -e
 
-tar -cvzf ../turbogears.tar.gz turbogears
+tar -cvzf ../turbogears.tar.gz .htaccess README flup.fcgi
Only in turbogears: turbogears

comment:17 Changed 12 years ago by ezyang

I actually mean

diff -ru ../deploy/turbogears/flup.fcgi turbogears/flup.fcgi
--- ../deploy/turbogears/flup.fcgi	2009-07-08 12:59:08.000000000 -0400
+++ turbogears/flup.fcgi	2011-11-05 21:44:07.000000000 -0400
@@ -5,6 +5,7 @@
 
 import os, sys
 from os.path import *
+import imp
 
 from flupconfig import code_dir, package_name
 
@@ -16,7 +17,14 @@
 
 sys.path.append(code_dir)
 
-__import__(package_name+'.commands') # Make sure its requirements get satisfied
+# Make sure its requirements get satisfied
+old_modname = package_name+'.commands'
+try:
+    imp.find_module(old_modname)
+except ImportError as e:
+    __import__(package_name+'.command')
+else:
+    __import__(old_modname)
 
 # -- END USER EDIT SECTION
 
Only in ../deploy/turbogears: .htaccess
Only in ../deploy/turbogears: README
diff -ru ../deploy/turbogears/regen-tar.sh turbogears/regen-tar.sh
--- ../deploy/turbogears/regen-tar.sh	2009-07-08 13:04:21.000000000 -0400
+++ turbogears/regen-tar.sh	2011-11-05 21:28:30.000000000 -0400
@@ -1,3 +1,3 @@
 #!/bin/bash -e
 
-tar -cvzf ../turbogears.tar.gz .htaccess README flup.fcgi
+tar -cvzf ../turbogears.tar.gz turbogears
Only in turbogears: turbogears

comment:18 Changed 12 years ago by ezyang

Tested in deploydev (one minor problem: fcgi stub points to the wrong place, but that'll be fine when deployed.) See #261.

comment:19 Changed 12 years ago by ezyang

  • Resolution set to fixed
  • Status changed from new to closed

Deployed.

Note: See TracTickets for help on using tickets.