%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/test.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
ZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZdgZidd	6d
d6dd
6Zeje�Zed�d��Zd�Z d�Z!d�Z"d�Z#d�Z$dd�Z%d�Z&d�Z'd�Z(ej)j*j+e(d�Z,d�Z-d�Z.dd�Z0d�Z1d�Z2d �Z3d!�Z4d"�Z5d#�Z6d$�Z7d%�Z8d&d'�Z9d(�Z:d)�Z;d*�Z<d+�Z=d,dd-�Z>d,dd.�Z?d/d0�Z@d1�ZAd2�ZBeCd3�ZDd4�ZEd5�ZFd6�ZGd7�ZHdS(8u$
Module for running arbitrary tests
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tbuiltins(tdependsu*utrueutrue_ufalseufalse_utryutry_unon_existantmodulenamecC@sdS(Nufoo((((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytmissing_func(scC@s
tjj�S(uz
    Call grains.items via the attribute

    CLI Example:

    .. code-block:: bash

        salt '*' test.attr_call
    (t__salt__tgrainstitems(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt	attr_call-s
cC@stigd6gd6gd6gd6gd6gd6gd6}x�tD]�}d|krd|dj|�q>|dj|�tt|�r�|dj|�nxtt|D]h}d	j||�}ttt|�|�r�|dj|�n|t|kr�|dj|�q�q�Wq>WxZ|dD]N}||dkrH|dj|�n||dkr|dj|�qqW|S(
u�
    Return a dict containing all of the execution modules with a report on
    the overall availability via different references

    CLI Example:

    .. code-block:: bash

        salt '*' test.module_report
    u	functionsufunction_attrsu
function_subsumodulesumodule_attrsu
missing_attrsumissing_subsu.u{0}.{1}(Rtappendthasattrtformattgetattr(trettreftfunctfull((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt
module_report:s2


cC@s|S(u�
    Return a string - used for testing the connection

    CLI Example:

    .. code-block:: bash

        salt '*' test.echo 'foo bar baz quo qux'
    ((ttext((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytechoas
cC@sqtjjj�s/tjdtjd��tStddd}tjdt	�rbtd|�St
|�SdS(	u�
    Used to make sure the minion is up and responding. Not an ICMP ping.

    Returns ``True``.

    CLI Example:

    .. code-block:: bash

        salt '*' test.ping
    u"test.ping received for minion '%s'uiduproxyu	proxytypeu.pinguadd_proxymodule_to_optsuproxymoduleN(tsalttutilstplatformtis_proxytlogtdebugt__opts__tgettTruetFalset	__proxy__(tping_cmd((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytpingns
cC@stjt|��tS(u�
    Instruct the minion to initiate a process that will sleep for a given
    period of time.

    CLI Example:

    .. code-block:: bash

        salt '*' test.sleep 20
    (ttimetsleeptintR(tlength((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyR$�si<cC@stjtjd|��tS(u�
    Sleep for a random number of seconds, used to test long-running commands
    and minions returning at differing intervals

    CLI Example:

    .. code-block:: bash

        salt '*' test.rand_sleep 60
    i(R#R$trandomtrandintR(tmax((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt
rand_sleep�scC@s
tjjS(u}
    Return the version of salt on the minion

    CLI Example:

    .. code-block:: bash

        salt '*' test.version
    (Rtversiont__version__(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyR+�s
cC@s
tjj�S(u�
    Report the versions of dependent and system software

    CLI Example:

    .. code-block:: bash

        salt '*' test.versions_information
    (RR+tversions_information(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyR-�s
cC@sdjtjj��S(u�
    Returns versions of components used by salt

    CLI Example:

    .. code-block:: bash

        salt '*' test.versions_report
    u
(tjoinRR+tversions_report(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyR/�s
uversionscC@stdd�S(u�
    Return the value for test.foo in the minion configuration file, or return
    the default value

    CLI Example:

    .. code-block:: bash

        salt '*' test.conf_test
    u
config.optionutest.foo(R(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt	conf_test�scC@stS(u�
    Return the configuration options passed to this minion

    CLI Example:

    .. code-block:: bash

        salt '*' test.get_opts
    (R(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytget_opts�s
cC@s#|dkrg}nt||�S(u	
    Execute a minion function via the __salt__ object in the test
    module, used to verify that the minion functions can be called
    via the __salt__ module.

    CLI Example:

    .. code-block:: bash

        salt '*' test.cross_test file.gid_to_group 0
    N(tNoneR(Rtargs((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt
cross_test�s	cK@s|S(uN
    Print out the data passed into the function ``**kwargs``, this is used to
    both test the publication data and cli kwarg passing, but also to display
    the information available within the publication data.

    CLI Example:

    .. code-block:: bash

        salt '*' test.kwarg num=1 txt="two" env='{a: 1, b: "hello"}'
    ((tkwargs((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytkwarg�scO@si|d6|d6S(u�
    Print out the data passed into the function ``*args`` and ```kwargs``, this
    is used to both test the publication data and cli argument passing, but
    also to display the information available within the publication data.
    Returns {"args": args, "kwargs": kwargs}.

    CLI Example:

    .. code-block:: bash

        salt '*' test.arg 1 "two" 3.1 txt="hello" wow='{a: 1, b: "hello"}'
    uargsukwargs((R3R5((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytarg	s
cO@s�igd6id6}x.|D]&}|djtjt|���qWx:tj|�D])\}}tjt|��|d|<qUW|S(u�
    Print out the types of the args and kwargs. This is used to test the types
    of the args and kwargs passed down to the minion

    CLI Example:

    .. code-block:: bash

           salt '*' test.arg_type 1 'int'
    uargsukwargs(RRt	text_typettypet	iteritems(R3R5Rtargumenttkeytval((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytarg_types
$!cO@sit|�d6t|�d6S(u�
    Print out the data passed into the function ``*args`` and ```kwargs``, this
    is used to both test the publication data and cli argument passing, but
    also to display the information available within the publication data.
    Returns {"args": repr(args), "kwargs": repr(kwargs)}.

    CLI Example:

    .. code-block:: bash

        salt '*' test.arg_repr 1 "two" 3.1 txt="hello" wow='{a: 1, b: "hello"}'
    uargsukwargs(trepr(R3R5((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytarg_repr0s
cO@s"td|dtjjj|��S(u�
    Like test.arg but cleans kwargs of the __pub* items
    CLI Example:

    .. code-block:: bash

        salt '*' test.arg_clean 1 "two" 3.1 txt="hello" wow='{a: 1, b: "hello"}'
    R3R5(tdictRRR3tclean_kwargs(R3R5((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt	arg_clean@s	cC@s�t|�}|dkr'td��ntj�}|dkrS|tj�|fSd}d}d}x+||kr�|||}}|d7}qhW|tj�|fS(u�
    Return the num-th Fibonacci number, and the time it took to compute in
    seconds. Used for performance tests.

    This function is designed to have terrible performance.

    CLI Example:

    .. code-block:: bash

        salt '*' test.fib 3
    iuNegative number is not allowed!ii(R%t
ValueErrorR#(tnumtstarttprevtcurrti((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytfibLs
cC@s�t|�}tj�}g}xW|dkrw|j|�|dkr!|ddkrc|d}qt|dd}q!q!W|tj�|fS(u�
    Execute the collatz conjecture from the passed starting number,
    returns the sequence and the time it took to compute. Used for
    performance tests.

    CLI Example:

    .. code-block:: bash

        salt '*' test.collatz 3
    iiii(R%R#R(RFtbegintsteps((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytcollatzjs

cC@s|S(u�
    Test the outputter, pass in data to return

    CLI Example:

    .. code-block:: bash

        salt '*' test.outputter foobar
    ((tdata((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt	outputter�s
i*cC@s|td<tS(u�
    Test that the returncode system is functioning correctly

    CLI Example:

    .. code-block:: bash

        salt '*' test.retcode 42
    uretcode(t__context__R(tcode((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytretcode�s

cC@s�d}x3tD]+}|jdj|��s1q
n|}Pq
W|sFdStjt|jj}tjj	|�}||j
d� S(u�
    Pass in a function name to discover what provider is being used

    CLI Example:

    .. code-block:: bash

        salt '*' test.provider service
    uu{0}.u.(Rt
startswithR
tsystmodulest
__module__t__file__tostpathtbasenametrindex(tmoduleRR<tpfn((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytprovider�s

cC@sMi}x@tD]8}|jd�d}||kr
||t|�<q
q
W|S(u�
    Return a dict of the provider names and the files that provided them

    CLI Example:

    .. code-block:: bash

        salt '*' test.providers
    u.i(RtsplitR^(Rtfuncnametmodname((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt	providers�s

cC@s�t�}t�}x�tjjtdd�D]�}tjj|�sIq+ntjj	|�saq+nx[tj
|�D]J}|jd�r�qqn|jd�d}||krq|j
|�qqqqWq+Wt|�S(u�
    List the modules that were not loaded by the salt loader system

    CLI Example:

    .. code-block:: bash

        salt '*' test.not_loaded
    umodulesumoduleu_u.i(RbtsetRtloadert_module_dirsRRXRYtisabstisdirtlistdirRSR_taddtsorted(tprovRtmod_dirtfn_tname((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt
not_loaded�s
		cC@s!i}|jt�t|d<|S(u�
    Return an opts package with the grains and opts for this minion.
    This is primarily used to create the options used for master side
    state compiling routines

    CLI Example:

    .. code-block:: bash

        salt '*' test.opts_pkg
    ugrains(tupdateRt
__grains__(R((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytopts_pkg�s

I��TcC@s)tjjjdd�td|d|�S(NuNeonu2test.rand_str has been renamed to test.random_hashtsizet	hash_type(RRtversionst
warn_untiltrandom_hash(RsRt((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytrand_str�scC@s7|stjdd�}ntjjjd|d|�S(u�
    .. versionadded:: 2015.5.2
    .. versionchanged:: 2018.3.0
        Function has been renamed from ``test.rand_str`` to
        ``test.random_hash``

    Generates a random number between 1 and ``size``, then returns a hash of
    that number. If no ``hash_type`` is passed, the hash_type specified by the
    minion's :conf_minion:`hash_type` config option is used.

    CLI Example:

    .. code-block:: bash

        salt '*' test.random_hash
        salt '*' test.random_hash hash_type=sha512
    u	hash_typeumd5RsRt(RRRRt	hashutilsRw(RsRt((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyRw�suTest ExceptioncC@st|��dS(u�
    Raise an exception

    Optionally provide an error message or output the full stack.

    CLI Example:

    .. code-block:: bash

        salt '*' test.exception 'Oh noes!'
    N(t	Exception(tmessage((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt	exceptionscC@sdjtj��S(uq
    Return the current stack trace

    CLI Example:

    .. code-block:: bash

        salt '*' test.stack
    u(R.t	tracebacktformat_stack(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytstack!s
cO@sdS(u�
    Deprecated! Moved to cmdmod.

    CLI Example:

    .. code-block:: bash

        salt '*' test.tty tty0 'This is a test'
        salt '*' test.tty pts3 'This is a test'
    u.ERROR: This function has been moved to cmd.tty((R3R5((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyttty.scK@s6yt||�SWntk
r1}|r2|SnXdS(u�
    Try to run a module command. On an exception return None.
    If `return_try_exception` is set True return the exception.
    This can be helpful in templates where running a module might fail as expected.

    CLI Example:

    .. code-block:: bash

        <pre>
        {% for i in range(0,230) %}
            {{ salt['test.try'](module='ipmi.get_users', bmc_host='172.2.2.'+i)|yaml(False) }}
        {% endfor %}
        </pre>
    N(RRzR2(R\treturn_try_exceptionR5te((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyttry_<scC@s|st�dS(uv
    Assert the given argument

    CLI Example:

    .. code-block:: bash

        salt '*' test.assertion False
    N(tAssertionError(t	assertion((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyR�Ts
cC@stS(ud
    Always return True

    CLI Example:

    .. code-block:: bash

        salt '*' test.true
    (R(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyttrue_as
cC@stS(uf
    Always return False

    CLI Example:

    .. code-block:: bash

        salt '*' test.false
    (R(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pytfalse_ns
c@s��fd��y||jd�r:ttj|d�}ntt|�}�|�rv||tjjj|���ntj	d|�t
SWn"tk
r�tj	d|�t
SXdS(u
    Raise an exception. Built-in exceptions and those in ``salt.exceptions``
    can be raised by this test function. If no matching exception is found,
    then no exception will be raised and this function will return ``False``.

    This function is designed to test Salt's exception and return code
    handling.

    CLI Example:

    .. code-block:: bash

        salt '*' test.raise_exception TypeError "An integer is required"
        salt '*' test.raise_exception salt.exceptions.CommandExecutionError "Something went wrong"
    c@s6x/|jD] }|tkr Pq
�|�Sq
WtStS(N(t	__bases__t
BaseExceptionRR(tclstbase(t_is_exc(s5/usr/lib/python2.7/site-packages/salt/modules/test.pyR��susalt.exceptions.iu%s is not an exceptionuNo such exception: %sN(RSRRt
exceptionsRRR3RBRterrorRtAttributeError(RnR3R5texc((R�s5/usr/lib/python2.7/site-packages/salt/modules/test.pytraise_exception{s
!
(It__doc__t
__future__RRRtloggingRXRTR#R}R'tsalt.exceptionsRtsalt.utils.argstsalt.utils.functoolstsalt.utils.hashutilstsalt.utils.platformtsalt.utils.versionstsalt.versiontsalt.loadertsalt.extRtsalt.ext.six.movesRtsalt.utils.decoratorsRt__proxyenabled__t__func_alias__t	getLoggert__name__RRR
RRR"R$R*R+R-R/Rt	functoolstalias_functionRuR0R1R2R4R6R7R>R@RCRJRMRORRR^RbRoRrRxRwR|RR�RR�R�R�R�R�(((s5/usr/lib/python2.7/site-packages/salt/modules/test.pyt<module>sz	
	
	'	
			
	
	
		
								
					
		
	
	

Zerion Mini Shell 1.0