![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/sos/policies/distros/__pycache__/ |
o i��d�_ � @ sD d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZm Z m Z mZmZm Z mZmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ zd dlZdZW n ey[ d ZY nw d ZdZdZ G d d� de�Z!dZ"dZ#dZ$G dd� de!�Z%G dd� de%�Z&G dd� de%�Z'G dd� de%�Z(G dd� de'�Z)G dd� de!�Z*dS )� N)�RedHatPlugin) �RHEL_PRESETS�ATOMIC_PRESETS�RHV�RHEL�CB�RHOSP�RHOCP�RH_CFME�RH_SATELLITE�ATOMIC)�LinuxPolicy�ENV_HOST_SYSROOT)�RpmPackageManager)�bold)�_sosTFz/etc/os-releasezRed Hat Enterprise Linux�Atomicc s� e Zd ZdZdZddgZdZdZdZdZ dZ dZd Zd Z dZ d� fd d� Zeddd��Ze� fdd��Zdd� Zdd� Zdd� Z� ZS )�RedHatPolicy�Red Hat)zDistribution Websitezhttps://www.redhat.com/)zCommercial Supportzhttps://access.redhat.com/z/var/tmpFz/opt/rh�friendlyN�podman�sosz /usr/sbinTc s� t t| �j||||d� d| _t| j|d�| _| jtg7 _| jj | _ | j s2tj� d� t�d� | �| j �| _| jr@d| _nd| _| jtjd 7 _| jtjd 7 _| js^| �� | �� d S ) N��sysroot�init� probe_runtime�remote_execF)�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)�superr �__init__�usrmover 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 5 s, �� zRedHatPolicy.__init__� c C � dS )a� This method checks to see if we are running on Red Hat. It must be overriden by concrete subclasses to return True when running on a Fedora, RHEL or other Red Hat distribution or False otherwise. If `remote` is provided, it should be the contents of a remote host's os-release, or comparable, file to be used in place of the locally available one. Fr4 ��cls�remoter4 r4 r5 �checkT s zRedHatPolicy.checkc sl | t urtt | ��|� d S |�d� ttttd�}|D ]}td| �}|jd� d||| j �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�fedorazpolicies.%sz{:>8}{:<35}{:<30}� F)�newline)r r �display_distro_help�add_text�CentOsPolicy� RHELPolicy�RedHatCoreOSPolicy�FedoraPolicyr �format�distro)r9 �section�subs�subc�sublnr2 r4 r5 rB ` s$ ����z RedHatPolicy.display_distro_helpc C s@ d|vrt j�d�ot j�d�S |d d }|d dkrdS dS ) 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 �3TF)r, �path�islink)r1 r% �filesys_versionr4 r4 r5 r* y 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 z(^)(/s?bin)z\1/usr\2)r, rQ �join�re�sub)rQ � skip_pathsr4 r4 r5 �transform_path� s z8RedHatPolicy.mangle_package_path.<locals>.transform_path)r! �extend)r1 �files�pathsrX �fr4 r4 r5 �mangle_package_path� s z RedHatPolicy.mangle_package_pathc C s |s| j S |S �N)�_tmp_dir)r1 �opt_tmp_dirr4 r4 r5 �get_tmp_dir� s zRedHatPolicy.get_tmp_dir�NNTN�r6 )�__name__� __module__�__qualname__rI �vendor�vendor_urlsr_ � _in_container�default_scl_prefix�name_pattern� upload_url�upload_user�default_container_runtime�sos_pkg_name�sos_bin_pathr �classmethodr; rB r* r] ra � __classcell__r4 r4 r2 r5 r $ s2 ��r a[ Any information provided to %(vendor)s will be treated in accordance with the published support policies at: %(vendor_urls)s The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party. No changes will be made to system configuration. zhttps://api.access.redhat.comzsftp://sftp.access.redhat.comc s� e Zd ZdZeZdZede d �Z e ZdZ d� fdd � Z ed dd��Z� fd d�Zdd� Zdd� Zdd� Zdd� Z� fdd�Z� fdd�Zdd� Zdd� Z� ZS )!rE at The RHEL policy is used specifically for Red Hat Enterprise Linux, of any release, and not forks or derivative distributions. For example, this policy will be loaded for any RHEL 8 installation, but will not be loaded for CentOS Stream 8 or Red Hat CoreOS, for which there are separate policies. Plugins activated by installed packages will only be activated if those packages are installed via RPM (dnf/yum inclusive). Packages installed by other means are not considered by this policy. By default, --upload will be directed to using the SFTP location provided by Red Hat for technical support cases. Users who provide login credentials for their Red Hat Customer Portal account will have their archives uploaded to a user-specific directory. If users provide those credentials as well as a case number, --upload will instead attempt to directly upload archives to the referenced case, thus streamlining the process of providing data to technical support engineers. If either or both of the credentials or case number are omitted or are incorrect, then a temporary anonymous user will be used for upload to the SFTP server, and users will need to provide that information to their technical support engineer. This information will be printed at the end of the upload process for any sos report execution. r a This command will collect diagnostic and configuration information from this %(distro)s system and installed applications. An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative. �%(vendor_text)s �postNTc �&