+
    iz;  c                   s(   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHtHtH	t	H
t
HtHtHtHtHt ^ RIHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt R
t ! R R]4      t Rt!Rt"Rt# ! R R] 4      t$ ! R R]$4      t% ! R R]$4      t& ! R R] 4      t'R# )i    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)_soszRed Hat Enterprise Linuxc                   s   a a ] tR t^t oRtRR.tRtRtRtRt	Rt
RtRtRtR	tR
tRV 3R llt]V 3R l4       tR tR tR tRtVtV ;t# )RedHatPolicyRed Hatz/var/tmpFZ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/tokenc                s&  < \         SV `  WVVR 7       RV n        \        \        \
        .V P                  VR7      V n        V ;P                  \        .,          un        V P                  P                  V n        V P                  '       g6   \        P                  P                  R4       \        P                  ! ^4       V P!                  V P                  4      V n        V P                  '       d	   RV n        MRV n        V ;P"                  \$        P&                  R,           ,          un        V ;P"                  \$        P&                  R,           ,          un        V P(                  '       g   V P+                  4        V P-                  4        R# )	sysrootinitprobe_runtimeremote_execF)ZprimaryZ	fallbacksZchrootr   z'Could not obtain installed package listz/usr/sbin:/usr/bin:/root/binz'/sbin:/bin:/usr/sbin:/usr/bin:/root/binz/usr/local/binz/usr/local/sbinN)super__init__usrmover   r   r   r   package_managerZvalid_subclassesr    ZpackagespkgssysZstderrZwriteZexitcheck_usrmovePATHosZpathsepr   Zset_exec_pathZload_presetsselfr   r   r   r   	__class__   &&&&&@/usr/lib/python3.14/site-packages/sos/policies/distros/redhat.pyr   ZRedHatPolicy.__init__1   s   '4%0 	 	2 2)01||'	 ) 	,/((11	 yyyJJFGHHQK))$))4<<<6DIADI		RZZ"222			RZZ"333	     c                s6  < V \         Jd   \        \         V `  V4       R # VP                  R4       R\        R\
        R\        R\        /pVP                  4        F9  w  r4\        RV 24      pVP                  RR VR	 VP                  R
 2RR7       K;  	  R # )NzThis policy is a building block for all other Red Hat family distributions. You are likely looking for one of the distributions listed below.
centosrhelZredhatcoreosfedoraz	policies. z>8z<35z<30F)Znewline)r   r   display_distro_helpZadd_textCentOsPolicy
RHELPolicyRedHatCoreOSPolicyFedoraPolicyZitemsr   os_release_name)clsZsectionZsubsZsubcZvalueZsublnr'   s   &&    r)   r/   Z RedHatPolicy.display_distro_helpS   s    l",8A,	
 lJ.l	
  ::<KD9TF+,Er(5+e&;&;C%@A   (r*   c                s    RV9  dG   \         P                  P                  R4      ;'       d     \         P                  P                  R4      # VR,          R,          pV^ ,          R8H  # )a-  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
Z
filesystemz/binz/sbinversionZ3)r$   pathZislink)r&   r    Zfilesys_versions   && r)   r"   ZRedHatPolicy.check_usrmovel   sS     t#77>>&)EEbggnnW.EE|,Y7q!S((r*   c                sx    . pR pV P                   '       d#   V F  pVP                  V! V4      4       K  	  V# V# )zMangle 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    R R.pW9   d*   V \         P                  P                  RV R,          4      3# \        P                  ! RRV 4      3# )z/bin/rpmz
/bin/mailxz/usr:i   NNz(^)(/s?bin)z\1/usr\2)r$   r7   ZjoinreZsub)r7   Z
skip_paths   & r)   transform_pathZ8RedHatPolicy.mangle_package_path.<locals>.transform_path   sH     %l3J!bggll648<==FF>;=??r*   )r   Zextend)r&   ZfilesZpathsr:   Zfs   &&   r)   mangle_package_pathZ RedHatPolicy.mangle_package_path{   s?     	@ <<<^A./ Lr*   c                s.    V'       g   V P                   # V# N)_tmp_dir)r&   Zopt_tmp_dirs   &&r)   get_tmp_dirZRedHatPolicy.get_tmp_dir   s    == r*   )r#   r   r    r   )zDistribution Websitezhttps://www.redhat.com/)zCommercial Supportzhttps://access.redhat.com/NNTN)__name__
__module____qualname____firstlineno__vendorvendor_urlsr=   Z_in_containerZname_patternZ
upload_urlZupload_userZdefault_container_runtimeZsos_pkg_namesos_bin_pathZclient_identifier_urlZtoken_endpointr   classmethodr/   r"   r;   r>   __static_attributes____classdictcell____classcell__r'   Z__classdict__   @@r)   r   r      s     F;<K HMLJK (LLE8N D  0)2 r*   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.
zhttps://api.access.redhat.comzsftp://sftp.access.redhat.comc                   s   a a ] tR t^t oRtRtRt]tRt	]
! R],           R,           4      t]tRtRtR	tRV 3R
 lltR tR tRtVtV ;t# )r1   a   
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   z/etc/redhat-releaser,   a  This command will collect diagnostic and configuration information from this %(os_release_name)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
ZpostNi   @c                sV   < \         SV `  WVVR 7       V P                  \        4       R# r   N)r   r   Zregister_presetsr   r%   r(   r)   r   ZRHELPolicy.__init__   s-    '4%0 	 	2 	l+r*   c                s     V P                   P                  R 4      pV P                  V^ ,          ,          R,          p\        V^ ,          4      #   \         d     R# i ; i)zredhat-release*r6   F)r   all_pkgs_by_name_regexr    intZ	Exception)r&   ZrrZpkgname   &  r)   dist_versionZRHELPolicy.dist_version   sZ    	%%<<=NOBii1&y1G wqz?" 		s   AA AAc                s   R	 F?  pV P                   P                  V R2R4      '       g   K*  V P                  \        4      u # 	  V P	                  R4      e   V P                  \
        4      # V P	                  R4      e   V P                  \        4      # V P	                  R4      e   V P                  \        4      # V P	                  R4      f   V P	                  R4      e   V P                  \        4      # V P	                  R4      e   V P                  \        4      # R
 F-  pV P	                  V4      f   K  V P                  \        4      u # 	  V P                  \        4      # )rescuez.targetFzsatellite-commonzrhosp-releaseZcfmezovirt-engineZvdsmzautomation-controller-server)rS   Z	emergency)zautomation-eda-controllerz automation-eda-controller-server)Zinit_systemZ
is_runningfind_presetr   pkg_by_namer   r   r   r   r
   r	   r   )r&   ZtargetpkgrQ   r)   probe_presetZRHELPolicy.probe_preset   s=   -F**fXW+=uEE''++ . ./;##L11O,8##E**F#/##G,,N+7  (4##C((:;G##M228C$0''//8 %%r*    r?   )r@   rA   rB   rC   __doc__rD   os_release_fileRHEL_RELEASE_STRr4   os_release_id_disclaimer_textmsgRH_SFTP_HOSTZ_upload_urlZ_upload_methodZ_device_tokenZ_max_size_requestr   rR   rW   rH   rI   rJ   rK   rL   r)   r1   r1      sn     4 F+O&OM
   ,, -C KNM",
& &r*   r1   c                   s,    ] tR tRtRtR.tRtRtRtRt	R# )	r0   i  ZCentOSz/etc/centos-releasezCentOS Linuxr+   rX   N)Community Websitezhttps://www.centos.org/)
r@   rA   rB   rC   rD   rE   rZ   r4   r\   rH   rX   r*   r)   r0   r0     s    FCDK+O$OMr*   r0   c                   s   a a ] tR tRt oRtRt]! R],           R,           4      tRt	Rt
RtR	tR
tRtRV 3R llt]RR l4       tR tRR ltR tRtVtV ;t# )r2   i  a  
Red Hat CoreOS is a containerized host built upon Red Hat Enterprise Linux
and as such this policy is built on top of the RHEL policy. For users, this
should be entirely transparent as any behavior exhibited or influenced on
RHEL systems by that policy will be seen on RHCOS systems as well.

The one change is that this policy ensures that sos collect will deploy a
container on RHCOS systems in order to facilitate sos report collection,
as RHCOS discourages non-default package installation via rpm-ostree which
is used to maintain atomicity for RHCOS nodes. The default container image
used by this policy is the support-tools image maintained by Red Hat on
registry.redhat.io.

Note that this policy is only loaded when sos is directly run on an RHCOS
node - if sos collect uses the `oc` transport (the default transport that
will be attempted by the ocp cluster profile), then the policy loaded
inside the launched pod will be RHEL. Again, this is expected and will not
impact how sos report collections are performed.
zRed Hat Enterprise Linux CoreOSzThis command will collect diagnostic and configuration information from this %(os_release_name)s system.

An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative.
rM   Tr   z&registry.redhat.io/rhel8/support-toolsz/hostz
rpm -q sosz/var/lib/kubelet/config.jsonc                ,   < \         SV `  WVVR 7       R# rN   r   r   r%   r(   r)   r   ZRedHatCoreOSPolicy.__init__4      '4%0 	 	2r*   c                s   V'       d   R V9   # Rp\         \        P                  9  d   V# \        P                  \         ,          \        ,           p \	        VRRR7      ;_uu_ 4       pVP                  4       P                  4        F  pW P                  V9   ,          pK  	  RRR4       V#   + '       g   i     T# ; i  \         d     T# i ; i)ZCoreOSFZrzutf-8)ZencodingN)	r   r$   Zenvironr   ZopenZreadZ
splitlinesr4   ZIOError)r5   ZremoteZcoreosZhost_releaseZhfileZlines   &&    r)   checkZRedHatCoreOSPolicy.check:  s     v%%2::-Mzz"23j@	lC'::e!JJL335D11T99F 6 ;  ;:   		s0   C (;B-#C -B>	8C >C CCc                s,    V P                  \        4      # r<   )rT   r   r&      &r)   rW   ZRedHatCoreOSPolicy.probe_presetM  s     &&r*   c                s    T;'       g    V P                   pV'       d   R MRpV P                   RV P                   RV P                   RT RT RT;'       g    R RV 2# )z--pull=always z run -di --name zE --privileged --ipc=host --net=host --pid=host -e HOST=/host -e NAME=z
 -e IMAGE=r.   zr -v /run:/run -v /var/log:/var/log -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -v /:/host )container_imagecontainer_runtimesos_container_name)r&   ZimageZauthZ
force_pullZ_imageZ_pulls   &&&&  r)   create_sos_containerZ'RedHatCoreOSPolicy.create_sos_containerR  s~    ..$..#-2%%& '--. /../ 0HAeW %
 zzrl!F8	%	
r*   c                s     R V P                    2# )zpodman rm --force )rk   rf   rg   r)   set_cleanup_cmdZ"RedHatCoreOSPolicy.set_cleanup_cmdb  s    #D$;$;#<==r*   rX   r?   )rh   )NNF)r@   rA   rB   rC   rY   r4   r]   r^   r_   Zcontainerizedrj   ri   Zsos_path_stripZcontainer_version_commandZcontainer_authfiler   rG   re   rW   rl   rm   rH   rI   rJ   rK   rL   r)   r2   r2     s     ( 8O
   ,, -C M >ON ,72  $'

 > >r*   r2   c                   s\   a a ] tR tRt oRtRtRR.tRtRtRt	Rt
RV 3R lltR	 tR
tVtV ;t# )r3   if  aB  
The policy for Fedora based systems, regardless of spin/edition. This
policy is based on the parent Red Hat policy, and thus will only check for
RPM packages when considering packaged-based plugin enablement. Packages
installed by other sources are not considered.

There is no default --upload location for this policy. If users need to
upload an sos report archive from a Fedora system, they will need to
provide the location via --upload-url, and optionally login credentials
for that location via --upload-user and --upload-pass (or the appropriate
environment variables).
zthe Fedora Projectz/etc/fedora-releasezFedora Linuxr-   z/usr/binc                rb   rN   rc   r%   r(   r)   r   ZFedoraPolicy.__init__}  rd   r*   c                s    V P                  R 4      ;'       g#    V P                  P                  R4      R,          p\        VR,          4      # )zfedora-releasezfedora-release-.*r6   i)rU   r   rO   rP   )r&   rV   r9   r)   fedora_versionZFedoraPolicy.fedora_version  sP    /0 ) )  77#%%') 	 3y>""r*   rX   )ra   zhttps://fedoraproject.org/)zCommunity Forumsz%https://discussion.fedoraproject.org/r?   )r@   rA   rB   rC   rY   rD   rE   rZ   r4   r\   rF   r   rn   rH   rI   rJ   rK   rL   r)   r3   r3   f  sC      "F;EK ,O$OML2# #r*   r3   )(r$   r!   r8   Zsos.report.pluginsr    Zsos.presets.redhatr   r   r   r   r   r   r   r   r	   r
   Zsos.policies.distrosr   r   r   Z!sos.policies.package_managers.rpmr   Z%sos.policies.package_managers.flatpakr   Zsos.policies.package_managersr   Zsos.utilitiesr   r   r   r]   r[   r   r^   ZRH_API_HOSTr`   r1   r0   r2   r3   rX   r*   r)   <module>ro      s    
 
 	 +/ / / K J ? G =   . y; yz
 ..X& X&v: U> U>p!#< !#r*   