o
    O6uf  ã                   @   sh   d dl Z d dlZd dlmZmZ d dlmZ d dlmZ d dl	m
Z G dd„ deƒZG dd	„ d	eƒZdS )
é    N)ÚRedHatPluginÚ
SuSEPlugin)ÚLinuxPolicy)ÚRpmPackageManager)Ú_sosc                       sR   e Zd ZdZdZdgZdZ		d‡ fdd„	Zedd	d
„ƒZ	dd„ Z
dd„ Z‡  ZS )Ú
SuSEPolicyÚSuSE)zDistribution Websitezhttps://www.suse.com/z/var/tmpNTc                    sŒ   t ƒ j||||d� |  jttg7  _d| _tƒ | _| jjs)| j	 
d¡ t d¡ d| _|  jtjd 7  _|  jtjd 7  _|  ¡  d S )N©ÚsysrootÚinitÚprobe_runtimeÚremote_execFz(Could not obtain installed package list.é   z"/usr/sbin:/usr/bin:/root/bin:/sbinz/usr/local/binz/usr/local/sbin)ÚsuperÚ__init__Úvalid_subclassesr   r   Úusrmover   Úpackage_managerÚpackagesÚui_logÚerrorÚsysÚexitÚPATHÚosÚpathsepÚset_exec_path©Úselfr
   r   r   r   ©Ú	__class__© ú;/usr/lib/python3/dist-packages/sos/policies/distros/suse.pyr      s   
þ
zSuSEPolicy.__init__Ú c                 C   s   dS )zÑThis method checks to see if we are running on SuSE. It must be
        overriden by concrete subclasses to return True when running on an
        OpenSuSE, SLES or other Suse distribution and False otherwise.Fr!   ©ÚclsÚremoter!   r!   r"   Úcheck-   s   zSuSEPolicy.checkc                 C   s   |s| j S |S ©N)Ú_tmp_dir)r   Úopt_tmp_dirr!   r!   r"   Úget_tmp_dir4   s   zSuSEPolicy.get_tmp_dirc                 C   s   |   ¡ S r(   )Ú	host_name)r   r!   r!   r"   Úget_local_name9   s   zSuSEPolicy.get_local_name©NNTN)r#   )Ú__name__Ú
__module__Ú__qualname__ÚdistroÚvendorÚvendor_urlsr)   r   Úclassmethodr'   r+   r-   Ú__classcell__r!   r!   r   r"   r      s    ÿr   c                       sD   e Zd ZdZdZdgZedƒZ		d‡ fdd„	Ze	d	d
„ ƒZ
‡  ZS )ÚOpenSuSEPolicyÚOpenSuSEr   )zCommunity Websitezhttps://www.opensuse.org/aJ  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.

No changes will be made to system configuration.
%(vendor_text)s
NTc                    s   t ƒ j||||d� d S )Nr	   )r   r   r   r   r!   r"   r   N   s   

þzOpenSuSEPolicy.__init__c                 C   s   |r| j |v S tj d¡S )z=This method checks to see if we are running on SuSE.
        z/etc/SUSE-brand)r2   r   ÚpathÚisfiler$   r!   r!   r"   r'   T   s   
zOpenSuSEPolicy.checkr.   )r/   r0   r1   r2   r3   r4   Ú_Úmsgr   r5   r'   r6   r!   r!   r   r"   r7   =   s    ÿr7   )r   r   Úsos.report.pluginsr   r   Úsos.policies.distrosr   Ú!sos.policies.package_managers.rpmr   Úsosr   r;   r   r7   r!   r!   r!   r"   Ú<module>   s   	*