New version of salt-formula from Saltstack
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

36 lines
824B

  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()