%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/utils/ |
Current File : //lib/python2.7/site-packages/salt/utils/smtp.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l m Z d d l m Z y d d l Z e Z Wn e k r� e Z n Xe j e � Z d � Z d S( u� Return salt data via email The following fields can be set in the minion conf file: smtp.from (required) smtp.to (required) smtp.host (required) smtp.port (optional, defaults to 25) smtp.username (optional) smtp.password (optional) smtp.tls (optional, defaults to False) smtp.subject (optional, but helpful) smtp.gpgowne' (optional) smtp.fields (optional) smtp.content (optional) There are a few things to keep in mind: * If a username is used, a password is also required. It is recommended (but not required) to use the TLS setting when authenticating. * You should at least declare a subject, but you don't have to. * The use of encryption, i.e. setting gpgowner in your settings, requires python-gnupg to be installed. * The field gpgowner specifies a user's ~/.gpg directory. This must contain a gpg public key matching the address the mail is sent to. If left unset, no encryption will be used. i ( t absolute_importt print_functiont unicode_literalsN( t formatdate( t sixc C@ s2 d } i } x$ | D] } | j | d � | | <q W| j | � | d sW d | d <n t j d | d � t j d | d � t r5| d r5t j d t j j d j | d � � d d g � } | j | d | d � } | j r t j d � t j | � | d <q5t j d � d j | j | j � | d <n d j | d | d t d t � | d | d � } t j d � t j | d t | d � � } | d t k r�| j � t j d � n | d r�| d r�| j | d | d � t j d � n | j | d | d | � t j d � | j � d S( u% Send an email with the data u smtp.tou smtp.fromu smtp.hostu smtp.portu smtp.tlsu smtp.usernameu smtp.passwordu smtp.subjectu smtp.gpgowneru smtp.contentu i u SMTP port has been set to %su smtp_return: Subject is '%s't gnupghomeu ~{0}/.gnupgt optionsu --trust-model alwaysu"