golden hour
/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__pycache__
⬆️ Go Up
Upload
File/Folder
Size
Actions
__init__.cpython-310.pyc
49.05 KB
Del
OK
mixins.cpython-310.pyc
15.23 KB
Del
OK
netapi.cpython-310.pyc
2.24 KB
Del
OK
Edit: __init__.cpython-310.pyc
o �xe�: � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlZddl Zddl ZddlZddlZddl ZddlZddlmZ ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZmZmZm Z m!Z!m"Z" dZ#zddl$Z%dZ#W n e&y� Y nw e�'e(�Z)ej*�+ej,d�dddddfdd �Z-G d d� d�Z.G dd � d e/�Z0G dd� d�Z1G dd� d�Z2dS )a' The client module is used to create a client connection to the publisher The data structure needs to be: {'enc': 'clear', 'load': {'fun': '<mod.callable>', 'arg':, ('arg1', 'arg2', ...), 'tgt': '<glob or id>', 'key': '<read in the key file>'} � N)�datetime)�AuthenticationError�AuthorizationError�EauthAuthenticationError�PublishError�SaltClientError�SaltInvocationError�SaltReqTimeoutErrorFT�masterc C s0 |r|}n ddl }|j�| �}t|||||d�S )a� .. versionadded:: 2014.7.0 Read in the config and return the correct LocalClient object based on the configured transport :param str c_path: Path of config file to use for opts. The default value is None. :param bool mopts: When provided the local client will use this dictionary of options insead of loading a config file from the value of c_path. The default value is None. :param str skip_perm_errors: Ignore permissions errors while loading keys. The default value is False. :param IOLoop io_loop: io_loop used for events. Pass in an io_loop if you want asynchronous operation for obtaining events. Eg use of set_event_handler() API. Otherwise, operation will be synchronous. :param bool keep_loop: Do not destroy the event loop when closing the event subsriber. :param bool auto_reconnect: When True the event subscriber will reconnect automatically if a disconnect error is raised. .. versionadded:: 3004 :param bool listen: Listen for events indefinitly. When option is set the LocalClient object will listen for events until it's destroy method is called. The default value is False. r N)�mopts�skip_perm_errors�io_loop�auto_reconnect�listen)�salt.config�config� client_config�LocalClient)�c_pathr r r r r �opts�salt� r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__init__.py�get_local_clientD s /�r c @ sR e Zd ZdZej�ejd�ddddddfdd�Z dd� Z d d � Zdd� ZdUdd�Z dUdd�Z dVdd�Zdd� Zejjjj dWdd��Z dXdd�Z dYdd�Z dZd!d"�Z d[d#d$�Z d\d%d&�Z d]d'd(�Z d^d)d*�Z d_d+d,�Z - d`d.d/�Zdad0d1�Z d2d3� Z! - dbd4d5�Z"dad6d7�Z#dad8d9�Z$d:d;� Z% - dcd<d=�Z& - ddd>d?�Z'dad@dA�Z(dBdC� Z)dDdE� Z* F dedGdH�Z+ejjjj F dfdIdJ��Z,dKdL� Z-dMdN� Z.dOdP� Z/dQdR� Z0dSdT� Z1dS )gr a> The interface used by the :command:`salt` CLI tool on the Salt Master ``LocalClient`` is used to send a command to Salt minions to execute :ref:`execution modules <all-salt.modules>` and return the results to the Salt Master. Importing and using ``LocalClient`` 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 authentication credentials are included in the execution). .. note:: The LocalClient uses a Tornado IOLoop, this can create issues when using the LocalClient inside an existing IOLoop. If creating the LocalClient in partnership with another IOLoop either create the IOLoop before creating the LocalClient, or when creating the IOLoop use ioloop.current() which will return the ioloop created by LocalClient. .. code-block:: python import salt.client local = salt.client.LocalClient() local.cmd('*', 'test.fib', [10]) r NFc C s� |r|| _ ntj�|�rt�d| jj|� tj � |�| _ tjj� � | _|| _| �� | _|| _|| _tjjjd| j d | j | j||d�| _tj�| j �| _tjj| j | jd�| _tj�| j | j�| _dS )a� :param str c_path: Path of config file to use for opts. The default value is None. :param bool mopts: When provided the local client will use this dictionary of options insead of loading a config file from the value of c_path. The default value is None. :param str skip_perm_errors: Ignore permissions errors while loading keys. The default value is False. :param IOLoop io_loop: io_loop used for events. Pass in an io_loop if you want asynchronous operation for obtaining events. Eg use of set_event_handler() API. Otherwise, operation will be synchronous. :param bool keep_loop: Do not destroy the event loop when closing the event subsriber. :param bool auto_reconnect: When True the event subscriber will reconnect automatically if a disconnect error is raised. .. versionadded:: 3004 :param bool listen: Listen for events indefinitly. When option is set the LocalClient object will listen for events until it's destroy method is called. The default value is False. zP%s expects a file path not a directory path(%s) to its 'c_path' keyword argumentr �sock_dir)r r r � keep_loop)�utilsN)r �os�path�isdir�log�warning� __class__�__name__r r r r �userZget_specific_user� salt_userr �_LocalClient__read_master_key�keyr r �event� get_event�loaderZminion_mods� functions� returners)�selfr r r r r r r r r r �__init__� s2 ,� �zLocalClient.__init__c C s� | j }|dkr| j�dd�dkr| j�dd�}|�d�r#| j�dd�}tjj�� r/|�dd�}t j �| jd d�|��}z2tjj �| jd || j� tjj�|d��}tjj�|�� �W d � W S 1 sgw Y W d S ttfyz Y d S w )z@ Read in the rotating master authentication key �rootr$ Zsudo_�\�_Zcachedirz.{}_key�rN� )r% r �get� startswithr r �platformZ is_windows�replacer r �join�formatZverifyZcheck_path_traversalr �filesZfopenZstringutilsZ to_unicode�read�OSErrorr )r- Zkey_user�keyfiler'