File: //lib/python3/dist-packages/sos/policies/distros/__pycache__/redhat.cpython-310.pyc
o
([Qhz; � @ s d dl Z d dlZd dlZd dlmZ d dlmZmZmZm Z m
Z
mZmZm
Z
mZmZ d dlmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d d lmZ d
ZG dd� de�Z d
Z!dZ"dZ#G dd� de �Z$G dd� de$�Z%G dd� de$�Z&G dd� de �Z'dS )� N)�RedHatPlugin)
�RHEL_PRESETS�RHV�RHEL�CB�RHOSP�RHOCP�RH_CFME�RH_SATELLITE�AAPEDA�
AAPCONTROLLER)�LinuxPolicy�ENV_HOST_SYSROOT�
OS_RELEASE)�RpmPackageManager)�FlatpakPackageManager)�MultiPackageManager)�bold)�_soszRed Hat Enterprise Linuxc s~ e Zd ZdZddgZdZdZdZdZdZ dZ
d Zd
ZdZ
dZ
d� fdd� Ze� fdd��Zdd� Zdd� Zdd� Z� ZS )�RedHatPolicy�Red Hat)zDistribution Websitezhttps://www.redhat.com/)zCommercial Supportzhttps://access.redhat.com/z/var/tmpF�friendlyN�podman�sosz /usr/sbinzVhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/auth/devicezPhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/tokenTc s� t � j||||d� d| _tttg| j|d�| _| jt g7 _| jj
| _| js3tj
�d� t�d� | �| j�| _| jrAd| _nd| _| jtjd 7 _| jtjd 7 _| js_| �� | �� d S )
N��sysroot�init�
probe_runtime�remote_execF)�primary� fallbacks�chrootr z'Could not obtain installed package list� z/usr/sbin:/usr/bin:/root/binz'/sbin:/bin:/usr/sbin:/usr/bin:/root/binz/usr/local/binz/usr/local/sbin)�super�__init__�usrmover r r r �package_manager�valid_subclassesr �packages�pkgs�sys�stderr�write�exit�
check_usrmove�PATH�os�pathsepr �
set_exec_path�load_presets��selfr r r r �� __class__� �=/usr/lib/python3/dist-packages/sos/policies/distros/redhat.pyr$ 1 s2
��
zRedHatPolicy.__init__c sz | t urtt | ��|� d S |�d� ttttd�}|�� D ]\}}t d|� ��}|jdd�|d�|j
d��dd � qd S )
Nz�This policy is a building block for all other Red Hat family distributions. You are likely looking for one of the distributions listed below.
)�centos�rhel�redhatcoreos�fedoraz policies.� z>8z<35z<30F)�newline)r r# �display_distro_help�add_text�CentOsPolicy�
RHELPolicy�RedHatCoreOSPolicy�FedoraPolicy�itemsr �os_release_name)�cls�section�subs�subc�value�sublnr6 r8 r9 r@ S s$ ����z RedHatPolicy.display_distro_helpc C s8 d|vrt j�d�ot j�d�S |d d }|d dkS )aq Test whether the running system implements UsrMove.
If the 'filesystem' package is present, it will check that the
version is greater than 3. If the package is not present the
'/bin' and '/sbin' paths are checked and UsrMove is assumed
if both are symbolic links.
:param pkgs: a packages dictionary
�
filesystemz/binz/sbin�versionr �3)r0 �path�islink)r5 r) �filesys_versionr8 r8 r9 r. l s
zRedHatPolicy.check_usrmovec C s2 g }dd� }| j r|D ] }|�||�� q|S |S )a2 Mangle paths for post-UsrMove systems.
If the system implements UsrMove, all files will be in
'/usr/[s]bin'. This method substitutes all the /[s]bin
references in the 'files' list with '/usr/[s]bin'.
:param files: the list of package managed files
c S s: ddg}| |v r| t j�d| dd � �fS t�dd| �fS )Nz/bin/rpmz
/bin/mailxz/usrr"