%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyc

�
���^c@@sTdZddlmZmZmZddlZddlZddlZddl	j
jZddlm
Z
eje�Zidd6ZdZejd��Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zddd�Zd�Zd�Zd�Z d�Z!dd�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(dS(u�
Module for running fmadm and fmdump on Solaris

:maintainer:    Jorge Schrauwen <sjorge@blackdot.be>
:maturity:      new
:platform:      solaris,illumos

.. versionadded:: 2016.3.0
i(tabsolute_importtunicode_literalstprint_functionN(tOrderedDictulistulist_recordsufmadmcC@stjjjd�S(u8
    Looks to see if fmadm is present on the system
    ufmadm(tsalttutilstpathtwhich(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt_check_fmadm!scC@stjjjd�S(u9
    Looks to see if fmdump is present on the system
    ufmdump(RRRR(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt
_check_fmdump)scC@s;tjjj�r(t�r(t�r(tStdjt�fS(u(
    Provides fmadm only on Solaris
    uL{0} module can only be loaded on Solaris with the fault management installed(	RRtplatformtis_sunosRR	t__virtualname__tFalsetformat(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt__virtual__0scC@s�g}|jd�}g|dj�jd�D]}|r/|^q/}|d=x�|D]�}g|jd�D]}|rk|^qk}dj|d|d|d�g|d}t�}x%|D]}||j|�||<q�W|j|�qUW|S(u
    Parses fmdump output
    u
iu u{0} {1} {2}iii(tsplittlowerRRtindextappend(toutputtresulttfieldtheadertentrytitemtfault((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt
_parse_fmdump?s2
(,	
cC@s@g}|jd�}g}i}x�|D]�}|jd�ru|j|�t|�dkr|j|�i}qq(t|�dkr�|j|�tdj|��d}g}q(t|�dkr(d|kr�d|d<n|j�dkr�q(ndj|d|�|d<q(q(Wt|�dkr<|j|�n|S(u&
    Parses fmdump verbose output
    u
uTIMEiiudetailsuu{0}{1}
(Rt
startswithRtlenRtjointstripR(RRRt
verbose_faulttline((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt_parse_fmdump_verboseYs2



	
cC@s'g}|jd�}g|dj�jd�D]}|r/|^q/}|d=x�|D]�}g|jd�D]}|rk|^qk}|dd!dj|d�g}t�}x%|D]}||j|�||<q�W|j|�qUWt�}x+|D]#}|||d<||dd=q�W|}|S(u$
    Parsbb fmdump/fmadm output
    u
iu iumodule(RRRRRR(RRRRRRt	componenttkeyed_result((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt_parse_fmadm_config{s"2
(!	
	
cC@sti}t�}djd|d|d|�}td|�}|d}i}|dkrj|d|d	<nt}|S(
uK
    Internal function for fmadm.repqired, fmadm.replaced, fmadm.flush
    u{cmd} {action} {fmri}tcmdtactiontfmriucmd.run_alluretcodeiustderruError(RRt__salt__tTrue(R'R(trettfmadmR&trestretcodeR((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt_fmadm_action_fmri�s			
cC@s�d�}i}g}i}i}d}x�|jd�D]�}|jd�r�|r7|r7|r7|j|||��g}i}i}q7q�q7n|s�|j|�q7n|r�|r�|j|�tdj|��d}q7n|r7|r7|jd�r(|r(dj|||j��||<q�d|kr�|jd�}|dj�}dj|d�j�||<|d	kr�||||j	d
�jd�dj�|d
<||d||j	d
�!j�||<q�q�q7q7W|j|||��|S(
u#
    Parse fmadm faulty output
    cS@sDi}|d}|d=t�||<|||d<|||d<|S(Nuevent-idusummaryufault(R(tsummaryRRtuuid((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt_merge_data�s

u
u-iu u{0}
{1}u:iuPlatformu
Chassis_idi����N(
tNoneRRtupdateRRRRRR(RR2RR0tsummary_datat
fault_datatdata_keyR!((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt_parse_fmadm_faulty�sH	



25cC@s�i}t�}djd|d|r3dj|�ndd|rNdj|�nd�}td|�}|d	}i}|d
kr�d|d<nt|d
�}|S(u
    Display fault management logs

    after : string
        filter events after time, see man fmdump for format

    before : string
        filter events before time, see man fmdump for format

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.list
    u{cmd}{after}{before}R&tafteru -t {0}utbeforeu -T {0}ucmd.run_alluretcodeiuerror executing fmdumpuErrorustdout(R	RR)R(R9R:R+tfmdumpR&R-R.R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytlist_records�s		

cC@sti}t�}djd|d|�}td|�}|d}i}|dkr`d|d<nt|d	�}|S(
u�
    Display log details

    uuid: string
        uuid of fault

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.show 11b4070f-4358-62fa-9e1e-998f485977e1
    u{cmd} -u {uuid} -VR&R1ucmd.run_alluretcodeiuerror executing fmdumpuErrorustdout(R	RR)R"(R1R+R;R&R-R.R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytshows
			

cC@sni}t�}djd|�}td|�}|d}i}|dkrZd|d<nt|d�}|S(	ux
    Display fault manager configuration

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.config
    u{cmd} configR&ucmd.run_alluretcodeiuerror executing fmadm configuErrorustdout(RRR)R%(R+R,R&R-R.R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytconfig9s
			

cC@sni}t�}djd|d|�}td|�}|d}i}|dkrd|d|d<nt}|S(	u�
    Load specified fault manager module

    path: string
        path of fault manager module

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.load /module/path
    u{cmd} load {path}R&Rucmd.run_alluretcodeiustderruError(RRR)R*(RR+R,R&R-R.R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytloadSs
			
cC@sni}t�}djd|d|�}td|�}|d}i}|dkrd|d|d<nt}|S(	u�
    Unload specified fault manager module

    module: string
        module to unload

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.unload software-response
    u{cmd} unload {module}R&tmoduleucmd.run_alluretcodeiustderruError(RRR)R*(R@R+R,R&R-R.R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytunloadqs
			
cC@s�i}t�}djd|d|r3dj|�ndd|�}td|�}|d}i}|d	kr|d
|d<nt}|S(u�
    Reset module or sub-component

    module: string
        module to unload
    serd : string
        serd sub module

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.reset software-response
    u{cmd} reset {serd}{module}R&tserdu-s {0} uR@ucmd.run_alluretcodeiustderruError(RRR)R*(R@RBR+R,R&R-R.R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytreset�s			
cC@s
td|�S(u�
    Flush cached state for resource

    fmri: string
        fmri

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.flush fmri
    uflush(R/(R(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytflush�s
cC@s
td|�S(u�
    Notify fault manager that resource has been repaired

    fmri: string
        fmri

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.repaired fmri
    urepaired(R/(R(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytrepaired�s
cC@s
td|�S(u�
    Notify fault manager that resource has been replaced

    fmri: string
        fmri

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.repaired fmri
    ureplaced(R/(R(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytreplaced�s
cC@s
td|�S(u�
    Acquit resource or acquit case

    fmri: string
        fmri or uuid

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.acquit fmri | uuid
    uacquit(R/(R(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytacquit�s
cC@s^t�}djd|�}td|�}i}|ddkrJt}nt|d�}|S(uu
    Display list of faulty resources

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.faulty
    u{cmd} faultyR&ucmd.run_allustdoutu(RRR)R
R8(R,R&R-R((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pytfaulty�s
				cC@st�r
tStS(u~
    Return whether fmadm is reporting faults

    CLI Example:

    .. code-block:: bash

        salt '*' fmadm.healthy
    (RHR
R*(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pythealthys
()t__doc__t
__future__RRRtloggingtsalt.utils.pathRtsalt.utils.platformtsalt.utils.decoratorsRt
decoratorstsalt.utils.odictRt	getLoggert__name__tlogt__func_alias__RtmemoizeRR	RRR"R%R/R8R3R<R=R>R?RARCRDRERFRGRHRI(((s>/usr/lib/python2.7/site-packages/salt/modules/solaris_fmadm.pyt<module>
s<
				"	"		F"				!					

Zerion Mini Shell 1.0