%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/proxy.pyc

�
���^c@@s+dZddlmZmZmZddlZddlZddlZej	e
�ZdZd�Z
d�Zd�Zdd�Zdded	�Zd
d�Zddd
dd�Zd
d
�Zddd
dd�Zd
d�Zddd
dd�Zd
d�Zd
d�Zddd�Zd�ZdS(ul
This module allows you to manage proxy settings

.. code-block:: bash

    salt '*' network.get_http_proxy
i(tabsolute_importtunicode_literalstprint_functionNuproxycC@s2tjjj�s$tjjj�r(tStdfS(u)
    Only work on Mac OS and Windows
    u;Module proxy: module only works on Windows or MacOS systems(tsalttutilstplatformt	is_darwint
is_windowstTruetFalse(((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt__virtual__s$cC@s�i}tddj||��}tjd|�}|dk	r�|j�}|ddkrbtnt}i|d6|dd6|d	d
6}n|S(Nucmd.rununetworksetup -{0} {1}u&Enabled: (.*)
Server: (.*)
Port: (.*)
iuYesuenablediuserveriuport(t__salt__tformattretmatchtNonetgroupsRR	(tcmd_functiontnetwork_servicetrettoutRtgtenabled((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt_get_proxy_osxs&cC@scdj||||�}|dk	rI|dk	rI|dj||�}ntd|�}d|kS(Nunetworksetup -{0} {1} {2} {3}u On {0} {1}ucmd.runuerror(RRR(RtservertporttusertpasswordRtcmdR((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt_set_proxy_osx,s
c
C@sgi}|dkr$dddg}ntdddddd	d
�d}|r�d|kr�|jd
�}x�|D]{}t|�dkr�qond|kr�|jd�\}}n|}d}|jd�\}}i|d6|d6||<qoWnt|�dkr||dSx$|D]}	|	|kr||	=qqWtdddddd	d�ddk|d<|S(Nuhttpuhttpsuftpureg.read_valuethiveuHKEY_CURRENT_USERtkeyu;SOFTWARE\Microsoft\Windows\CurrentVersion\Internet SettingstvnameuProxyServeruvdatau=u;iu:userveruportiuProxyEnableuenabled(RRtsplittlen(
ttypesRtserversR!tstserver_typeRt
proxy_typeRR((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt_get_proxy_windows7s8




c	C@s|dkrdddg}nd}x'|D]}|dj|||�7}q+Wtdddd	d
ddd
|�tdddd	d
ddd
ddd�|dk	r�djdj|��}tdddd	d
ddd
|�n|rd}td|�ntS(Nuhttpuhttpsuftpuu{0}={1}:{2};u
reg.set_valueRuHKEY_CURRENT_USERRu;SOFTWARE\Microsoft\Windows\CurrentVersion\Internet SettingsR uProxyServertvdatauProxyEnableitvtypeu	REG_DWORDu<local>;{0}u;u
ProxyOverrideu$netsh winhttp import proxy source=ieucmd.run(RRRtjoinR(	RRR#tbypass_hoststimport_winhttpt
server_strtttbypass_hosts_strR((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt_set_proxy_windowsbs6




uEthernetcC@s3tddkr tddg�Stddd|�S(u�
    Returns the current http proxy settings

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.get_http_proxy Ethernet
    uosuWindowsR#uhttpRugetwebproxyR(t
__grains__R(R(R((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pytget_http_proxy�sc
C@s]tddkr2td|d|ddgd|�Stdd	d|d|d
|d|d|�S(
u_
    Sets the http proxy settings. Note: On Windows this will override any other
    proxy settings you have, the preferred method of updating proxies on windows
    is using set_proxy.

    server
        The proxy server to use

    port
        The port used by the proxy server

    user
        The username to use for the proxy server if required

    password
        The password to use if required by the server

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    bypass_hosts
        The hosts that are allowed to by pass the proxy. Only used on Windows
        for other OS's use set_proxy_bypass to edit the bypass hosts.

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.set_http_proxy example.com 1080 user=proxy_user password=proxy_pass network_service=Ethernet
    uosuWindowsRRR#uhttpR,RusetwebproxyRRR(R2R1R(RRRRRR,((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pytset_http_proxy�s%	cC@s3tddkr tddg�Stddd|�S(u�
    Returns the current https proxy settings

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.get_https_proxy Ethernet
    uosuWindowsR#uhttpsRugetsecurewebproxyR(R2R(R(R((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pytget_https_proxy�sc
C@s]tddkr2td|d|ddgd|�Stdd	d|d|d
|d|d|�S(
ua
    Sets the https proxy settings. Note: On Windows this will override any other
    proxy settings you have, the preferred method of updating proxies on windows
    is using set_proxy.

    server
        The proxy server to use

    port
        The port used by the proxy server

    user
        The username to use for the proxy server if required

    password
        The password to use if required by the server

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    bypass_hosts
        The hosts that are allowed to by pass the proxy. Only used on Windows
        for other OS's use set_proxy_bypass to edit the bypass hosts.

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.set_https_proxy example.com 1080 user=proxy_user password=proxy_pass network_service=Ethernet
    uosuWindowsRRR#uhttpsR,RusetsecurewebproxyRRR(R2R1R(RRRRRR,((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pytset_https_proxy�s%	cC@s3tddkr tddg�Stddd|�S(u�
    Returns the current ftp proxy settings

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.get_ftp_proxy Ethernet
    uosuWindowsR#uftpRugetftpproxyR(R2R(R(R((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt
get_ftp_proxysc
C@s]tddkr2td|d|ddgd|�Stdd	d|d|d
|d|d|�S(
u�
    Sets the ftp proxy settings

    server
        The proxy server to use

    port
        The port used by the proxy server

    user
        The username to use for the proxy server if required

    password
        The password to use if required by the server

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    bypass_hosts
        The hosts that are allowed to by pass the proxy. Only used on Windows
        for other OS's use set_proxy_bypass to edit the bypass hosts.

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.set_ftp_proxy example.com 1080 user=proxy_user password=proxy_pass network_service=Ethernet
    uosuWindowsRRR#uftpR,RusetftpproxyRRR(R2R1R(RRRRRR,((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt
set_ftp_proxy0s#	cC@s�tddkr\tddddddd	�d
}|dkrCgS|jdd�jd
�Stddj|��}|jd�S(u
    Returns the current domains that can bypass the proxy

    network_service
        The network service to get the bypass domains from, this is only
        necessary on macOS

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.get_proxy_bypass

    uosuWindowsureg.read_valueRuHKEY_CURRENT_USERRu;SOFTWARE\Microsoft\Windows\CurrentVersion\Internet SettingsR u
ProxyOverrideuvdatau<local>uu;ucmd.runu'networksetup -getproxybypassdomains {0}u
N(R2RRtreplaceR!R(Rtreg_valR((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pytget_proxy_bypassas

cC@s;dj|�}dj||�}td|�}d|kS(u[
    Sets the domains that can bypass the proxy

    domains
        An array of domains allowed to bypass the proxy

    network_service
        The network service to apply the changes to, this only necessary on
        macOS

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.set_proxy_bypass "['127.0.0.1', 'localhost']"

    u u+networksetup -setproxybypassdomains {0} {1}ucmd.runuerror(R+RR(tdomainsRtservers_strRR((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pytset_proxy_bypass�sc	C@s3tddkr/td|d|d|d|�SdS(u,
    Sets the http proxy settings, only works with Windows.

    server
        The proxy server to use

    password
        The password to use if required by the server

    types
        The types of proxy connections should be setup with this server. Valid
        types are:

            - ``http``
            - ``https``
            - ``ftp``

    bypass_hosts
        The hosts that are allowed to by pass the proxy.

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.set_http_proxy example.com 1080 types="['http', 'https']"
    uosuWindowsRRR#R,N(R2R1(RRR#R,((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt
set_proxy_win�s
cC@stddkrt�SdS(u�
    Gets all of the proxy settings in one call, only available on Windows

    CLI Example:

    .. code-block:: bash

        salt '*' proxy.get_proxy_win
    uosuWindowsN(R2R((((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt
get_proxy_win�s
(t__doc__t
__future__RRRtloggingR
tsalt.utils.platformRt	getLoggert__name__tlogt__virtualname__R
RRRR(RR1R3R4R5R6R7R8R;R>R?R@(((s6/usr/lib/python2.7/site-packages/salt/modules/proxy.pyt<module>s@			
	-%.., "

Zerion Mini Shell 1.0