Guest User

Untitled

a guest
Jun 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #!%(apppath)s/python/bin/python
  2.  
  3. import signal
  4.  
  5. from ZEO.ClientStorage import ClientStorage
  6. from ZODB import DB
  7. from ZPublisher.HTTPResponse import HTTPResponse
  8. from ZPublisher.HTTPRequest import HTTPRequest
  9. from ZPublisher.BaseRequest import RequestContainer
  10.  
  11. from Products.BSBDeployTool.DeployTool import deploymentPoll
  12.  
  13. # Hotfix
  14. import Products.BSBDeployTool.DeployTool
  15. Products.BSBDeployTool.DeployTool.ENVIRONMENT_CONFIG = 'Products/BSBDeployTool/environments.conf'
  16.  
  17. run = True
  18. def signal_interrupt(signum, frame):
  19. global run
  20. run = False
  21. signal.signal(signal.SIGINT, signal_interrupt)
  22.  
  23. def run_callback():
  24. global run
  25. return run
  26.  
  27. def getContext(app):
  28. resp = HTTPResponse(stdout=None)
  29. env = {
  30. 'SERVER_NAME':'web-cms-edit.%(env)s.internal',
  31. 'SERVER_PORT':'8080',
  32. 'REQUEST_METHOD':'GET'
  33. }
  34. req = HTTPRequest(None, env, resp)
  35. return app.__of__(RequestContainer(REQUEST = req))
  36.  
  37. def begin():
  38. sharedstorage = ClientStorage(('web-cms-zeo.%(env)s.internal', 9100), storage='shared-state', wait=True)
  39. shareddb = DB(sharedstorage)
  40. sharedconn = shareddb.open()
  41. sharedroot = sharedconn.root()
  42. app = sharedroot['Application']
  43. ctx = getContext(app)
  44. deploymentPoll(ctx, run_callback)
  45.  
  46. if __name__ == '__main__':
  47. begin()
Add Comment
Please, Sign In to add comment