%PDF- %PDF-
| Direktori : /proc/thread-self/root/usr/lib/python2.7/site-packages/salt/netapi/rest_cherrypy/ |
| Current File : //proc/thread-self/root/usr/lib/python2.7/site-packages/salt/netapi/rest_cherrypy/wsgi.pyo |
�
���^c @@ sY d Z d d l m Z m Z m Z d d l Z d d l Z d � Z d � Z e � Z d S( u�
Deployment
==========
The ``rest_cherrypy`` netapi module is a standard Python WSGI app. It can be
deployed one of two ways.
:program:`salt-api` using the CherryPy server
---------------------------------------------
The default configuration is to run this module using :program:`salt-api` to
start the Python-based CherryPy server. This server is lightweight,
multi-threaded, encrypted with SSL, and should be considered production-ready.
See the section above for performance expectations.
Using a WSGI-compliant web server
---------------------------------
This module may be deployed on any WSGI-compliant server such as Apache with
mod_wsgi or Nginx with FastCGI, to name just two (there are many).
Note, external WSGI servers handle URLs, paths, and SSL certs directly. The
``rest_cherrypy`` configuration options are ignored and the ``salt-api`` daemon
does not need to be running at all. Remember Salt authentication credentials
are sent in the clear unless SSL is being enforced!
An example Apache virtual host configuration::
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
ServerAdmin webmaster@example.com
LogLevel warn
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
DocumentRoot /var/www/example.com/htdocs
WSGIScriptAlias / /path/to/salt/netapi/rest_cherrypy/wsgi.py
</VirtualHost>
i ( t absolute_importt print_functiont unicode_literalsNc C@ sJ d d l m } d d l } | j j t j j d d � � } | j | � S( uJ
Grab the opts dict of the master config by trying to import Salt
i ( t appNu SALT_MASTER_CONFIGu /etc/salt/master( t salt.netapi.rest_cherrypyR t salt.configt configt
client_configt ost environt gett get_app( R t saltt __opts__( ( sB /usr/lib/python2.7/site-packages/salt/netapi/rest_cherrypy/wsgi.pyt
bootstrap_app7 s
c @ s | � � f d � } | S( u�
Returns a WSGI application function. If you supply the WSGI app and config
it will use that, otherwise it will try to obtain them from a local Salt
installation
c @ sU � p t � \ } } } t j j i d d 6� t j j | d | � t j | | � S( Nu embeddedu environmentu /( R t cherrypyR t updatet treet mount( R t start_responset roott _t conf( t
opts_tuple( sB /usr/lib/python2.7/site-packages/salt/netapi/rest_cherrypy/wsgi.pyt wsgi_appK s ( ( t argsR ( ( R sB /usr/lib/python2.7/site-packages/salt/netapi/rest_cherrypy/wsgi.pyt get_applicationC s (
t __doc__t
__future__R R R R R R R t application( ( ( sB /usr/lib/python2.7/site-packages/salt/netapi/rest_cherrypy/wsgi.pyt <module>. s