executing python-heatclient CLI from Apache python cgi-bin
I have this following code as get_status.py
#!/usr/bin/env python
from cgi import escape
from flup.server.fcgi import WSGIServer
import commands
import subprocess
def do_get_status():
cmd = """/usr/bin/heat --os-username admin --os-password admin --os-tenant-name admin --os-auth-url http://192.168.100.136:35357/v2.0/ stack-show demo_stack"""
status, out = commands.getstatusoutput(cmd)
return "<pre>" + str(out) + "</pre>"
def app(environ, start_response):
# initialise and login to the website
#test = testpost.cookie(target_url,username, password)
qs = environ['QUERY_STRING']
result = do_get_status()
start_response('200 OK', [('Content-Type', 'text/html')])
return result
WSGIServer(app).run()
but when I do http://192.168.0.220/cgi-bin/get_status.py the output I am getting is
Unable to establish connection to http://192.168.100.136:35357/v2.0/tokens
That python script is running in apache cgi-bin. It was perfectly working fine 2 days back, but after updating the openstack stack setup now it stopped working all of a sudden. If I take command and run it on command line I get the expected result. I even tried running same piece of code with python get_status.py and I get the expected results. I am not able to understand what could be the prob.