????
| Current Path : /proc/1724857/root/lib/python3.9/site-packages/ipaplatform/redhat/__pycache__/ |
| Current File : //proc/1724857/root/lib/python3.9/site-packages/ipaplatform/redhat/__pycache__/tasks.cpython-39.pyc |
a
�jiwl � @ sF d Z ddlmZmZ ddlZddlZddlZddlmZ ddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZ ddlmZ ddl
mZ ddlmZ dd lmZ dd
lmZ ddlZddlmZ ddlmZ dd
lm Z ddl!m"Z"m#Z# e�$e%�Z&dej'dgfgZ(e�)d�Z*eG dd� de#��Z+G dd� de"�Z,e,� Z-dS )zZ
This module contains default Red Hat OS family-specific implementations of
system tasks.
� )�print_function�absolute_importN)�Path)�find_library)�total_ordering)�CalledProcessError)�PyAsn1Error)�directivesetter)�ipautil)� constants)�paths)�
get_auth_tool)�BaseTaskNamespace�IPAAbstractVersionZsofthsm2z
p11-kit-proxyz�
# auto-generated by IPA installer
[main]
dns={dnsprocessing}
[global-dns]
searches={searches}
[global-dns-domain-*]
servers={servers}
c @ s e Zd ZdZdd� ZdS )�
IPAVersionNc C sH | j }|du r>t�td��}|j}tjtjg|_tj|_|| _ |||�S )z.Lazy load and call librpm's rpmvercmp
NZrpm) �_rpmvercmp_func�ctypesZCDLLr Z rpmvercmpZc_char_p�argtypesZc_intZrestype)�self�a�bZrpmvercmp_funcZlibrpm� r �</usr/lib/python3.9/site-packages/ipaplatform/redhat/tasks.py�_vercmpS s zIPAVersion._vercmp)�__name__�
__module__�__qualname__r r r r r r r O s r c sj e Zd ZdQdd�Zdd� Zejfdd�Zdd � Zd
d� Z dd
� Z
dd� ZdRdd�Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� ZdSd*d+�Zed,d-� �Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Z d:d;� Z!d<d=� Z"d>d?� Z#dd)d@�� fdAdB�
Z$dT� fdCdD� Z%dEdF� Z&dGdH� Z'dIdJ� Z(dKdL� Z)� fdMdN�Z*� fdOdP�Z+� Z,S )U�RedHatTaskNamespaceFc C sN t j}| �� rtj�|�sdS |g}|r2|�d� |�|� tj|dd� dS )a Restore SELinux security context on the given filepath.
SELinux equivalent is /path/to/restorecon <filepath>
restorecon's return values are not reliable so we have to
ignore them (BZ #739604).
ipautil.run() will do the logging.
Nz-FF)Z
raiseonerr) r ZSBIN_RESTORECON�is_selinux_enabled�os�path�exists�appendr
�run)r �filepath�force�
restorecon�argsr r r �restore_contextc s
z#RedHatTaskNamespace.restore_contextc C sD zt �tjg� W n( t jy( Y dS ty: Y dS 0 dS dS )z2Check if SELinux is available and enabled
FTN)r
r# r ZSELINUXENABLEDr �OSError�r r r r r y s z&RedHatTaskNamespace.is_selinux_enabledc C s( | � � sdS tj�|�s$td| ��dS )a�
We don't have a specific package requirement for policycoreutils
which provides restorecon. This is because we don't require
SELinux on client installs. However if SELinux is enabled then
this package is required.
This function returns nothing but may raise a Runtime exception
if SELinux is enabled but restorecon is not available.
FzoSELinux is enabled but %s does not exist.
Install the policycoreutils package and start the installation again.T)r r r r! �RuntimeError)r r&