Файловый менеджер - Редактировать - /usr/lib64/python3.6/site-packages/samba/netcmd/domain/__pycache__/tombstones.cpython-36.pyc
Ðазад
3 �I�d� � @ sn d dl Z d dlZd dljZd dlmZ d dlmZm Z m Z mZ d dlm Z G dd� de�ZG dd� de�ZdS ) � N)�system_session)�Command�CommandError�Option�SuperCommand)�SamDBc @ sb e Zd ZdZdZedddeddd�ed d ed�edd ed�gZdgZ e je je j d�Zdd� ZdS )�cmd_domain_tombstones_expungezZExpunge tombstones from the database. This command expunges tombstones from the database.z%prog NC [NC [...]] [options]z-Hz--URLz%LDB URL for database or target serverZURL�H)�help�type�metavar�destz--current-timezQThe current time to evaluate the tombstone lifetime from, expressed as YYYY-MM-DD)r r z--tombstone-lifetimez2Number of days a tombstone should be preserved forznc*)� sambaopts�credoptsZversionoptsc O s� |j d�}|j d�}|j d�}|j d�}|j d�}|j� }|j|�} t|t� | |d�} |d kr�|d kr�td| jd� td | jd� |d k r�tj|d �}t tj |��}nt tj� �}t|�dkr�| jddt jd gd�} g }x,| d d D ]}|jt|�� q�W nt|�}d}y$| j� d}| j|||d�\}}W n< tk �rj } z|�rP| j� td|��W Y d d }~X nX | j� | jjd||f � d S )Nr r r �current_time�tombstone_lifetime)ZurlZsession_infoZcredentials�lpztNote: without --current-time or --tombstone-lifetime only tombstones already scheduled for deletion will be deleted.)�filez5To remove all tombstones, use --tombstone-lifetime=0.z%Y-%m-%dr � ZnamingContexts)Z expression�baseZscopeZattrsFT)r r z.Failed to expunge / garbage collect tombstonesz-Removed %d objects and %d links successfully )�getZget_loadparmZget_credentialsr r �printZoutf�timeZstrptime�intZmktime�len�search�ldbZ SCOPE_BASE�append�str�listZtransaction_startZgarbage_collect_tombstones� ExceptionZtransaction_cancelr Ztransaction_commit�write)�selfZncs�kwargsr r r Zcurrent_time_stringr r ZcredsZsamdbZcurrent_time_objr �resZncZstarted_transactionZremoved_objectsZ removed_links�err� r&