python & ipxe - syntax errors
|
2018-01-04, 15:41
(This post was last modified: 2018-01-04 15:43 by singularity42.)
Post: #1
|
|||
|
|||
python & ipxe - syntax errors
I am setting up a new infrastructure. Previous one used mod_python with the following script to handle some python work and then pass it to ipxe. On the new setup I am using mod_wsgi and I can not seem to get it to work.
Code: <% Before, this would execute the python script and then set the correct settings for the following ipxe script. Now I just seem to get python syntax errors. Any idea whats going on here? If I access it via boot.py: Code: [Thu Jan 04 08:40:31.583620 2018] [:error] [pid 11518] [client 100.91.160.19:55387] mod_wsgi (pid=11518): Exception occurred processing WSGI script '/usr/foremanipxe/boot.py'., referer: http://puppetnext.lab.beer.town:81/ If I access it via just boot: Code: [Thu Jan 04 08:46:24.773479 2018] [authz_core:debug] [pid 11522] mod_authz_core.c(835): [client 100.91.160.19:55457] AH01628: authorization result: granted (no directives) Conf Code: WSGIScriptAlias /boot /usr/foremanipxe/boot.py |
|||
2018-01-04, 22:48
Post: #2
|
|||
|
|||
RE: python & ipxe - syntax errors
I think you would get much better help with this in a forum for wsgi, or maybe python then here, since it's not iPXE specific but rather generic to wsgi, something that I don't know anything about (more then what I have read the last couple of minutes)
It seems that for wsgi you need to rewrite your script to have functions that generate the data, which probably will be quite a bit of work, what I have found so far is this: https://www.python.org/dev/peps/pep-3333...ework-side Use GitHub Discussions VRAM bin |
|||
2018-01-05, 11:45
(This post was last modified: 2018-01-05 11:50 by robinsmidsrod.)
Post: #3
|
|||
|
|||
RE: python & ipxe - syntax errors
As a rule of thumb I always suggest trying out the URL you're trying to get working in iPXE in a web browser. That usually helps you to figure out exactly what is going on and why things are not working. In this particular situation it seems like your Apache configuration is not treating the python code as code, but something else. As NiKiZe mentions, this is a Apache/Python issue that you're probably getting better help for in a Python/Apache forum. The iPXE script code that you want to emit from this python code can be considered just plain-text from the perspective of Apache/Python, which should simplify everything when talking to the Python community.
UPDATE: When I look more closely at your Apache configuration, it seems like you're actually using ExecCGI to run the code (a traditional CGI script), meaning you use mod_cgid, most likely, to execute it. If that is the case, the file should be executable, it should start with #!/usr/bin/env python as the first line of the script and not the <% line at start and the %> at the end of the file. |
|||
2018-01-05, 13:46
Post: #4
|
|||
|
|||
RE: python & ipxe - syntax errors
Thanks both of you. I have since gone back to mod_python. I gave up trying to get wsgi to execute/compile.
Figured I would try the ipxe forum, as every other apache/python forum I went to had no clue on how python + ipxe worked. Figured I would try it from an angle of someone that might have got ipxe and python scripts working. Day 6 straight of this issue, had to try somewhere and this forum has been very helpful in the past. Thanks!! |
|||
2018-01-05, 22:37
Post: #5
|
|||
|
|||
RE: python & ipxe - syntax errors
As Robin mentioned, treat the iPXE script as just text, because that is what it is, and that way "it's not related to iPXE"
Just say that you want the browser to display the #!ipxe as the first line and that it's just text and I'm sure you will be able to get more help from any python forum. Use GitHub Discussions VRAM bin |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)