HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/wheel/__pycache__/__init__.cpython-310.pyc
o

;j��@sfdZddlmZddlZddlZddlZddlZddlZddl	ZGdd�dej
jjej
jj
�ZeZdS)z+
Modules used to control the master itself
�)�MappingNcsxeZdZdZdZdZddd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zddd�Zdd�Z
					d�fdd�	Z�ZS)�WheelClienta�
    An interface to Salt's wheel modules

    :ref:`Wheel modules <all-salt.wheel>` interact with various parts of the
    Salt Master.

    Importing and using ``WheelClient`` must be done on the same machine as the
    Salt Master and it must be done using the same user that the Salt Master is
    running as. Unless :conf_master:`external_auth` is configured and the user
    is authorized to execute wheel functions: (``@wheel``).

    Usage:

    .. code-block:: python

        import salt.config
        import salt.wheel
        opts = salt.config.master_config('/etc/salt/master')
        wheel = salt.wheel.WheelClient(opts)
    �wheelNcCs�tjjjj|||d�tjjjj|||d�||_|pi|_d|_tj	j
��|_tj	jj
d|jd|jdd�|_tjj||jd�|_dS)N)�contextZmasterZsock_dirF)�opts�listen)�salt�client�mixins�SyncClientMixin�__init__�AsyncClientMixinrr�event�utils�userZget_specific_userZ	salt_userZ	get_event�loaderZwheels�	functions)�selfrr�r�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/wheel/__init__.pyr*s
�zWheelClient.__init__cCsV|jdur
|j��d|_t|d�r'|jdur)t|jd�r"|j��i|_dSdSdS)Nr�destroy)rr�hasattrr�rrrrr6s



�zWheelClient.destroycCs|S�Nrrrrr�	__enter__?szWheelClient.__enter__cGs|��dSr)r)r�argsrrr�__exit__BszWheelClient.__exit__cKs"|j|||�dd�|�dd�d�S)z)
        Backwards compatibility
        �print_eventT�full_returnF)rr)�low�get)r�fun�kwargsrrr�	call_funcFs

�zWheelClient.call_funccKs�|}d|d<|jd}|dkrd}|dkrd}d�tjj�|�t|jd	��}tjjj	j
|jd
|dd��
}|�|�}Wd
�n1sDwYt|t
�r^d|vr^tjjjdi|d��|S)zX
        Execute a wheel function through the master network interface (eauth).
        r�cmd�	interfacez0.0.0.0z	127.0.0.1z::z::1ztcp://{}:{}Zret_port�clear�master_call)Zcrypt�
master_uri�usageN�errorr)r�formatrr�networkZ
ip_bracket�str�channelr	Z
ReqChannel�factory�send�
isinstancerr*Zraise_error)rr"�loadr%r(r.�retrrrr'Ss*
�

��
zWheelClient.master_callFcCs|jdi|��S)a3
        Execute a wheel function synchronously; eauth is respected

        This function requires that :conf_master:`external_auth` is configured
        and the user is authorized to execute runner functions: (``@wheel``).

        .. code-block:: python

            >>> wheel.cmd_sync({
            'fun': 'key.finger',
            'match': 'jerry',
            'eauth': 'auto',
            'username': 'saltdev',
            'password': 'saltdev',
            })
            {'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}}
        Nr)r')rr�timeoutrrrr�cmd_syncmszWheelClient.cmd_synccCs|�d�}|j||dd�S)a
        Execute a function asynchronously; eauth is respected

        This function requires that :conf_master:`external_auth` is configured
        and the user is authorized

        .. code-block:: python

            >>> wheel.cmd_async({
                'fun': 'key.finger',
                'match': 'jerry',
                'eauth': 'auto',
                'username': 'saltdev',
                'password': 'saltdev',
            })
            {'jid': '20131219224744416681', 'tag': 'salt/wheel/20131219224744416681'}
        r!F)�local)r Zasynchronous)rrr!rrr�	cmd_async�s
zWheelClient.cmd_asyncTcst��||||||�S)z�
        Execute a function

        .. code-block:: python

            >>> wheel.cmd('key.finger', ['jerry'])
            {'minions': {'jerry': '5d:f6:79:43:5e:d4:42:3f:57:b8:45:a8:7e:a4:6e:ca'}}
        )�superr$)rr!�argZpub_data�kwargrr��	__class__rrr$�szWheelClient.cmdr)NF)NNNTF)�__name__�
__module__�__qualname__�__doc__r	Z
tag_prefixrrrrr#r'r5r7r$�
__classcell__rrr;rrs$
	
�r)r@�collections.abcrZsalt.channel.clientrZsalt.client.mixinsZsalt.configZsalt.loaderZsalt.utils.errorZsalt.utils.networkr	r
rr
rZWheelrrrr�<module>s
�