Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/facts/hardware/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyo

�
�Udac@`s�ddlmZmZmZeZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZmZddlmZdefd	��YZd
efd��YZdS(i(tabsolute_importtdivisiontprint_functionN(treduce(tbytes_to_human(tget_file_contenttget_mount_size(tHardwaretHardwareCollector(ttimeoutt
SunOSHardwarecB`seeZdZdZd	d�Zd	d�Zd�Zej�d��Z	d�Z
d�Zd�ZRS(
s�
    In addition to the generic memory and cpu facts, this also sets
    swap_reserved_mb and swap_allocated_mb that is available from *swap -s*.
    tSunOSc	C`s�i}idd6dd6dd6|j_|j�}|j�}|j�}|j�}|j�}i}y|j�}Wntj	k
r�nX|j
|�|j
|�|j
|�|j
|�|j
|�|j
|�|S(NtCtLANGtLC_ALLt
LC_NUMERIC(tmoduletrun_command_environ_updatet
get_cpu_factstget_memory_factst
get_dmi_factstget_device_factstget_uptime_factstget_mount_factsR	tTimeoutErrortupdate(	tselftcollected_factsthardware_factst	cpu_factstmemory_factst	dmi_factstdevice_factstuptime_factstmount_facts((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pytpopulate's&!





cC`sd}i}i}|pi}|jjd�\}}}g|d<xb|j�D]T}t|�dkrnqPn|jdd�}	|	dj�}
|
dkr�d}qP|
dkr�|	dj�}qP|
dkr�|	dj�}qP|
d	kr\|p|	dj�}
|jd
�dkr/|
d|d
7}
nd|krHg|d<n|dj|
�qP|
dkrP|	dj�}||kr�d||<q�||cd7<qPqPWt|�dkr�t|�|d<t	d�|j
��|d<nd|d<t|d�|d<|S(Nis/usr/bin/kstat cpu_infot	processorismodule:ttbrandt	clock_MHztimplementationtansible_machineti86pcs @ tMHztansible_processortchip_idtprocessor_countcS`s||S(N((txty((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyt<lambda>tstprocessor_corestNA(Rtrun_commandt
splitlinestlentsplittNonetstriptgettappendRtvalues(RRtphysidtsocketsRtrctoutterrtlinetdatatkeyR&t	clock_mhzR$((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyRDsF
	


c
C`s'i}|jjdg�\}}}x=|j�D]/}d|kr1t|j�d�|d<q1q1W|jjd�\}}}t|j�dd �}t|j�dd �}t|j�d	d �}t|j�d
d �}	|	d|d<|	|d|d
<|d|d<|d|d<|S(Ns/usr/sbin/prtconfsMemory sizeitmemtotal_mbs/usr/sbin/swap -sii����iii
itswapfree_mbtswaptotal_mbtswap_allocated_mbtswap_reserved_mb(RR4R5tintR7(
RRR?R@RARBt	allocatedtreservedtusedtfree((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyR{s!cC`s�i}g|d<td�}|r�x�|j�D]�}|jd�}t|d�}i|dd6|dd6|dd	6|d
d6|dd
6}|j|�|dj|�q/Wn|S(Ntmountss/etc/mnttabs	itmountitdeviceitfstypeitoptionsittime(RR5R7RRR;(RR"tfstabRBtfieldstmount_statvfs_infot
mount_info((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyR�s

c
C`si}|jjd�\}}}d|j�d}|jjdd|g�}|jj|�\}}}|r|jd�d}dd	d
ddg}	d
jttj|	��}
dd|
ddd}tj	||�}|r|j
d�|d<|j
d�|d<qn|S(Ns/usr/bin/uname -is/usr/platform/s/sbintprtdiagtopt_dirss
itFujitsusOracle CorporationtQEMUsSun MicrosystemssVMware, Inc.t|sSystem Configuration:\s+t(s)\s+s(?:sun\w+\s+)?s(.+)it
system_vendoritproduct_name(RR4trstriptget_bin_pathR7tjointmaptretescapetmatchtgroup(
RRR?tplatformRAt
platform_sbintprtdiag_pathR@tsystem_conftvendorst
vendor_regexptsystem_conf_regexptfound((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyR�s&	c`s�i}i|d<idd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6}ddg}x|D]}|jd|�qvWi}|jj|�\}}}|dkr�|Std�|jd�D��}	x�|	D]���fd�|jd�D�}
x}|
D]u}|jd�\}}
|jd �d!}|d	krptt|
��||j|�<q|
j�||j|�<qWd"�}||d|<i}q�W|S(#NtdevicestproducttProducttrevisiontRevisiontserials	Serial NotsizetSizetvendortVendorthard_errorssHard Errorstsoft_errorssSoft Errorsttransport_errorssTransport Errorstmedia_errorssMedia Errortpredictive_failure_analysissPredictive Failure Analysistillegal_requestsIllegal Requests/usr/bin/kstats-ps
sderr:::%sics`s1|]'}|jd�r|jd�dVqdS(tsderrt:iN(t
startswithR7(t.0RB((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pys	<genexpr>�ss
c3`s:|]0}d|kr|jd�d�kr|VqdS(R�iN(R7(R�RB(tinstance(sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pys	<genexpr>�ss	R�itsd(	R;RR4t	frozensetR7RtfloatR:Rb(RR t
disk_statstcmdtdstdR?R@RAtsd_instancestlinesRBttexttvaluetstattdiskname((R�sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyR�sD




"

cC`sbi}|jjd�\}}}|dkr1dSttj�t|jd�d��|d<|S(Ns./usr/bin/kstat -p unix:0:system_misc:boot_timeis	ituptime_seconds(RR4RKRUR7(RR!R?R@RA((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyRs-N(
t__name__t
__module__t__doc__RjR8R#RRR	RRRR(((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyR
 s7		&	=tSunOSHardwareCollectorcB`s#eZeZdZedg�ZRS(RRj(R�R�R
t_fact_classt	_platformtsettrequired_facts(((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyR�s(t
__future__RRRttypet
__metaclass__RfRUtansible.module_utils.six.movesRt+ansible.module_utils.common.text.formattersRt ansible.module_utils.facts.utilsRRt(ansible.module_utils.facts.hardware.baseRRtansible.module_utils.factsR	R
R�(((sM/usr/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/sunos.pyt<module>s�

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]