
    !h                     \    S r SrSSKrSSKJr  SSKJr  SrSrSr	S	r
S
 rSS jrSS jrS rg)z/Functions for setting up a Samba configuration.restructuredText    N)read_and_sub_file)	setup_dirFULL	SUBDOMAINNT4SYNCDRSc                     [         R                  R                  [        5       U 5      n[         R                  R	                  U5      (       d  [        SU-  5      eU$ )zHReturn an absolute path to the provision template file specified by filez>File [%s] not found. Please install samba-ad-provision package)ospathjoinr   exists	Exception)filer   s     8/usr/lib/python3/dist-packages/samba/provision/common.py
setup_pathr   (   sB    77<<	T*D77>>$X[__``K    c                 v    Uc  S/n[        U[        5      (       d   e[        X5      nU R                  XC5        g)a  Setup a ldb in the private dir.

:param ldb: LDB file to import data into
:param ldif_path: Path of the LDIF file to load
:param subst_vars: Optional variables to substitute in LDIF.
:param nocontrols: Optional list of controls, can be None for no controls
Nrelax:0)
isinstancestrr   add_ldifldb	ldif_path
subst_varscontrolsdatas        r   setup_add_ldifr   0   s:     ;i%%%%Y3DLL r   c                 H    Uc  S/n[        X5      nU R                  XC5        g)zModify a ldb in the private dir.

:param ldb: LDB object.
:param ldif_path: LDIF file path.
:param subst_vars: Optional dictionary with substitution variables.
Nr   )r   modify_ldifr   s        r   setup_modify_ldifr"   ?   s'     ;Y3DOOD#r   c                     U c   eU R                  5          [        XU5        U R                  5         g!   U R                  5         e = f)a  Import a LDIF a file into a LDB handle, optionally substituting
variables.

:note: Either all LDIF data will be added or none (using transactions).

:param ldb: LDB file to import into.
:param ldif_path: Path to the LDIF file.
:param subst_vars: Dictionary with substitution variables.
N)transaction_startr   transaction_committransaction_cancel)r   r   r   s      r   	setup_ldbr'   L   sM     ??!sz2
 	 	 s	   4 A)NN)__doc____docformat__r   sambar   samba.paramr   	FILL_FULLFILL_SUBDOMAINFILL_NT4SYNCFILL_DRSr   r   r"   r'    r   r   <module>r1      s@   4 6" 	 # !	!
$!r   