New version of salt-formula from Saltstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

salt-api.wsgi 824B

9 yıl önce
1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python
  2. import cherrypy
  3. import sys
  4. sys.path.append('/srv/salt-api')
  5. from saltapi.netapi.rest_cherrypy import app
  6. def bootstrap_app():
  7. '''
  8. Grab the opts dict of the master config by trying to import Salt
  9. '''
  10. import salt.client
  11. opts = salt.client.LocalClient().opts
  12. return app.get_app(opts)
  13. def get_application(*args):
  14. '''
  15. Returns a WSGI application function. If you supply the WSGI app and config
  16. it will use that, otherwise it will try to obtain them from a local Salt
  17. installation
  18. '''
  19. opts_tuple = args
  20. def wsgi_app(environ, start_response):
  21. root, _, conf = opts_tuple or bootstrap_app()
  22. cherrypy.tree.mount(root, '/', conf)
  23. return cherrypy.tree(environ, start_response)
  24. return wsgi_app
  25. application = get_application()