Skip to content
Snippets Groups Projects
Commit 0a689972 authored by Ubuntu's avatar Ubuntu
Browse files

changes to log info

parent 2ccbb25a
No related branches found
No related tags found
No related merge requests found
......@@ -5,11 +5,11 @@ from flask_cors import CORS, cross_origin
from .tunnelstat import SSHSession
app = Flask(__name__)
app.config['LOCAL_DEV'] = True
app.config['LOCAL_DEV'] = False
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'asdasfdfj'
import datetime
app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(seconds=30)
app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(seconds=300)
app.config['SESSION_REFRESH_EACH_REQUEST'] = True
app.config['SESSION_COOKIE_NAME'] = 'tessession'
app.config['TWSPROXY'] = 'http://localhost:4000/'
......@@ -27,9 +27,7 @@ from . import apiendpoints
def after_cleanup_sessions(response):
import logging
logger=logging.getLogger()
logger.debug("in after_cleanup_sessions")
sshsessid = session.get('sshsessid', None)
print("the sshsessid for this request was {}".format(sshsessid))
# kvsessionextension.cleanup_sessions(app)
_ttl = app.config['PERMANENT_SESSION_LIFETIME']
......@@ -39,7 +37,7 @@ def after_cleanup_sessions(response):
ttl = _ttl
for k, sshsess in list(sshsessions.items()):
if datetime.datetime.now() > sshsess.last + ttl:
print("session last seen at {} now {}".format(sshsess.last,datetime.datetime.now()))
logger.debug("session last seen at {} now {}".format(sshsess.last,datetime.datetime.now()))
sshsess.kill()
del sshsessions[k]
return response
......
......@@ -45,6 +45,9 @@ class GetCert(Resource):
resp = sess.post(url, json=data, headers=headers, verify=False)
print("get_cert returned from its external call")
data = resp.json()
import logging
logger = logging.getLogger()
logger.debug('attempted get_cert {}'.format(data))
return data['certificate']
class TestAuth(Resource):
......@@ -224,13 +227,18 @@ class JobSubmit(Resource):
"""
def post(self):
"""starting a job is a post, since it changes the state of the backend"""
import logging
logger=logging.getLogger()
params = get_conn_params()
logger.debug('submitting with parameters {}'.format(params))
sshsess = SSHSession.get_sshsession()
res = Ssh.execute(sshsess, host=params['identity']['site']['host'], user=params['identity']['username'],
cmd=params['interface']['submitcmd'], stdin=params['app']['startscript'])
if not (res['stderr'] == '' or res['stderr'] is None or res['stderr'] == b''):
print(res['stderr'])
logger.debug(res['stderr'])
flask_restful.abort(400, message=res['stderr'].decode())
logger.debug(res['stdout'])
return res['stdout'].decode()
def gen_authtok():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment