ó
b=0Yc        	   @   sS  d  Z  d d l Z d d l Z d d l m Z d d l m Z m Z d d d d d	 d
 d d d g	 Z e d g Z	 e	 Z
 d „  Z e ƒ  Z d „  Z d „  Z d „  Z d e d „ Z d d  d „ Z d „  Z d „  Z d „  Z d „  Z d d l m Z e j e Z xH e D]@ Z e e e ƒ r2e  e e ƒ Z! n	 d „  Z! e" e e e! ƒ qWd S(!   s<   
CloudLinux control panel API
API for Hosting control panel
iÿÿÿÿN(   t   NotSupported(   t   CACHE_CPNAMEt   UNKNOWN_CP_NAMEt   cpuserst	   resellerst	   db_accesst   dblogin_cplogin_pairst   cpinfot   get_admin_emailt   docroott   userdomainst   homedirst	   getCPNamec          C   sG   t  }  t j j t ƒ rC t t ƒ } | j ƒ  j ƒ  }  | j ƒ  n  |  S(   N(	   R   t   ost   patht   isfileR   t   opent   readlinet   stript   close(   t   controlpanelnamet   cache_stream(    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR      s    c           C   s   d S(   s®   
    Generates a list of cpusers registered in the control panel

    :return: list of cpusers registered in the control panel
    :rtype: tuple
    :raise: NotSupported
    N(    (    (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   (   s    c           C   s   d S(   s¥   
    Generates a list of resellers in the control panel

    :return: list of cpusers registered in the control panel
    :rtype: tuple
    :raise: NotSupported
    N(    (    (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   3   s    c           C   s   d S(   sõ   
    Getting root access to mysql database.
    For example {'login': 'root', 'db': 'mysql', 'host': 'localhost', 'pass': '9pJUv38sAqqW'}

    :return: root access to mysql database
    :rtype: dict
    :raises: NoDBAccessData, NotSupported
    N(    (    (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   >   s    	c         C   s   d S(   s·  
    Returs a list of pairs, the database user login - user login control panel
    For example:
        (('nata2_someuse', 'nata2'), ('testsome_dfrtbus', 'testsome'))
    :param list|tuple|None cplogin_lst: list of control panel users
    :param bool with_system_users: add system users to dbmapping
    :return: list of pairs, the database user login - user login control panel
    :rtype: tuple
    :raises: NotSupported, NoPackage
    N(    (   t   cplogin_lstt   with_system_users(    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   J   s    t   cplogint   packaget   mailt   resellert   dnsc         C   s   d S(   sú  
    keyls a list of data which is necessary to obtain the user, the values â€‹â€‹can be:
       cplogin - name/login user control panel
       mail - Email users
       reseller - name reseller/owner users
       locale - localization of the user account
       package - User name of the package
       dns - domain of the user
    :param str|unicode|list|tuple|None cpuser: user login
    :return: returns a tuple of tuples of data in the same sequence as specified keys in keylst
    :rtype: tuple
    (    (    (   t   cpusert   keyls(    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   X   s    c           C   s   d S(   s<   
    Gets admin email
    :return: string - admin email
    t    (    (    (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   h   s    c         C   s   d S(   sr   
    Return document root for domain
    :param str|unicode domain:
    :return str: document root for domain
    R   (    (   t   domain(    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR	   p   s    c         C   s   d g S(   sÇ   
    Return domain and document root pairs for control panel user
    first domain is main domain
    :param str|unicode cpuser: user login
    :return list of tuples (domain_name, documen_root)
    (    (    (   R   (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR
   y   s    c           C   s   g  S(   s”   
    Returns list of users' home dirs for particular detected panel
    In case of no panel it returns empty list
    :return list of home dirs
    (    (    (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR   ‚   s    (   t   apic          O   s-   t  t d d t t f ƒ t t j ƒ ‚ d  S(   Nt   not_supports,   "%s" api not supported in "%s" control panel(   t   setattrt	   _api_funct	   _api_namet   CP_NAMER    R"   (   t   argst   kwargs(    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyR$   ‘   s    (   R   R   R   R   R   (#   t   __doc__R   t   syst   cpapiexceptionsR    t   constR   R   t   _API_IMPORTEDt   _API_SUPPORTEDt   __all__R   R&   R   R   R   t   Nonet   FalseR   R   R   R	   R
   R   t   apilinkR!   t
   _apiplugint   modulest   __name__t   _thismoduleR%   t   hasattrt   getattrR$   R#   (    (    (    s;   /usr/lib/python2.7/site-packages/clcommon/cpapi/__init__.pyt   <module>   s4   														