%PDF- %PDF-
Direktori : /lib/python3/dist-packages/samba/netcmd/domain/__pycache__/ |
Current File : //lib/python3/dist-packages/samba/netcmd/domain/__pycache__/functional_prep.cpython-312.pyc |
� �I�dv � � � d dl Z d dlmZ d dlmZ d dlmZmZ d dl m Z mZmZ d dl mZ d dlmZ d dlmZ G d� d e � Zy) � N)�system_session)�DS_DOMAIN_FUNCTION_2008�DS_DOMAIN_FUNCTION_2008_R2)�Command�CommandError�Option)�get_fsmo_roleowner)�SamDB)�functional_levelc �� � e Zd ZdZdZej ej ej d�Z e dddedd� � e d ddd �� e dddd �� e dddg d�dd�� e dd d�� e dd d�� gZd� Z y) �cmd_domain_functional_prepz#Domain functional level preparationz%prog [options])� sambaopts�versionopts�credoptsz-Hz--URLz%LDB URL for database or target server�URL�H)�help�type�metavar�destz-qz--quietzBe quiet� store_true)r �actionz-vz --verbosez Be verbosez--function-level�choice�FUNCTION_LEVEL)�2008_R2�2012�2012_R2�2016z?The functional level to prepare for. Default is (Windows) 2016.r )r r �choicesr �defaultz --forest-prepzJRun the forest prep (by default, both the domain and forest prep are run).)r r z --domain-prepzJRun the domain prep (by default, both the domain and forest prep are run).c � � d}|j d� }|j d� }|j � }|j |� }|j d� }|j d� } t j |� } |j d� } |j d � }t |t � ||� � }|j d� �|j dd� t d � d}| �|�d} d}t j ||j � � } | r4t |t |j! � � d� }| |k7 rt d� �|r2|j# � }d|z }t ||d� }| |k7 rt d� �d }| r^|�\|j% � ddlm} ||d�� }|j+ g d�� |j- | t. d�� |j1 � |rK|�I|j% � ddlm} ||d�� }|j- | t: d�� |j1 � |r|j dd� |�t d|z � �y # t $ r t d|� d�� �w xY w# t2 $ r*}t d|z � |j5 � |}Y d }~��d }~ww xY w# t2 $ r*}t d|z � |j5 � |}Y d }~��d }~ww xY w)NFr r r �function_level�'z1' is not known to Samba as an AD functional level�forest_prep�domain_prep)�url�session_info�credentials�lpzdsdb:schema update allowed�yesz;Temporarily overriding 'dsdb:schema update allowed' settingT�schemaz%This server is not the schema master.zCN=Infrastructure,�infrastructurez-This server is not the infrastructure master.r )�ForestUpdate)�fix)� �6 �O �P �Q �R �S )�update_revisionz Exception: %s)�DomainUpdate�noz%Failed to perform functional prep: %r)�get�get_loadparm�get_credentialsr �string_to_level�KeyErrorr r r �set�print�ldb�Dn�get_dsServiceNamer �str�get_schema_basedn� domain_dn�transaction_start�samba.forest_updater- �check_updates_iterator�check_updates_functional_levelr �transaction_commit� Exception�transaction_cancel�samba.domain_updater7 r )�self�kwargs�updates_allowed_overriddenr r r) �credsr r"