unify environment conversion
This commit is contained in:
parent
3ce3cf08c8
commit
e7ed1a7afc
1 changed files with 5 additions and 4 deletions
|
@ -522,8 +522,9 @@ class CollectionHandler(BaseHandler):
|
||||||
:type env: dict
|
:type env: dict
|
||||||
"""
|
"""
|
||||||
self.ioloop = tornado.ioloop.IOLoop.instance()
|
self.ioloop = tornado.ioloop.IOLoop.instance()
|
||||||
|
processed_env = self._dict2env(env)
|
||||||
p = process.Subprocess(cmd, close_fds=True, stdin=process.Subprocess.STREAM,
|
p = process.Subprocess(cmd, close_fds=True, stdin=process.Subprocess.STREAM,
|
||||||
stdout=process.Subprocess.STREAM, stderr=process.Subprocess.STREAM, env=env)
|
stdout=process.Subprocess.STREAM, stderr=process.Subprocess.STREAM, env=processed_env)
|
||||||
p.set_exit_callback(lambda returncode: self.on_exit(returncode, cmd, p))
|
p.set_exit_callback(lambda returncode: self.on_exit(returncode, cmd, p))
|
||||||
self.timeout = self.ioloop.add_timeout(datetime.timedelta(seconds=PROCESS_TIMEOUT),
|
self.timeout = self.ioloop.add_timeout(datetime.timedelta(seconds=PROCESS_TIMEOUT),
|
||||||
lambda: self.on_timeout(cmd, p))
|
lambda: self.on_timeout(cmd, p))
|
||||||
|
@ -673,7 +674,7 @@ class EventsHandler(CollectionHandler):
|
||||||
if doc:
|
if doc:
|
||||||
self.send_ws_message('event/%s/tickets/updates' % id_, json.dumps(ret))
|
self.send_ws_message('event/%s/tickets/updates' % id_, json.dumps(ret))
|
||||||
ticket = self._get_ticket_data(ticket_id, doc.get('tickets') or [])
|
ticket = self._get_ticket_data(ticket_id, doc.get('tickets') or [])
|
||||||
env = self._dict2env(ticket)
|
env = dict(ticket)
|
||||||
env.update({'PERSON_ID': ticket_id, 'TICKED_ID': ticket_id, 'EVENT_ID': id_,
|
env.update({'PERSON_ID': ticket_id, 'TICKED_ID': ticket_id, 'EVENT_ID': id_,
|
||||||
'EVENT_TITLE': doc.get('title', ''), 'WEB_USER': self.current_user,
|
'EVENT_TITLE': doc.get('title', ''), 'WEB_USER': self.current_user,
|
||||||
'WEB_REMOTE_IP': self.request.remote_ip})
|
'WEB_REMOTE_IP': self.request.remote_ip})
|
||||||
|
@ -707,7 +708,7 @@ class EventsHandler(CollectionHandler):
|
||||||
data, updateList='tickets', create=False)
|
data, updateList='tickets', create=False)
|
||||||
new_ticket_data = self._get_ticket_data(ticket_query,
|
new_ticket_data = self._get_ticket_data(ticket_query,
|
||||||
doc.get('tickets') or [])
|
doc.get('tickets') or [])
|
||||||
env = self._dict2env(new_ticket_data)
|
env = dict(new_ticket_data)
|
||||||
# always takes the ticket_id from the new ticket
|
# always takes the ticket_id from the new ticket
|
||||||
ticket_id = str(new_ticket_data.get('_id'))
|
ticket_id = str(new_ticket_data.get('_id'))
|
||||||
env.update({'PERSON_ID': ticket_id, 'TICKED_ID': ticket_id, 'EVENT_ID': id_,
|
env.update({'PERSON_ID': ticket_id, 'TICKED_ID': ticket_id, 'EVENT_ID': id_,
|
||||||
|
@ -742,7 +743,7 @@ class EventsHandler(CollectionHandler):
|
||||||
operation='delete',
|
operation='delete',
|
||||||
create=False)
|
create=False)
|
||||||
self.send_ws_message('event/%s/tickets/updates' % id_, json.dumps(ret))
|
self.send_ws_message('event/%s/tickets/updates' % id_, json.dumps(ret))
|
||||||
env = self._dict2env(ticket)
|
env = dict(ticket)
|
||||||
env.update({'PERSON_ID': ticket_id, 'TICKED_ID': ticket_id, 'EVENT_ID': id_,
|
env.update({'PERSON_ID': ticket_id, 'TICKED_ID': ticket_id, 'EVENT_ID': id_,
|
||||||
'EVENT_TITLE': rdoc.get('title', ''), 'WEB_USER': self.current_user,
|
'EVENT_TITLE': rdoc.get('title', ''), 'WEB_USER': self.current_user,
|
||||||
'WEB_REMOTE_IP': self.request.remote_ip})
|
'WEB_REMOTE_IP': self.request.remote_ip})
|
||||||
|
|
Loading…
Reference in a new issue