Файловый менеджер - Редактировать - /usr/lib64/python3.6/site-packages/samba/netcmd/__pycache__/ou.cpython-36.opt-1.pyc
Ðазад
3 �I�d79 � @ s� d dl jZd dlZd dlmZ d dlmZmZm Z m Z d dlmZ d dl mZ G dd� de�ZG dd � d e�ZG d d� de�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� de �ZdS )� N)�system_session)�Command�CommandError�Option�SuperCommand)�SamDB)� attrgetterc @ sN e Zd ZdZdZedddeddd�gZd d gZe j e je jd�Z dd d�ZdS )� cmd_renamea Rename an organizational unit. The name of the organizational units can be specified as a full DN or without the domainDN component. Examples: samba-tool ou rename 'OU=OrgUnit,DC=samdom,DC=example,DC=com' \ 'OU=NewNameOfOrgUnit,DC=samdom,DC=example,DC=com' samba-tool ou rename 'OU=OrgUnit' 'OU=NewNameOfOrgUnit' The examples show how an administrator would rename an ou 'OrgUnit' to 'NewNameOfOrgUnit'. The new DN would be 'OU=NewNameOfOrgUnit,DC=samdom,DC=example,DC=com' z'%prog <old_ou_dn> <new_ou_dn> [options]z-Hz--URLz%LDB URL for database or target server�URL�H)�help�type�metavar�dest� old_ou_dn� new_ou_dn)� sambaopts�credopts�versionoptsNc . C s< |j � }|j|dd�}t|t� ||d�} y| j|�} W n2 tk rh } ztd||f ��W Y d d }~X nX y| j|�}W n2 tk r� } ztd||f ��W Y d d }~X nX yD| j| dtj g d�} t | �dkr�| jjd | � d S | j | |� W n2 tk �r" } ztd | |��W Y d d }~X nX | jjd| |f � d S )NT)�fallback_machine)�url�session_info�credentials�lpzInvalid old_ou_dn "%s": %szInvalid new_ou_dn "%s": %sz (objectclass=organizationalUnit))�base� expression�scope�attrsr zUnable to find ou "%s" zFailed to rename ou "%s"zRenamed ou "%s" to "%s" )�get_loadparm�get_credentialsr r �normalize_dn_in_domain� Exceptionr �search�ldb� SCOPE_BASE�len�outf�write�rename)�selfr r r r r r r �creds�samdb�full_old_ou_dn�e�full_new_ou_dn�res� r0 �/usr/lib64/python3.6/ou.py�run? s4 zcmd_rename.run)NNNN)�__name__� __module__�__qualname__�__doc__�synopsisr �str� takes_options� takes_args�options�SambaOptions�CredentialsOptions�VersionOptions�takes_optiongroupsr2 r0 r0 r0 r1 r ! s r c @ sN e Zd ZdZdZedddeddd�gZd d gZe j e je jd�Z dd d�ZdS )�cmd_moveai Move an organizational unit. The name of the organizational units can be specified as a full DN or without the domainDN component. Examples: samba-tool ou move 'OU=OrgUnit,DC=samdom,DC=example,DC=com' \ 'OU=NewParentOfOrgUnit,DC=samdom,DC=example,DC=com' samba-tool ou rename 'OU=OrgUnit' 'OU=NewParentOfOrgUnit' The examples show how an administrator would move an ou 'OrgUnit' into the ou 'NewParentOfOrgUnit'. The ou 'OrgUnit' would become a child of the 'NewParentOfOrgUnit' ou. The new DN would be 'OU=OrgUnit,OU=NewParentOfOrgUnit,DC=samdom,DC=example,DC=com' z+%prog <old_ou_dn> <new_parent_dn> [options]z-Hz--URLz%LDB URL for database or target serverr r )r r r r r � new_parent_dn)r r r Nc . C sj |j � }|j|dd�}t|t� ||d�} y| j|�} W n2 tk rh } ztd||f ��W Y d d }~X nX y| j|�}W n2 tk r� } ztd||f ��W Y d d }~X nX tj| t | ��} | j t| �d � | j|� yF| j | dtjg d�}t|�d k�r| jjd | � d S | j| | � W n2 tk �rP } ztd| |��W Y d d }~X nX | jjd| |f � d S ) NT)r )r r r r zInvalid old_ou_dn "%s": %szInvalid new_parent_dn "%s": %s� z (objectclass=organizationalUnit))r r r r r zUnable to find ou "%s" zFailed to move ou "%s"zMoved ou "%s" into "%s" )r r r r r r! r r# �Dnr8 �remove_base_componentsr% Zadd_baser"